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

Fix #4521: If os.path.getsize throws FileNotFoundError, set the retry to resume from 0. #8399

Merged
merged 1 commit into from Mar 10, 2024

Conversation

boredzo
Copy link
Contributor

@boredzo boredzo commented Oct 21, 2023

IMPORTANT: PRs without the template will be CLOSED

Description of your pull request and other information

As of 2023.10.13 and master@4e38e2ae9d7380015349e6aee59c78bb3938befd, when yt-dlp encounters an incomplete read while downloading a WebVTT stream, it may not have created the file for that fragment yet, in which case its attempt to set the resume length on the retry (to the file's length) fails with FileNotFoundError.

This patch catches FileNotFoundError and sets the resume length to 0 in that case.

Fixes #4521.

Template

Before submitting a pull request make sure you have:

In order to be accepted and merged into yt-dlp each piece of code must be in public domain or released under Unlicense. Check all of the following options that apply:

  • I am the original author of this code and I am willing to release it under Unlicense
  • I am not the original author of this code but it is in public domain or released under Unlicense (provide reliable evidence)

What is the purpose of your pull request?

Copilot Summary

🤖 Generated by Copilot at 0d37aa9

Summary

🔄🗑️🐛

Handle missing temporary file when resuming download in yt_dlp/downloader/http.py. Set resume length to zero instead of raising an error.

tempfile missing
resume length becomes zero
autumn leaves falling

Walkthrough

  • Handle missing temporary file when resuming download (link)

@bashonly bashonly added the bug Bug that is not site-specific label Oct 21, 2023
@bashonly bashonly self-requested a review October 21, 2023 13:54
@boredzo
Copy link
Contributor Author

boredzo commented Oct 21, 2023

I got no test failures on PlutoTV or RoosterTeeth, but did see test failures under test_subtitles. However, they also occur on master, so they're not related to my changes.

@pukkandan
Copy link
Member

when yt-dlp encounters an incomplete read while downloading a WebVTT stream, it may not have created the file for that fragment yet

This sounds like there is a bigger underlying problem, but I suppose your patch work well enough for now. Could you add a comment to the code?

@memmam
Copy link

memmam commented Mar 9, 2024

Hey, what's the status on this being merged in?

@bashonly bashonly merged commit 2d91b98 into yt-dlp:master Mar 10, 2024
17 checks passed
aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this pull request Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific
Projects
None yet
4 participants