podcast-dl 8.0.0 → 8.0.2

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
@@ -71,6 +71,7 @@ Options that support templating allow users to specify a template for the genera
71
71
 
72
72
  - `title`: The title of the episode.
73
73
  - `release_date`: The release date of the episode in `YYYYMMDD` format.
74
+ - `episode_num`: The location number of where the episodes appears in the feed.
74
75
  - `url`: URL of episode audio file.
75
76
  - `duration`: Provided `mm:ss` duration (if found).
76
77
  - `podcast_title`: Title of the podcast feed.
package/bin/async.js CHANGED
@@ -49,7 +49,7 @@ const download = async ({
49
49
  }
50
50
 
51
51
  const headResponse = await got(url, {
52
- timeout: 5000,
52
+ timeout: 30000,
53
53
  method: "HEAD",
54
54
  responseType: "json",
55
55
  headers: {
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.0")
7
+ .version("8.0.2")
8
8
  .option("--url <string>", "url to podcast rss feed")
9
9
  .option(
10
10
  "--out-dir <path>",
package/bin/naming.js CHANGED
@@ -12,6 +12,7 @@ const getSafeName = (name) => {
12
12
  };
13
13
 
14
14
  const getFilename = ({ item, ext, url, feed, template }) => {
15
+ const episodeNum = feed.items.length - item._originalIndex;
15
16
  const formattedPubDate = item.pubDate
16
17
  ? dayjs(new Date(item.pubDate)).format("YYYYMMDD")
17
18
  : null;
@@ -19,6 +20,7 @@ const getFilename = ({ item, ext, url, feed, template }) => {
19
20
  const templateReplacementsTuples = [
20
21
  ["title", item.title || ""],
21
22
  ["release_date", formattedPubDate || ""],
23
+ ["episode_num", episodeNum],
22
24
  ["url", url],
23
25
  ["podcast_title", feed.title || ""],
24
26
  ["podcast_link", feed.link || ""],
package/bin/util.js CHANGED
@@ -18,10 +18,10 @@ const getArchiveKey = ({ prefix, name }) => {
18
18
  return `${prefix}-${name}`;
19
19
  };
20
20
 
21
- const getPublicObject = (object) => {
21
+ const getPublicObject = (object, exclude = []) => {
22
22
  const output = {};
23
23
  Object.keys(object).forEach((key) => {
24
- if (!key.startsWith("_") && object[key]) {
24
+ if (!key.startsWith("_") && !exclude.includes(key) && object[key]) {
25
25
  output[key] = object[key];
26
26
  }
27
27
  });
@@ -260,7 +260,7 @@ const writeFeedMeta = ({ outputPath, feed, key, archive, override }) => {
260
260
  logMessage("Feed metadata exists in archive. Skipping...");
261
261
  return;
262
262
  }
263
- const output = getPublicObject(feed);
263
+ const output = getPublicObject(feed, ["items"]);
264
264
 
265
265
  try {
266
266
  if (override || !fs.existsSync(outputPath)) {
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "8.0.0",
3
+ "version": "8.0.2",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",
7
7
  "scripts": {
8
8
  "build": "rimraf ./binaries && npx webpack && npm run pkg",
9
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",
11
- "release": "standard-version"
10
+ "pkg": "npx pkg ./dist/podcast-dl.js --targets node14-linux-x64,node14-win-x64,node14-macos-x64 --out-path ./binaries"
12
11
  },
13
12
  "lint-staged": {
14
13
  "*.{js,json,md}": [
@@ -46,7 +45,6 @@
46
45
  "lint-staged": "^10.1.7",
47
46
  "prettier": "2.3.2",
48
47
  "rimraf": "^3.0.2",
49
- "standard-version": "^9.0.0",
50
48
  "webpack-cli": "^5.0.1"
51
49
  },
52
50
  "dependencies": {