tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

Option to download file parts into a temporary directory for combination

Open dgomer opened this issue 3 years ago • 4 comments

When downloading files into a directory that's actively being monitored by a media server (I'm experiencing this with Jellyfin but I've seen this behavior with Plex as well), sometimes the media server will attempt to start indexing files before the video/audio combination has happened, which leads to the part files being locked so that they can't be renamed or deleted. This makes the downloader fail to finish the download even though it was actually successful - you usually end up with an audio.mkv, video.mkv, and combined.temp.mkv file.

If the audio and video file parts could be downloaded and combined in a temporary directory, and then moved into the monitored directory, this would no longer be a problem.

dgomer avatar Feb 15 '22 12:02 dgomer

Nice suggestion, thanks. I'll see if you can easily get yt-dlp to download to a temp directory before merging streams.

meeb avatar Feb 15 '22 13:02 meeb

I believe if you use the paths argument for yt-dlp you can set a temp: location for the intermediate files.

https://github.com/yt-dlp/yt-dlp/blob/master/yt_dlp/YoutubeDL.py#L244-L245

dgomer avatar Feb 15 '22 13:02 dgomer

Yes I had noticed that, I need to confirm that I can still specify an absolute output path along with just a temp entry for that config option works as expected. If it does I'll add this into the next release.

meeb avatar Feb 15 '22 13:02 meeb

Fantastic! Thank you so much for looking into this :)

dgomer avatar Feb 15 '22 13:02 dgomer