Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to NOT check file existence? #26594

Closed
CrendKing opened this issue Sep 15, 2020 · 4 comments
Closed

Option to NOT check file existence? #26594

CrendKing opened this issue Sep 15, 2020 · 4 comments
Labels

Comments

@CrendKing
Copy link

@CrendKing CrendKing commented Sep 15, 2020

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

Is there a way to tell youtube-dl NOT to check file existence and always tries to download? My scenario is this. I setup youtube-dl so that

  • the output format is just C:/%(title)s.%(ext)s, which is convenient but prone to duplicate.
  • uses aria2c as external downloader. For aria2c, I enable the "auto-file-renaming" feature, so that if file exists it automatically rename it.

To test, I create an empty file test.mp4 (imagine it as a completely unrelated video). Then invoke youtube-dl to download a video titled "test" (not Youtube). Here's output:

[debug] System config: []
[debug] User config: []
[debug] Custom config: ['--external-downloader', 'aria2c', '--external-downloader-args', '--conf-path=C:/aria2/aria2.conf', '--output', 'C:/%(title)s.%(ext)s', '-v']
[debug] Command-line args: ['--config-location', 'C:\\youtube-dl\\ydl.conf', 'https://www.test.com/test/']
[debug] Encodings: locale cp65001, fs utf-8, out utf-8, pref cp65001
[debug] youtube-dl version 2020.09.14
[debug] Python version 3.8.5 (CPython) - Windows-10-10.0.19041-SP0
[debug] exe versions: ffmpeg git-2020-08-31-4a11a6f, ffprobe git-2020-08-31-4a11a6f
[debug] Proxy map: {}
[generic] test-mp4: Requesting header
WARNING: Falling back on generic information extractor.
[generic] test-mp4: Downloading webpage
[generic] test-mp4: Extracting information
[download] Downloading playlist: test.mp4
[generic] playlist test.mp4: Collected 1 video ids (downloading 1 of them)
[download] Downloading video 1 of 1
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on 'https://www.test.com/video/test.mp4'
[download] C:\test.mp4 has already been downloaded
[download] 100% of 0.00B
[download] Finished downloading playlist: test.mp4

It seems youtube-dl checked the file existence by itself and never sent a request to aria2c. I see the "--no-overwrites" option, but I think what I need is the opposite of it. "--continue" also doesn't help. I know adding something like %(epoch)s to the template will break the duplicate, but I don't want random number in the filename.

Reading the code at https://github.com/ytdl-org/youtube-dl/blob/master/youtube_dl/downloader/common.py#L348, I don't see any way to change the behavior. Or am I missing anything? Thanks.

@CrendKing CrendKing added the question label Sep 15, 2020
@pukkandan
Copy link

@pukkandan pukkandan commented Sep 15, 2020

Doesn't --no-continue do this?

@CrendKing
Copy link
Author

@CrendKing CrendKing commented Sep 15, 2020

It's one step closer. However, youtube-dl always adds -c to the arguments, which defeats the purpose of --no-continue. If I remove -c locally, I get the exact behavior I need. So I suggest changing the beginning of Aria2cFD._make_cmd() to something like

        cmd = [self.exe]
        if self.params.get('continuedl', True):
            cmd += ['-c']
@reallyuniquename
Copy link

@reallyuniquename reallyuniquename commented Sep 16, 2020

A bug with internal handler for aria2c then? It's better to rename this issue.

@CrendKing
Copy link
Author

@CrendKing CrendKing commented Sep 16, 2020

I created PR #26607 . I'll close this.

@CrendKing CrendKing closed this Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.