diff --git a/README.md b/README.md index 9ef20d7..ceea3d6 100644 --- a/README.md +++ b/README.md @@ -22,35 +22,36 @@ ## Options -| Option | Type | Required | Description | -| ----------------------- | -------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| --url | String | true | URL to podcast RSS feed. | -| --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Templating" for more details. | -| --archive | String | false | Download or write out items not listed in archive file. Generates archive file at path if not found. Defaults to "./{{podcast_title}}/archive.json". See "Templating" for more details. | -| --episode-template | String | false | Template for generating episode related filenames. See "Templating" for details. | -| --include-meta | | false | Write out podcast metadata to JSON. | -| --include-episode-meta | | false | Write out individual episode metadata to JSON. | -| --ignore-episode-images | | false | Ignore downloading found images from --include-episode-meta. | -| --offset | Number | false | Offset starting download position. Default is 0. | -| --limit | Number | false | Max number of episodes to download. Downloads all by default. | -| --list-format | String ("table" \| "json") | false | How to structure list data when logged. Default is "table". | -| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). | -| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) | -| --episode-regex | String | false | Match episode title against provided regex before starting download. | -| --add-mp3-metadata | | false | Attempts to add a base level of MP3 metadata to each episode. Recommended only in cases where the original metadata is of poor quality. (**ffmpeg required**) | -| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) | -| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) | -| --override | | false | Override local files on collision. | -| --reverse | | false | Reverse download direction and start at last RSS item. | -| --info | | false | Print retrieved podcast info instead of downloading. | -| --list | | false | Print episode list instead of downloading. | -| --exec | String | false | Execute a command after each episode is downloaded. | -| --version | | false | Output the version number. | -| --help | | false | Output usage information. | +**Type values surrounded in square brackets `[]` can be used as used as boolean options (no argument required).** + +| Option | Type | Required | Description | +| ----------------------- | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| --url | String | true | URL to podcast RSS feed. | +| --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Templating" for more details. | +| --archive | [String] | false | Download or write out items not listed in archive file. Generates archive file at path if not found. Defaults to "./{{podcast_title}}/archive.json" when used as a boolean option. See "Templating" for more details. | +| --episode-template | String | false | Template for generating episode related filenames. See "Templating" for details. | +| --include-meta | | false | Write out podcast metadata to JSON. | +| --include-episode-meta | | false | Write out individual episode metadata to JSON. | +| --ignore-episode-images | | false | Ignore downloading found images from --include-episode-meta. | +| --offset | Number | false | Offset starting download position. Default is 0. | +| --limit | Number | false | Max number of episodes to download. Downloads all by default. | +| --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). | +| --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) | +| --episode-regex | String | false | Match episode title against provided regex before starting download. | +| --add-mp3-metadata | | false | Attempts to add a base level of MP3 metadata to each episode. Recommended only in cases where the original metadata is of poor quality. (**ffmpeg required**) | +| --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) | +| --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) | +| --override | | false | Override local files on collision. | +| --reverse | | false | Reverse download direction and start at last RSS item. | +| --info | | false | Print retrieved podcast info instead of downloading. | +| --list | [String] | false | Print episode list instead of downloading. May optionally be passed "table" or "json" to specify output type. | +| --exec | String | false | Execute a command after each episode is downloaded. | +| --version | | false | Output the version number. | +| --help | | false | Output usage information. | ## Archive -- If passed the `--archive ` option, `podcast-dl` will generate/use a JSON archive at the provided path. +- If passed the `--archive [path]` option, `podcast-dl` will generate/use a JSON archive at the provided path. - Before downloading an episode or writing out metadata, it'll check if the item was saved previously and abort the save if found. ## Templating diff --git a/bin/bin.js b/bin/bin.js index 6ca27a1..890aa6c 100644 --- a/bin/bin.js +++ b/bin/bin.js @@ -95,25 +95,21 @@ commander .option("--override", "override local files on collision") .option("--reverse", "download episodes in reverse order") .option("--info", "print retrieved podcast info instead of downloading") - .option("--list", "print episode info instead of downloading") .option( - "--list-format ", - "how to structure list data when logged", + "--list [table|json]", + "print episode info instead of downloading", (value) => { - if (!value) { - return undefined; - } - if ( value !== ITEM_LIST_FORMATS.table && value !== ITEM_LIST_FORMATS.json ) { - logErrorAndExit(`${value} is an invalid format for --list`); + logErrorAndExit( + `${value} is an invalid format for --list\nUse "table" or "json"` + ); } return value; - }, - "table" + } ) .option( "--exec ", @@ -137,7 +133,6 @@ const { reverse, info, list, - listFormat, exec, mono, addMp3Metadata: addMp3MetadataFlag, @@ -165,6 +160,7 @@ const main = async () => { if (list) { if (feed.items && feed.items.length) { + const listFormat = typeof list === "boolean" ? "table" : list; logItemsList({ type: listFormat, feed,