Skip to content

Commit

Permalink
manpage stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Sequoia committed Apr 16, 2015
1 parent 1c76124 commit c94c870
Show file tree
Hide file tree
Showing 11 changed files with 279 additions and 76 deletions.
49 changes: 49 additions & 0 deletions doc/rado-download.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# rado-download(1) -- download shows in batch

## SYNOPSIS
```sh
rado download <slug> [--out path] [--skip offset] [--get number]
```

## DESCRIPTION
This command identifies a show by it's "**slug**", or the last part of the show page's URL
For example, to download shows listed on http://www.radioechoes.com/alka-seltzer-time, use:

A directory is created in the output path for each series, based on the slug.

## OPTIONS
`-o, --out <path>`
where to create show directory (if it doesn't exist). defaults to `.`.

`-s, --skip <offset>`
how many to skip (`0` to start with first show i.e. skip none)
If not specified the user will be prompted for this value.

`-n, --get <n>`
how many files to download.
If not specified the user will be prompted for this value.

## CONFIGURATION
All options for `rado download` may be specified in `.radorc`. Example:
```
# Always put tracks where Songbird can find them
out=~/Music
```

## EXAMPLES
Download Space Patrol, prompt for how many to d/l & skip
```sh
$ rado download space-patrol
```
Download the 11th episode of The Burkiss Way
```sh
$ rado download the-burkiss-way -s 10 -n 1
```
Download the first three episodes of The Six Shooter to your home directory
```sh
$ rado download the-burkiss-way --skip 0 --get 3 --out ~
```
This will prompt you for how many to skip & how many to get
```sh
$ ./rado.js download the-burkiss-way
```
21 changes: 21 additions & 0 deletions doc/rado-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# rado-search(1) -- search for shows by title

## SYNOPSIS
```sh
rado search <search_term>
```

## DESCRIPTION
This command does what it says on the tin: it searches for shows by title. This
is useful to find a show if you only remember part of the title, and especially
useful to get the slug for `rado download`

## EXAMPLES
Search for shows with "shoot" in the title
```sh
$ rado search shoot
```
Serach for Space Patrol
```sh
$ rado search "space patrol"
```
71 changes: 71 additions & 0 deletions man/rado-download.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.TH "RADO\-DOWNLOAD" "1" "April 2015" "" ""
.SH "NAME"
\fBrado-download\fR \- download shows in batch
.SH SYNOPSIS
.P
.RS 2
.nf
rado download <slug> [\-\-out path] [\-\-skip offset] [\-\-get number]
.fi
.RE
.SH DESCRIPTION
.P
This command identifies a show by it's "\fBslug\fR", or the last part of the show page's URL
For example, to download shows listed on http://www\.radioechoes\.com/alka\-seltzer\-time, use:
.P
A directory is created in the output path for each series, based on the slug\.
.SH OPTIONS
.P
\fB\-o, \-\-out <path>\fR
where to create show directory (if it doesn't exist)\. defaults to \fB\|\.\fR\|\.
.P
\fB\-s, \-\-skip <offset>\fR
how many to skip (\fB0\fR to start with first show i\.e\. skip none)
If not specified the user will be prompted for this value\.
.P
\fB\-n, \-\-get <n>\fR
how many files to download\.
If not specified the user will be prompted for this value\.
.SH CONFIGURATION
.P
All options for \fBrado download\fR may be specified in \fB\|\.radorc\fR\|\. Example:
.P
.RS 2
.nf
# Always put tracks where Songbird can find them
out=~/Music
.fi
.RE
.SH EXAMPLES
.P
Download Space Patrol, prompt for how many to d/l & skip
.P
.RS 2
.nf
$ rado download space\-patrol
.fi
.RE
.P
Download the 11th episode of The Burkiss Way
.P
.RS 2
.nf
$ rado download the\-burkiss\-way \-s 10 \-n 1
.fi
.RE
.P
Download the first three episodes of The Six Shooter to your home directory
.P
.RS 2
.nf
$ rado download the\-burkiss\-way \-\-skip 0 \-\-get 3 \-\-out ~
.fi
.RE
.P
This will prompt you for how many to skip & how many to get
.P
.RS 2
.nf
$ \./rado\.js download the\-burkiss\-way
.fi
.RE
32 changes: 32 additions & 0 deletions man/rado-search.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.TH "RADO\-SEARCH" "1" "April 2015" "" ""
.SH "NAME"
\fBrado-search\fR \- search for shows by title
.SH SYNOPSIS
.P
.RS 2
.nf
rado search <search_term>
.fi
.RE
.SH DESCRIPTION
.P
This command does what it says on the tin: it searches for shows by title\. This
is useful to find a show if you only remember part of the title, and especially
useful to get the slug for \fBrado download\fR
.SH EXAMPLES
.P
Search for shows with "shoot" in the title
.P
.RS 2
.nf
$ rado search shoot
.fi
.RE
.P
Serach for Space Patrol
.P
.RS 2
.nf
$ rado search "space patrol"
.fi
.RE
37 changes: 37 additions & 0 deletions man/rado.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.TH "RADO" "1" "April 2015" "" ""
.SH "NAME"
\fBrado\fR \- find & download OTR programs
.SH SYNOPSIS
.P
.RS 2
.nf
rado <command> [options]
.fi
.RE
.SH DESCRIPTION
.P
This tool allows you to find & download old time radio shows available on
radioechoes\.com\. You can specify how which show to download and how many
episodes\. See the \fBdocs/\fR directory or the manpages for each command for more
info about those commands and their usage\.
.SH COMMANDS
.P
\fBdownload <slug> [options]\fR
Download shows\. See \fBrado help download\fR for more
.P
\fBsearch <search_term>\fR
Search for shows\. See \fBrado help search\fR for more
.SH ABOUT
.P
I wanted all the The Burkiss Way \fIhttps://en\.wikipedia\.org/wiki/The_Burkiss_Way\fR
mp3s from RadioEchoes\.com \fIhttp://radioechoes\.com\fR\|\. In order to get the mp3
urls from the show page, one must click "download mp3", which opens a \fIsecond\fR
page (typically in overlay), and that second page has the link\. So I wrote this simple scraper\.
.SH LICENSE
.P
GPL 3
.SH CREDITS
.P
by Sequoia McDowell
.P
Special thanks to duchess & the entire honeyhole team, without whom this wouldn't have been possible
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
"version": "0.0.1",
"description": "scrape mp3s from radioEchoes.com show page",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"dox": "./scripts/build-man-pages.js"
},
"bin": {
"rado" : "rado.js"
"rado" : "./rado.js"
},
"directories": {
"man": "man"
},
"keywords": [
"scrape",
Expand All @@ -33,5 +36,8 @@
"request": "~2.40.0",
"string-padding": "~1.0.2",
"superenv": "0.0.1"
},
"devDependencies": {
"marked-man": "^0.1.4"
}
}
14 changes: 1 addition & 13 deletions rado-download.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,5 @@ function expandTilde(pathStr){
}

function printHelp(){
var cmd = program._name.replace('-',' ');
console.log('This command identifies a show by it\'s "slug", or the last part of the show page\'s URL');
console.log('For example, to download shows listed on http://www.radioechoes.com/alka-seltzer-time, use:');
console.log(' $ %s alka-seltzer-time', cmd);
console.log('');
console.log('Examples');
console.log('');
console.log(' Download Space Patrol, prompt for how many to d/l & skip');
console.log(' $ %s space-patrol', cmd);
console.log(' Download the 11th episode of The Burkiss Way');
console.log(' $ %s the-burkiss-way -s 10 -n 1', cmd);
console.log(' Download the first three episodes of The Six Shooter to your home directory');
console.log(' $ %s the-burkiss-way --skip 0 --get 3 --out ~', cmd);
console.log('`man %s` for more info about this program',program._name);
}
6 changes: 1 addition & 5 deletions rado-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,5 @@ function printResults(shows){
}

function printHelp(){
var cmd = program._name.replace('-',' ');
console.log('Examples');
console.log('');
console.log(' $ %s shoot', cmd);
console.log(' $ %s "space patrol"', cmd);
console.log('`man %s` for more info about this program',program._name);
}
6 changes: 2 additions & 4 deletions rado.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ program
.parse(process.argv);

function printHelp(){
console.log('See help on each command for usage examples for that command');
console.log(' $ %s help search', program._name);
console.log(' ~or~');
console.log(' $ %s search --help', program._name);
console.log('See --help on each command for usage examples for that command');
console.log('`man rado` for more info about this program');
}
77 changes: 25 additions & 52 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,33 @@
## Background
I wanted all the [The Burkiss Way](https://en.wikipedia.org/wiki/The_Burkiss_Way) mp3s from [RadioEchoes.com](http://radioechoes.com). In order to get the mp3 urls from the show page, one must click "download mp3", which opens a *second* page (typically in overlay), and that second page has the link. So I wrote this simple scraper.
# rado(1) -- find & download OTR programs

## Later on...
I decided to use this project as the basis for a talk with tags as steps & I don't keep the readme up to date on each step. As such the readme **may/will be inaccurate** 'til the end when I'll update it all to reflect the state of the project.

# Commands
:warning: Changes from step to step, watch the talk @todo link to talk :warning:
:point_right: Will update in the end

## `download`

### Arguments
* show slug: e.g. `a-day-in-the-life-of-dennis-day` for `http://www.radioechoes.com/a-day-in-the-life-of-dennis-day`

### Switches
* `out` *default: `.`*: where to create show directory (if it doesn't exist)
* `skip`: offset-- how many to skip (`0` to start with first show i.e. skip none)
* `get`: how many files to download

### `.radorc`
Any of the options that can be passed as switches may also be set in a `.radorc`
file in any of the [usual `rc` file locations](https://github.com/dominictarr/rc#standards).
See `.radorc.example`
## SYNOPSIS
```sh
rado <command> [options]
```

:information_source: `skip` & `get` will be requested if not passed as switches
## DESCRIPTION
This tool allows you to find & download old time radio shows available on
radioechoes.com. You can specify how which show to download and how many
episodes. See the `docs/` directory or the manpages for each command for more
info about those commands and their usage.

## `search`
Search for shows by title & output info about those shows
## COMMANDS
`download <slug> [options]`
Download shows. See `rado help download` for more

### Arguments
* search string: word/term to search for. show title is searched, case insensitive
`search <search_term>`
Search for shows. See `rado help search` for more

## Examples
Download the first 10 Burkiss Ways
```sh
$ ./rado.js download the-burkiss-way --out . --skip 0 --get 10
```
This will prompt you for how many to skip & how many to get
```sh
$ ./rado.js download the-burkiss-way
```
Download episodes 11-20 of The Six Shooter
```sh
$ ./rado.js download the-six-shooter -s 10 -n 10
```
Search for shows with "shoot" in the title
```sh
$ ./rado.js search shoot
```
Search for "space patrol"
```sh
$ ./rado.js search "space patrol"
```
## ABOUT
I wanted all the [The Burkiss Way](https://en.wikipedia.org/wiki/The_Burkiss_Way)
mp3s from [RadioEchoes.com](http://radioechoes.com). In order to get the mp3
urls from the show page, one must click "download mp3", which opens a *second*
page (typically in overlay), and that second page has the link. So I wrote this simple scraper.

## License
## LICENSE
GPL 3

## Special Thanks
to duchess & the entire honeyhole team, without whom this wouldn't have been possible
## CREDITS
by Sequoia McDowell

Special thanks to duchess & the entire honeyhole team, without whom this wouldn't have been possible
32 changes: 32 additions & 0 deletions scripts/build-man-pages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env node
var path = require('path-extra');
var fs = require('fs');
var _ = require('lodash');
var markedman= require('marked-man');

var docspath = path.resolve(__dirname,'../doc');
var manpath = path.resolve(__dirname,'../man');

//md files in doc/
fs.readdirSync(docspath)
.filter(isMarkdown) //just markdown files
.map(function(filename){ //write md file
createManfile(
path.join(docspath, filename),
path.basename(filename,'.md')
);
});

//special case: readme.md is not in doc/
var readmePath = path.resolve(__dirname,'..','readme.md');
createManfile(readmePath, 'rado');

function isMarkdown(filename){
return path.extname(filename) === '.md';
}

function createManfile(mdpath, commandName){
var manfilePath = path.join(manpath,commandName + '.1');
var md = fs.readFileSync(mdpath,'utf8');
fs.writeFileSync(manfilePath,markedman(md));
}

0 comments on commit c94c870

Please sign in to comment.