Improve resuming interrupted download when using yt-dlp or youtube-dl
Fixes a failure like this: curl: (33) HTTP server doesn't seem to support byte ranges. Cannot resume. That happens because the whole web page has already been downloaded previously, and kept, so now addurl tries to download it, and curl asks the server to resume from the last byte. And youtube.com can't, for whatever stupid reason. So, delete the temp file after determining that youtube-dl can be used.
This commit is contained in:
parent
a36a81dea3
commit
958c2fa6d2
2 changed files with 4 additions and 3 deletions
|
@ -93,7 +93,7 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
|
|||
* Fix display when run with -J1.
|
||||
* assistant: Fix a crash when a small file is deleted immediately after
|
||||
being created.
|
||||
* Improve resuming interrupted download when using yt-dlp.
|
||||
* Improve resuming interrupted download when using yt-dlp or youtube-dl.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Sat, 08 Apr 2023 13:57:18 -0400
|
||||
|
||||
|
|
|
@ -343,9 +343,10 @@ downloadWeb addunlockedmatcher o url urlinfo file =
|
|||
-- Ask youtube-dl what filename it will download first,
|
||||
-- so it's only used when the file contains embedded media.
|
||||
tryyoutubedl tmp backend = youtubeDlFileNameHtmlOnly url >>= \case
|
||||
Right mediafile ->
|
||||
Right mediafile -> do
|
||||
liftIO $ liftIO $ removeWhenExistsWith R.removeLink tmp
|
||||
let f = youtubeDlDestFile o file (toRawFilePath mediafile)
|
||||
in lookupKey f >>= \case
|
||||
lookupKey f >>= \case
|
||||
Just k -> alreadyannexed f k
|
||||
Nothing -> dl f
|
||||
Left err -> checkRaw (Just err) o (pure Nothing) (normalfinish tmp backend)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue