podcast-dl 8.0.3 → 8.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -22,42 +22,43 @@ A CLI for downloading podcasts with a focus on archiving.
22
22
 
23
23
  Type values surrounded in square brackets (`[]`) can be used as used as boolean options (no argument required).
24
24
 
25
- | Option | Type | Required | Description |
26
- | ------------------------ | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
- | --url | String | true | URL to podcast RSS feed. |
28
- | --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Templating" for more details. |
29
- | --threads | Number | false | Determines the number of downloads that will happen concurrently. Default is 1. |
30
- | --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. |
31
- | --episode-template | String | false | Template for generating episode related filenames. See "Templating" for details. |
32
- | --include-meta | | false | Write out podcast metadata to JSON. |
33
- | --include-episode-meta | | false | Write out individual episode metadata to JSON. |
34
- | --include-episode-images | | false | Download found episode images. |
35
- | --offset | Number | false | Offset starting download position. Default is 0. |
36
- | --limit | Number | false | Max number of episodes to download. Downloads all by default. |
37
- | --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). |
38
- | --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) |
39
- | --episode-regex | String | false | Match episode title against provided regex before starting download. |
40
- | --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**) |
41
- | --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) |
42
- | --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) |
43
- | --override | | false | Override local files on collision. |
44
- | --reverse | | false | Reverse download direction and start at last RSS item. |
45
- | --info | | false | Print retrieved podcast info instead of downloading. |
46
- | --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
47
- | --exec | String | false | Execute a command after each episode is downloaded. See "Templating" for more details. |
48
- | --parser-config | String | false | Path to JSON file that will be parsed and used to override the default config passed to [rss-parser](https://github.com/rbren/rss-parser#xml-options). |
49
- | --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
50
- | --version | | false | Output the version number. |
51
- | --help | | false | Output usage information. |
25
+ | Option | Type | Required | Description |
26
+ | ------------------------ | ------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
27
+ | --url | String | true | URL to podcast RSS feed. |
28
+ | --out-dir | String | false | Specify output directory for episodes and metadata. Defaults to "./{{podcast_title}}". See "Template Options" for more details. |
29
+ | --threads | Number | false | Determines the number of downloads that will happen concurrently. Default is 1. |
30
+ | --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 "Template Options" for more details. |
31
+ | --episode-template | String | false | Template for generating episode related filenames. See "Template Options" for details. |
32
+ | --include-meta | | false | Write out podcast metadata to JSON. |
33
+ | --include-episode-meta | | false | Write out individual episode metadata to JSON. |
34
+ | --include-episode-images | | false | Download found episode images. |
35
+ | --offset | Number | false | Offset starting download position. Default is 0. |
36
+ | --limit | Number | false | Max number of episodes to download. Downloads all by default. |
37
+ | --after | String | false | Only download episodes after this date (i.e. MM/DD/YYY, inclusive). |
38
+ | --before | String | false | Only download episodes before this date (i.e. MM/DD/YYY, inclusive) |
39
+ | --episode-regex | String | false | Match episode title against provided regex before starting download. |
40
+ | --episode-digits | Number | false | Minimum number of digits to use for episode numbering (e.g. 3 would generate "001" instead of "1"). Default is 0. |
41
+ | --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**) |
42
+ | --adjust-bitrate | String (e.g. "48k") | false | Attempts to adjust bitrate of MP3s. (**ffmpeg required**) |
43
+ | --mono | | false | Attempts to force MP3s into mono. (**ffmpeg required**) |
44
+ | --override | | false | Override local files on collision. |
45
+ | --reverse | | false | Reverse download direction and start at last RSS item. |
46
+ | --info | | false | Print retrieved podcast info instead of downloading. |
47
+ | --list | [String] | false | Print episode list instead of downloading. Defaults to "table" when used as a boolean option. "json" is also supported. |
48
+ | --exec | String | false | Execute a command after each episode is downloaded. See "Template Options" for more details. |
49
+ | --parser-config | String | false | Path to JSON file that will be parsed and used to override the default config passed to [rss-parser](https://github.com/rbren/rss-parser#xml-options). |
50
+ | --proxy | | false | Enable proxy support. Specify environment variables listed by [global-agent](https://github.com/gajus/global-agent#environment-variables). |
51
+ | --version | | false | Output the version number. |
52
+ | --help | | false | Output usage information. |
52
53
 
53
54
  ## Archive
54
55
 
55
56
  - If passed the `--archive [path]` option, `podcast-dl` will generate/use a JSON archive at the provided path.
56
57
  - Before downloading an episode or writing out metadata, it'll check if the item was saved previously and abort the save if found.
57
58
 
58
- ## Templating
59
+ ## Template Options
59
60
 
60
- Options that support templating allow users to specify a template for the generated filename(s) or option. The provided template will replace all matched keywords with the related data described below. Each keyword must be wrapped in two braces like so:
61
+ Options that support templates allow users to specify a template for the generated filename(s) or option. The provided template will replace all matched keywords with the related data described below. Each keyword must be wrapped in two braces like so:
61
62
 
62
63
  `--out-dir "./{{podcast_title}}"`
63
64
 
package/bin/async.js CHANGED
@@ -140,6 +140,7 @@ let downloadItemsAsync = async ({
140
140
  basePath,
141
141
  bitrate,
142
142
  episodeTemplate,
143
+ episodeDigits,
143
144
  exec,
144
145
  feed,
145
146
  includeEpisodeMeta,
@@ -171,6 +172,7 @@ let downloadItemsAsync = async ({
171
172
  url: episodeAudioUrl,
172
173
  ext: audioFileExt,
173
174
  template: episodeTemplate,
175
+ width: episodeDigits,
174
176
  });
175
177
  const outputPodcastPath = _path.resolve(basePath, episodeFilename);
176
178
 
package/bin/bin.js CHANGED
@@ -34,6 +34,7 @@ const {
34
34
  url,
35
35
  outDir,
36
36
  episodeTemplate,
37
+ episodeDigits,
37
38
  includeMeta,
38
39
  includeEpisodeMeta,
39
40
  includeEpisodeImages,
@@ -198,6 +199,7 @@ const main = async () => {
198
199
  basePath,
199
200
  bitrate,
200
201
  episodeTemplate,
202
+ episodeDigits,
201
203
  exec,
202
204
  feed,
203
205
  includeEpisodeMeta,
package/bin/commander.js CHANGED
@@ -4,7 +4,7 @@ import { logErrorAndExit } from "./logger.js";
4
4
 
5
5
  export const setupCommander = (commander, argv) => {
6
6
  commander
7
- .version("8.0.3")
7
+ .version("8.0.5")
8
8
  .option("--url <string>", "url to podcast rss feed")
9
9
  .option(
10
10
  "--out-dir <path>",
@@ -20,6 +20,12 @@ export const setupCommander = (commander, argv) => {
20
20
  "template for generating episode related filenames",
21
21
  "{{release_date}}-{{title}}"
22
22
  )
23
+ .option(
24
+ "--episode-digits <number>",
25
+ "minimum number of digits to use for episode numbering (leading zeros)",
26
+ createParseNumber({ min: 0, name: "--episode-digits" }),
27
+ 1
28
+ )
23
29
  .option("--include-meta", "write out podcast metadata to json")
24
30
  .option(
25
31
  "--include-episode-meta",
package/bin/naming.js CHANGED
@@ -11,7 +11,7 @@ const getSafeName = (name) => {
11
11
  });
12
12
  };
13
13
 
14
- const getFilename = ({ item, ext, url, feed, template }) => {
14
+ const getFilename = ({ item, ext, url, feed, template, width }) => {
15
15
  const episodeNum = feed.items.length - item._originalIndex;
16
16
  const formattedPubDate = item.pubDate
17
17
  ? dayjs(new Date(item.pubDate)).format("YYYYMMDD")
@@ -20,7 +20,7 @@ const getFilename = ({ item, ext, url, feed, template }) => {
20
20
  const templateReplacementsTuples = [
21
21
  ["title", item.title || ""],
22
22
  ["release_date", formattedPubDate || ""],
23
- ["episode_num", episodeNum],
23
+ ["episode_num", `${episodeNum}`.padStart(width, "0")],
24
24
  ["url", url],
25
25
  ["podcast_title", feed.title || ""],
26
26
  ["podcast_link", feed.link || ""],
@@ -53,11 +53,11 @@ const getFolderName = ({ feed, template }) => {
53
53
  const replaceRegex = new RegExp(`{{${matcher}}}`, "g");
54
54
 
55
55
  name = replacement
56
- ? name.replace(replaceRegex, replacement)
56
+ ? name.replace(replaceRegex, getSafeName(replacement))
57
57
  : name.replace(replaceRegex, "");
58
58
  });
59
59
 
60
- return getSafeName(name);
60
+ return name;
61
61
  };
62
62
 
63
63
  const getArchiveFilename = ({ pubDate, name, ext }) => {
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "8.0.3",
3
+ "version": "8.0.5",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",
7
7
  "scripts": {
8
- "build": "rimraf ./binaries && npx webpack && npm run pkg",
9
- "lint": "eslint ./bin",
10
- "pkg": "npx pkg ./dist/podcast-dl.js --targets node14-linux-x64,node14-win-x64,node14-macos-x64 --out-path ./binaries"
8
+ "build": "rimraf ./binaries && rimraf ./dist && node build.cjs",
9
+ "lint": "eslint ./bin"
11
10
  },
12
11
  "lint-staged": {
13
12
  "*.{js,json,md}": [
@@ -43,9 +42,10 @@
43
42
  "eslint-config-prettier": "^6.11.0",
44
43
  "husky": "^4.2.5",
45
44
  "lint-staged": "^10.1.7",
45
+ "pkg": "^5.8.0",
46
46
  "prettier": "2.3.2",
47
47
  "rimraf": "^3.0.2",
48
- "webpack-cli": "^5.0.1"
48
+ "webpack": "^5.75.0"
49
49
  },
50
50
  "dependencies": {
51
51
  "command-exists": "^1.2.9",