From 740d159d73b4e7462a36bed739d5fcd3584ec32b Mon Sep 17 00:00:00 2001 From: Inrix Date: Wed, 6 Apr 2022 11:42:17 +1200 Subject: [PATCH] Added video db check to avoid episodeNo creep if a video already exists --- src/lib/Channel.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/lib/Channel.ts b/src/lib/Channel.ts index b9d6d69..13abcf4 100644 --- a/src/lib/Channel.ts +++ b/src/lib/Channel.ts @@ -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;