podcast-dl 10.0.0 → 10.2.0

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
@@ -82,6 +82,9 @@ Options that support templates allow users to specify a template for the generat
82
82
 
83
83
  - `title`: The title of the episode.
84
84
  - `release_date`: The release date of the episode in `YYYYMMDD` format.
85
+ - `release_year`: The release year (`YYYY`) of the episode.
86
+ - `release_month`: The release month (`MM`) of the episode.
87
+ - `release_day`: The release day (`DD`) of the episode.
85
88
  - `episode_num`: The location number of where the episodes appears in the feed.
86
89
  - `url`: URL of episode audio file.
87
90
  - `duration`: Provided `mm:ss` duration (if found).
package/bin/naming.js CHANGED
@@ -30,7 +30,20 @@ const getItemFilename = ({
30
30
  }) => {
31
31
  const episodeNum = feed.items.length - item._originalIndex + offset;
32
32
  const title = item.title || "";
33
- const formattedPubDate = item.pubDate
33
+
34
+ const releaseYear = item.pubDate
35
+ ? dayjs(new Date(item.pubDate)).format("YYYY")
36
+ : null;
37
+
38
+ const releaseMonth = item.pubDate
39
+ ? dayjs(new Date(item.pubDate)).format("MM")
40
+ : null;
41
+
42
+ const releaseDay = item.pubDate
43
+ ? dayjs(new Date(item.pubDate)).format("DD")
44
+ : null;
45
+
46
+ const releaseDate = item.pubDate
34
47
  ? dayjs(new Date(item.pubDate)).format("YYYYMMDD")
35
48
  : null;
36
49
 
@@ -43,7 +56,10 @@ const getItemFilename = ({
43
56
 
44
57
  const templateReplacementsTuples = [
45
58
  ["title", title],
46
- ["release_date", formattedPubDate || ""],
59
+ ["release_date", releaseDate || ""],
60
+ ["release_year", releaseYear || ""],
61
+ ["release_month", releaseMonth || ""],
62
+ ["release_day", releaseDay || ""],
47
63
  ["episode_num", `${episodeNum}`.padStart(width, "0")],
48
64
  ["url", url],
49
65
  ["podcast_title", feed.title || ""],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "10.0.0",
3
+ "version": "10.2.0",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",