podcast-dl 7.2.0 → 7.3.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/bin/async.js CHANGED
@@ -125,14 +125,6 @@ const download = async ({
125
125
 
126
126
  fs.renameSync(tempOutputPath, outputPath);
127
127
 
128
- if (expectedSize && !isNaN(expectedSize) && expectedSize !== fileSize) {
129
- logMessage(
130
- "File size differs from expected content length. Suggestion: verify file works as expected",
131
- LOG_LEVELS.important
132
- );
133
- logMessage(`${outputPath}`, LOG_LEVELS.important);
134
- }
135
-
136
128
  logMessage("Download complete!");
137
129
 
138
130
  if (onAfterDownload) {
package/bin/bin.js CHANGED
@@ -293,6 +293,24 @@ const main = async () => {
293
293
  filterUrlTracking,
294
294
  });
295
295
 
296
+ if (hasErrors && numEpisodesDownloaded !== targetItems.length) {
297
+ logMessage(
298
+ `\n${numEpisodesDownloaded} of ${pluralize(
299
+ "episode",
300
+ targetItems.length,
301
+ true
302
+ )} downloaded\n`
303
+ );
304
+ } else {
305
+ logMessage(
306
+ `\nSuccessfully downloaded ${pluralize(
307
+ "episode",
308
+ numEpisodesDownloaded,
309
+ true
310
+ )}\n`
311
+ );
312
+ }
313
+
296
314
  if (numEpisodesDownloaded === 0) {
297
315
  process.exit(ERROR_STATUSES.nothingDownloaded);
298
316
  }
package/bin/util.js CHANGED
@@ -299,28 +299,18 @@ const writeFeedMeta = ({ outputPath, feed, key, archive, override }) => {
299
299
  return;
300
300
  }
301
301
 
302
- const title = feed.title || null;
303
- const description = feed.description || null;
304
- const link = feed.link || null;
305
- const feedUrl = feed.feedUrl || null;
306
- const managingEditor = feed.managingEditor || null;
302
+ const output = {};
303
+ ["title", "description", "link", "feedUrl", "managingEditor"].forEach(
304
+ (key) => {
305
+ if (feed[key]) {
306
+ output[key] = feed[key];
307
+ }
308
+ }
309
+ );
307
310
 
308
311
  try {
309
312
  if (override || !fs.existsSync(outputPath)) {
310
- fs.writeFileSync(
311
- outputPath,
312
- JSON.stringify(
313
- {
314
- title,
315
- description,
316
- link,
317
- feedUrl,
318
- managingEditor,
319
- },
320
- null,
321
- 4
322
- )
323
- );
313
+ fs.writeFileSync(outputPath, JSON.stringify(output, null, 4));
324
314
  } else {
325
315
  logMessage("Feed metadata exists locally. Skipping write...");
326
316
  }
@@ -354,26 +344,16 @@ const writeItemMeta = ({
354
344
  return;
355
345
  }
356
346
 
357
- const title = item.title || null;
358
- const descriptionText = item.contentSnippet || null;
359
- const pubDate = item.pubDate || null;
360
- const creator = item.creator || null;
347
+ const output = {};
348
+ ["title", "contentSnippet", "pubDate", "creator"].forEach((key) => {
349
+ if (item[key]) {
350
+ output[key] = item[key];
351
+ }
352
+ });
361
353
 
362
354
  try {
363
355
  if (override || !fs.existsSync(outputPath)) {
364
- fs.writeFileSync(
365
- outputPath,
366
- JSON.stringify(
367
- {
368
- title,
369
- pubDate,
370
- creator,
371
- descriptionText,
372
- },
373
- null,
374
- 4
375
- )
376
- );
356
+ fs.writeFileSync(outputPath, JSON.stringify(output, null, 4));
377
357
  } else {
378
358
  logMessage(
379
359
  `${marker} | Episode metadata exists locally. Skipping write...`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "podcast-dl",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
4
4
  "description": "A CLI for downloading podcasts.",
5
5
  "type": "module",
6
6
  "bin": "./bin/bin.js",