improve tmp file cleanup
If youtubeDl fails, remove the tmp file. Here tmp is the html file downloaded to check if the url is html, not what youtube-dl might have started to download. If the tmp file were retained, a re-run of addurl would try to resume downloading it, which the web server might not support, causing the resume to fail. And it's a smallish html page anyway so no benefit to keeping it for such a resume.
This commit is contained in:
parent
181e9019d3
commit
79ac177ea5
1 changed files with 4 additions and 2 deletions
|
@ -283,18 +283,20 @@ downloadWeb o url urlinfo file =
|
|||
(dl dest)
|
||||
Left _ -> normalfinish tmp
|
||||
where
|
||||
dl dest = withTmpWorkDir mediakey $ \workdir ->
|
||||
dl dest = withTmpWorkDir mediakey $ \workdir -> do
|
||||
let cleanuptmp = pruneTmpWorkDirBefore tmp (liftIO . nukeFile)
|
||||
Transfer.notifyTransfer Transfer.Download url $
|
||||
Transfer.download webUUID mediakey (AssociatedFile Nothing) Transfer.noRetry $ \_p ->
|
||||
youtubeDl url workdir >>= \case
|
||||
Right (Just mediafile) -> do
|
||||
pruneTmpWorkDirBefore tmp (liftIO . nukeFile)
|
||||
cleanuptmp
|
||||
checkCanAdd dest $ do
|
||||
showDestinationFile dest
|
||||
addWorkTree webUUID mediaurl dest mediakey (Just mediafile)
|
||||
return $ Just mediakey
|
||||
Right Nothing -> normalfinish tmp
|
||||
Left msg -> do
|
||||
cleanuptmp
|
||||
warning msg
|
||||
return Nothing
|
||||
mediaurl = setDownloader url YoutubeDownloader
|
||||
|
|
Loading…
Reference in a new issue