Skip to content

Commit

Permalink
Added video db check to avoid episodeNo creep if a video already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Inrixia committed Apr 5, 2022
1 parent d3582b2 commit 740d159
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/lib/Channel.ts
Expand Up @@ -92,7 +92,13 @@ export default class Channel {
if (this.daysToKeepVideos !== -1 && releaseDate < this.ignoreBeforeTimestamp) return null;

// Set db info, have to instigate the db first before setting filepath
this._db.videos[video.guid] ??= { episodeNo: this._db.nextEpisodeNo++, releaseDate, filePath: '' };
if (this._db.videos[video.guid] === undefined) {
this._db.videos[video.guid] ??= {
episodeNo: this._db.nextEpisodeNo++,
releaseDate,
filePath: '',
};
}
const videoInstance = new Video(video, this);
this._db.videos[video.guid].filePath = videoInstance.filePath;

Expand Down

0 comments on commit 740d159

Please sign in to comment.