podcast-dl 10.2.0 → 10.3.1
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 +1 -0
- package/bin/async.js +4 -3
- package/bin/bin.js +13 -6
- package/bin/util.js +7 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,7 @@ If no match is found, the `custom_<n>` keyword will be replaced with an empty st
|
|
|
104
104
|
- `episode_path_base`: The path to the folder of the downloaded episode.
|
|
105
105
|
- `episode_filename`: The filename of the episode.
|
|
106
106
|
- `episode_filename_base`: The filename of the episode without its extension.
|
|
107
|
+
- `url`: URL of episode audio file.
|
|
107
108
|
|
|
108
109
|
## Log Levels
|
|
109
110
|
|
package/bin/async.js
CHANGED
|
@@ -159,7 +159,7 @@ const download = async (options) => {
|
|
|
159
159
|
const downloadItemsAsync = async ({
|
|
160
160
|
addMp3MetadataFlag,
|
|
161
161
|
archive,
|
|
162
|
-
|
|
162
|
+
archivePrefix,
|
|
163
163
|
attempts,
|
|
164
164
|
basePath,
|
|
165
165
|
bitrate,
|
|
@@ -215,7 +215,7 @@ const downloadItemsAsync = async ({
|
|
|
215
215
|
alwaysPostprocess,
|
|
216
216
|
marker,
|
|
217
217
|
key: getArchiveKey({
|
|
218
|
-
prefix:
|
|
218
|
+
prefix: archivePrefix,
|
|
219
219
|
name: getArchiveFilename({
|
|
220
220
|
name: item.title,
|
|
221
221
|
pubDate: item.pubDate,
|
|
@@ -247,6 +247,7 @@ const downloadItemsAsync = async ({
|
|
|
247
247
|
basePath,
|
|
248
248
|
outputPodcastPath,
|
|
249
249
|
episodeFilename,
|
|
250
|
+
episodeAudioUrl,
|
|
250
251
|
});
|
|
251
252
|
}
|
|
252
253
|
|
|
@@ -299,7 +300,7 @@ const downloadItemsAsync = async ({
|
|
|
299
300
|
override,
|
|
300
301
|
item,
|
|
301
302
|
key: getArchiveKey({
|
|
302
|
-
prefix:
|
|
303
|
+
prefix: archivePrefix,
|
|
303
304
|
name: getArchiveFilename({
|
|
304
305
|
pubDate: item.pubDate,
|
|
305
306
|
name: item.title,
|
package/bin/bin.js
CHANGED
|
@@ -84,8 +84,15 @@ const main = async () => {
|
|
|
84
84
|
? await getUrlFeed(url, parserConfig)
|
|
85
85
|
: await getFileFeed(file, parserConfig);
|
|
86
86
|
|
|
87
|
-
const
|
|
88
|
-
|
|
87
|
+
const archivePrefix = (() => {
|
|
88
|
+
if (feed.feedUrl || url) {
|
|
89
|
+
const { hostname, pathname } = new URL(feed.feedUrl || url);
|
|
90
|
+
return `${hostname}${pathname}`;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return feed.title || file;
|
|
94
|
+
})();
|
|
95
|
+
|
|
89
96
|
const basePath = _path.resolve(
|
|
90
97
|
process.cwd(),
|
|
91
98
|
getFolderName({ feed, template: outDir })
|
|
@@ -152,7 +159,7 @@ const main = async () => {
|
|
|
152
159
|
override,
|
|
153
160
|
marker: podcastImageUrl,
|
|
154
161
|
key: getArchiveKey({
|
|
155
|
-
prefix:
|
|
162
|
+
prefix: archivePrefix,
|
|
156
163
|
name: `${
|
|
157
164
|
feed.title ? `${feed.title}.image` : "image"
|
|
158
165
|
}${podcastImageFileExt}`,
|
|
@@ -181,7 +188,7 @@ const main = async () => {
|
|
|
181
188
|
override,
|
|
182
189
|
feed,
|
|
183
190
|
key: getArchiveKey({
|
|
184
|
-
prefix:
|
|
191
|
+
prefix: archivePrefix,
|
|
185
192
|
name: `${feed.title ? `${feed.title}.meta` : "meta"}.json`,
|
|
186
193
|
}),
|
|
187
194
|
outputPath: outputMetaPath,
|
|
@@ -201,7 +208,7 @@ const main = async () => {
|
|
|
201
208
|
|
|
202
209
|
const targetItems = getItemsToDownload({
|
|
203
210
|
archive,
|
|
204
|
-
|
|
211
|
+
archivePrefix,
|
|
205
212
|
basePath,
|
|
206
213
|
feed,
|
|
207
214
|
limit,
|
|
@@ -231,7 +238,7 @@ const main = async () => {
|
|
|
231
238
|
const { numEpisodesDownloaded, hasErrors } = await downloadItemsAsync({
|
|
232
239
|
addMp3MetadataFlag,
|
|
233
240
|
archive,
|
|
234
|
-
|
|
241
|
+
archivePrefix,
|
|
235
242
|
attempts,
|
|
236
243
|
basePath,
|
|
237
244
|
bitrate,
|
package/bin/util.js
CHANGED
|
@@ -152,7 +152,7 @@ const getLoopControls = ({ offset, length, reverse }) => {
|
|
|
152
152
|
|
|
153
153
|
const getItemsToDownload = ({
|
|
154
154
|
archive,
|
|
155
|
-
|
|
155
|
+
archivePrefix,
|
|
156
156
|
basePath,
|
|
157
157
|
feed,
|
|
158
158
|
limit,
|
|
@@ -216,7 +216,7 @@ const getItemsToDownload = ({
|
|
|
216
216
|
const { url: episodeAudioUrl, ext: audioFileExt } =
|
|
217
217
|
getEpisodeAudioUrlAndExt(feed.items[i], episodeSourceOrder);
|
|
218
218
|
const key = getArchiveKey({
|
|
219
|
-
prefix:
|
|
219
|
+
prefix: archivePrefix,
|
|
220
220
|
name: getArchiveFilename({
|
|
221
221
|
pubDate,
|
|
222
222
|
name: title,
|
|
@@ -239,7 +239,7 @@ const getItemsToDownload = ({
|
|
|
239
239
|
if (episodeImageUrl) {
|
|
240
240
|
const episodeImageFileExt = getUrlExt(episodeImageUrl);
|
|
241
241
|
const episodeImageArchiveKey = getArchiveKey({
|
|
242
|
-
prefix:
|
|
242
|
+
prefix: archivePrefix,
|
|
243
243
|
name: getArchiveFilename({
|
|
244
244
|
pubDate,
|
|
245
245
|
name: title,
|
|
@@ -276,7 +276,7 @@ const getItemsToDownload = ({
|
|
|
276
276
|
if (episodeTranscriptUrl) {
|
|
277
277
|
const episodeTranscriptFileExt = getUrlExt(episodeTranscriptUrl);
|
|
278
278
|
const episodeTranscriptArchiveKey = getArchiveKey({
|
|
279
|
-
prefix:
|
|
279
|
+
prefix: archivePrefix,
|
|
280
280
|
name: getArchiveFilename({
|
|
281
281
|
pubDate,
|
|
282
282
|
name: title,
|
|
@@ -689,6 +689,7 @@ const runExec = async ({
|
|
|
689
689
|
basePath,
|
|
690
690
|
outputPodcastPath,
|
|
691
691
|
episodeFilename,
|
|
692
|
+
episodeAudioUrl,
|
|
692
693
|
}) => {
|
|
693
694
|
const episodeFilenameBase = episodeFilename.substring(
|
|
694
695
|
0,
|
|
@@ -699,7 +700,8 @@ const runExec = async ({
|
|
|
699
700
|
.replace(/{{episode_path}}/g, `"${outputPodcastPath}"`)
|
|
700
701
|
.replace(/{{episode_path_base}}/g, `"${basePath}"`)
|
|
701
702
|
.replace(/{{episode_filename}}/g, `"${episodeFilename}"`)
|
|
702
|
-
.replace(/{{episode_filename_base}}/g, `"${episodeFilenameBase}"`)
|
|
703
|
+
.replace(/{{episode_filename_base}}/g, `"${episodeFilenameBase}"`)
|
|
704
|
+
.replace(/{{url}}/g, `"${episodeAudioUrl}"`);
|
|
703
705
|
|
|
704
706
|
await execWithPromise(execCmd, { stdio: "ignore" });
|
|
705
707
|
};
|