addurl --file: Fix a bug that made youtube-dl be used unneccessarily when adding an html url that does not contain any media.
This commit is contained in:
parent
a87da159c1
commit
8758f9c561
3 changed files with 11 additions and 2 deletions
|
@ -23,6 +23,8 @@ git-annex (7.20190220) UNRELEASED; urgency=medium
|
||||||
* Fix cleanup of git-annex:export.log after git-annex forget --drop-dead.
|
* Fix cleanup of git-annex:export.log after git-annex forget --drop-dead.
|
||||||
* Makefile: Added install-home target which installs git-annex into
|
* Makefile: Added install-home target which installs git-annex into
|
||||||
the HOME directory.
|
the HOME directory.
|
||||||
|
* addurl --file: Fix a bug that made youtube-dl be used unneccessarily
|
||||||
|
when adding an html url that does not contain any media.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Wed, 20 Feb 2019 14:20:59 -0400
|
-- Joey Hess <id@joeyh.name> Wed, 20 Feb 2019 14:20:59 -0400
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ performWeb :: AddUrlOptions -> URLString -> FilePath -> Url.UrlInfo -> CommandPe
|
||||||
performWeb o url file urlinfo = ifAnnexed file addurl geturl
|
performWeb o url file urlinfo = ifAnnexed file addurl geturl
|
||||||
where
|
where
|
||||||
geturl = next $ isJust <$> addUrlFile (downloadOptions o) url urlinfo file
|
geturl = next $ isJust <$> addUrlFile (downloadOptions o) url urlinfo file
|
||||||
addurl = addUrlChecked o url file webUUID $ \k ->
|
addurl = addUrlChecked o url file webUUID $ \k ->
|
||||||
ifM (pure (not (rawOption (downloadOptions o))) <&&> youtubeDlSupported url)
|
ifM (pure (not (rawOption (downloadOptions o))) <&&> youtubeDlSupported url)
|
||||||
( return (True, True, setDownloader url YoutubeDownloader)
|
( return (True, True, setDownloader url YoutubeDownloader)
|
||||||
, return (Url.urlExists urlinfo, Url.urlSize urlinfo == keySize k, url)
|
, return (Url.urlExists urlinfo, Url.urlSize urlinfo == keySize k, url)
|
||||||
|
@ -277,7 +277,6 @@ downloadWeb o url urlinfo file =
|
||||||
liftIO $ createDirectoryIfMissing True (parentDir file)
|
liftIO $ createDirectoryIfMissing True (parentDir file)
|
||||||
finishDownloadWith tmp webUUID url file
|
finishDownloadWith tmp webUUID url file
|
||||||
tryyoutubedl tmp
|
tryyoutubedl tmp
|
||||||
| isJust (fileOption o) = dl file
|
|
||||||
-- Ask youtube-dl what filename it will download
|
-- Ask youtube-dl what filename it will download
|
||||||
-- first, and check if that is already an annexed file,
|
-- first, and check if that is already an annexed file,
|
||||||
-- to avoid unnecessary work in that case.
|
-- to avoid unnecessary work in that case.
|
||||||
|
@ -286,6 +285,12 @@ downloadWeb o url urlinfo file =
|
||||||
(alreadyannexed dest)
|
(alreadyannexed dest)
|
||||||
(dl dest)
|
(dl dest)
|
||||||
Left _ -> normalfinish tmp
|
Left _ -> normalfinish tmp
|
||||||
|
-- Ask youtube-dl what filename it will download
|
||||||
|
-- fist, so it's only used when the file contains embedded
|
||||||
|
-- media.
|
||||||
|
| isJust (fileOption o) = youtubeDlFileNameHtmlOnly url >>= \case
|
||||||
|
Right _ -> dl file
|
||||||
|
Left _ -> normalfinish tmp
|
||||||
where
|
where
|
||||||
dl dest = withTmpWorkDir mediakey $ \workdir -> do
|
dl dest = withTmpWorkDir mediakey $ \workdir -> do
|
||||||
let cleanuptmp = pruneTmpWorkDirBefore tmp (liftIO . nukeFile)
|
let cleanuptmp = pruneTmpWorkDirBefore tmp (liftIO . nukeFile)
|
||||||
|
|
|
@ -29,3 +29,5 @@ local repository version: 5
|
||||||
The same happens if I remove `youtube-dl` from the system entirely!
|
The same happens if I remove `youtube-dl` from the system entirely!
|
||||||
[[!meta author=yoh]]
|
[[!meta author=yoh]]
|
||||||
|
|
||||||
|
> due to using --file which bypasses the usual check that youtube-dl
|
||||||
|
> can extract media. [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue