Skip existing files can skip duplicate-title videos in the same batch
Version
prime branch / latest
Platform
Any
Steps to reproduce
- Turn on
Skip existing files - Queue a batch where two selected videos would save with the same filename
- easiest case is two videos with the same title while using the default
$titlefilename template
- easiest case is two videos with the same title while using the default
- Pick the download folder and confirm
Details
I think there is a small edge case in the way the app reserves filenames.
If Skip existing files is off, the app does the right thing and gives the second file a unique name, like:
Title.mp4
Title (1).mp4But if Skip existing files is on, the second video can be skipped instead.
The reason seems to be that the first video creates a zero-byte placeholder file to reserve Title.mp4. Then, when the second video is checked, this line sees that placeholder and treats it like a real existing file:
if (settingsService.ShouldSkipExistingFiles && File.Exists(baseFilePath))
continue;At that point the app never gets to EnsureUniqueFilePath(...), so it does not try Title (1).mp4.
I think the skip check needs to ignore files that were only created as reservations during the current batch, or otherwise check for existing files before the batch starts.
Source: Tyrrrz/YoutubeDownloader