display destination file before youtube-dl download
Rather than after it, which can leave one wondering what file it's downloading. youtubeDl should not ever return Right Nothing in normal operation, becaause it's already asked youtube-dl if it supports the url. So it would have to succeed at that, then not download any file, but also exit successfully, in order for the new error message to display. Also display the name of yt-dlp when using it.
This commit is contained in:
parent
f811468318
commit
72715845a1
2 changed files with 19 additions and 11 deletions
|
@ -353,21 +353,25 @@ downloadWeb addunlockedmatcher o url urlinfo file =
|
|||
where
|
||||
dl dest = withTmpWorkDir mediakey $ \workdir -> do
|
||||
let cleanuptmp = pruneTmpWorkDirBefore tmp (liftIO . removeWhenExistsWith R.removeLink)
|
||||
showNote "using youtube-dl"
|
||||
dlcmd <- youtubeDlCommand
|
||||
showNote ("using " <> UnquotedString dlcmd)
|
||||
Transfer.notifyTransfer Transfer.Download url $
|
||||
Transfer.download' webUUID mediakey (AssociatedFile Nothing) Nothing Transfer.noRetry $ \p ->
|
||||
Transfer.download' webUUID mediakey (AssociatedFile Nothing) Nothing Transfer.noRetry $ \p -> do
|
||||
showDestinationFile dest
|
||||
youtubeDl url (fromRawFilePath workdir) p >>= \case
|
||||
Right (Just mediafile) -> do
|
||||
cleanuptmp
|
||||
checkCanAdd o dest $ \canadd -> do
|
||||
showDestinationFile dest
|
||||
addWorkTree canadd addunlockedmatcher webUUID mediaurl dest mediakey (Just (toRawFilePath mediafile))
|
||||
return $ Just mediakey
|
||||
Right Nothing -> checkRaw Nothing o (pure Nothing) (normalfinish tmp backend)
|
||||
Left msg -> do
|
||||
cleanuptmp
|
||||
warning (UnquotedString msg)
|
||||
return Nothing
|
||||
Right Nothing -> do
|
||||
cleanuptmp
|
||||
warning (UnquotedString dlcmd <> " did not download anything")
|
||||
return Nothing
|
||||
mediaurl = setDownloader url YoutubeDownloader
|
||||
mediakey = Backend.URL.fromUrl mediaurl Nothing
|
||||
-- Does the already annexed file have the mediaurl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue