importfeed: Display url before starting youtube-dl download
It was displaying a blank line before.
This commit is contained in:
parent
8c756d5a27
commit
31be0770a5
2 changed files with 46 additions and 33 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
git-annex (8.20211118) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* importfeed: Display url before starting youtube-dl download.
|
||||||
|
|
||||||
|
-- Joey Hess <id@joeyh.name> Wed, 17 Nov 2021 13:18:44 -0400
|
||||||
|
|
||||||
git-annex (8.20211117) upstream; urgency=medium
|
git-annex (8.20211117) upstream; urgency=medium
|
||||||
|
|
||||||
* filter-process: New command that can make git add/checkout faster when
|
* filter-process: New command that can make git add/checkout faster when
|
||||||
|
|
|
@ -184,8 +184,12 @@ downloadFeed url f
|
||||||
Url.download nullMeterUpdate Nothing url f
|
Url.download nullMeterUpdate Nothing url f
|
||||||
|
|
||||||
performDownload :: AddUnlockedMatcher -> ImportFeedOptions -> Cache -> ToDownload -> Annex Bool
|
performDownload :: AddUnlockedMatcher -> ImportFeedOptions -> Cache -> ToDownload -> Annex Bool
|
||||||
performDownload addunlockedmatcher opts cache todownload = case location todownload of
|
performDownload = performDownload' False
|
||||||
Enclosure url -> checkknown url $
|
|
||||||
|
performDownload' :: Bool -> AddUnlockedMatcher -> ImportFeedOptions -> Cache -> ToDownload -> Annex Bool
|
||||||
|
performDownload' started addunlockedmatcher opts cache todownload = case location todownload of
|
||||||
|
Enclosure url -> checkknown url $ do
|
||||||
|
starturl url
|
||||||
rundownload url (takeWhile (/= '?') $ takeExtension url) $ \f -> do
|
rundownload url (takeWhile (/= '?') $ takeExtension url) $ \f -> do
|
||||||
let f' = fromRawFilePath f
|
let f' = fromRawFilePath f
|
||||||
r <- Remote.claimingUrl url
|
r <- Remote.claimingUrl url
|
||||||
|
@ -256,9 +260,7 @@ performDownload addunlockedmatcher opts cache todownload = case location todownl
|
||||||
feedFile (template cache) todownload extension
|
feedFile (template cache) todownload extension
|
||||||
case dest of
|
case dest of
|
||||||
Nothing -> return True
|
Nothing -> return True
|
||||||
Just f -> do
|
Just f -> getter (toRawFilePath f) >>= \case
|
||||||
showStartOther "addurl" (Just url) (SeekInput [])
|
|
||||||
getter (toRawFilePath f) >>= \case
|
|
||||||
Just ks
|
Just ks
|
||||||
-- Download problem.
|
-- Download problem.
|
||||||
| null ks -> do
|
| null ks -> do
|
||||||
|
@ -272,9 +274,8 @@ performDownload addunlockedmatcher opts cache todownload = case location todownl
|
||||||
)
|
)
|
||||||
showEndOk
|
showEndOk
|
||||||
return True
|
return True
|
||||||
-- Was not able to add anything,
|
-- Was not able to add anything, but not
|
||||||
-- but not because of a download
|
-- because of a download problem.
|
||||||
-- problem.
|
|
||||||
Nothing -> do
|
Nothing -> do
|
||||||
showEndFail
|
showEndFail
|
||||||
return False
|
return False
|
||||||
|
@ -305,9 +306,10 @@ performDownload addunlockedmatcher opts cache todownload = case location todownl
|
||||||
)
|
)
|
||||||
|
|
||||||
downloadmedia linkurl mediaurl mediakey
|
downloadmedia linkurl mediaurl mediakey
|
||||||
| rawOption (downloadOptions opts) = downloadlink
|
| rawOption (downloadOptions opts) = downloadlink False
|
||||||
| otherwise = ifM (youtubeDlSupported linkurl)
|
| otherwise = ifM (youtubeDlSupported linkurl)
|
||||||
( do
|
( do
|
||||||
|
starturl linkurl
|
||||||
r <- withTmpWorkDir mediakey $ \workdir -> do
|
r <- withTmpWorkDir mediakey $ \workdir -> do
|
||||||
dl <- youtubeDl linkurl (fromRawFilePath workdir) nullMeterUpdate
|
dl <- youtubeDl linkurl (fromRawFilePath workdir) nullMeterUpdate
|
||||||
case dl of
|
case dl of
|
||||||
|
@ -323,29 +325,34 @@ performDownload addunlockedmatcher opts cache todownload = case location todownl
|
||||||
-- youtube-dl didn't support it, so
|
-- youtube-dl didn't support it, so
|
||||||
-- download it as if the link were
|
-- download it as if the link were
|
||||||
-- an enclosure.
|
-- an enclosure.
|
||||||
Right Nothing -> Just <$> downloadlink
|
Right Nothing -> Just <$> downloadlink True
|
||||||
Left msg -> do
|
Left msg -> do
|
||||||
warning $ linkurl ++ ": " ++ msg
|
warning $ linkurl ++ ": " ++ msg
|
||||||
return Nothing
|
return Nothing
|
||||||
return (fromMaybe False r)
|
return (fromMaybe False r)
|
||||||
, downloadlink
|
, downloadlink False
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
downloadlink = checkRaw Nothing (downloadOptions opts) $
|
downloadlink started' = checkRaw Nothing (downloadOptions opts) $
|
||||||
performDownload addunlockedmatcher opts cache todownload
|
performDownload' started' addunlockedmatcher opts cache todownload
|
||||||
{ location = Enclosure linkurl }
|
{ location = Enclosure linkurl }
|
||||||
|
|
||||||
addmediafast linkurl mediaurl mediakey =
|
addmediafast linkurl mediaurl mediakey =
|
||||||
ifM (pure (not (rawOption (downloadOptions opts)))
|
ifM (pure (not (rawOption (downloadOptions opts)))
|
||||||
<&&> youtubeDlSupported linkurl)
|
<&&> youtubeDlSupported linkurl)
|
||||||
( rundownload linkurl ".m" $ \f ->
|
( do
|
||||||
|
starturl linkurl
|
||||||
|
rundownload linkurl ".m" $ \f ->
|
||||||
checkCanAdd (downloadOptions opts) f $ \canadd -> do
|
checkCanAdd (downloadOptions opts) f $ \canadd -> do
|
||||||
addWorkTree canadd addunlockedmatcher webUUID mediaurl f mediakey Nothing
|
addWorkTree canadd addunlockedmatcher webUUID mediaurl f mediakey Nothing
|
||||||
return (Just [mediakey])
|
return (Just [mediakey])
|
||||||
, performDownload addunlockedmatcher opts cache todownload
|
, performDownload' started addunlockedmatcher opts cache todownload
|
||||||
{ location = Enclosure linkurl }
|
{ location = Enclosure linkurl }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
starturl u = unless started $
|
||||||
|
showStartOther "addurl" (Just u) (SeekInput [])
|
||||||
|
|
||||||
defaultTemplate :: String
|
defaultTemplate :: String
|
||||||
defaultTemplate = "${feedtitle}/${itemtitle}${extension}"
|
defaultTemplate = "${feedtitle}/${itemtitle}${extension}"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue