Skip to content

Commit

Permalink
fix: infinite error after unable to find episode URL
Browse files Browse the repository at this point in the history
  • Loading branch information
lightpohl committed May 10, 2020
1 parent 1e5bcb0 commit 43817d6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions bin/bin.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,26 @@ let main = async () => {

let i = startIndex;
let counter = 1;
let nextItem = () => {
i = next(i);
counter += 1;
console.log("");
};

while (limitCheck(i)) {
let item = feed.items[i];

console.log(`${counter} of ${numItemsToDownload}`);
logItemInfo(item);

let episodeAudioUrl = getEpisodeAudioUrl(item);

if (!episodeAudioUrl) {
logError("Unable to find episode download URL. Skipping");
nextItem();
continue;
}

console.log(`${counter} of ${numItemsToDownload}`);
logItemInfo(item);

let baseSafeFilename = getEpisodeFilename(item);
let audioFileExt = getUrlExt(episodeAudioUrl);
let episodeName = `${baseSafeFilename}${audioFileExt}`;
Expand Down Expand Up @@ -234,9 +241,7 @@ let main = async () => {
});
}

console.log("");
counter += 1;
i = next(i);
nextItem();
}
};

Expand Down

0 comments on commit 43817d6

Please sign in to comment.