aboutsummaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-12-31 14:55:51 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-12-31 14:55:51 -0400
commit2736807f86a03741d6339203c594e0c73a8fafad (patch)
tree2c43579692d9a16e18e6a55a4c486033a49eb130 /Annex
parentcbb7f306b8f8f2672ea34b040a0010739f722310 (diff)
repeated addurl behavior reversion fix
addurl: When the file youtube-dl will download is already an annexed file, don't download it again and fail to overwrite it, instead just do nothing, like it used to when quvi was used. This commit was sponsored by Anthony DeRobertis on Patreon.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/YoutubeDl.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Annex/YoutubeDl.hs b/Annex/YoutubeDl.hs
index d1cac9368..43e63dfd6 100644
--- a/Annex/YoutubeDl.hs
+++ b/Annex/YoutubeDl.hs
@@ -11,6 +11,7 @@ module Annex.YoutubeDl (
youtubeDlSupported,
youtubeDlCheck,
youtubeDlFileName,
+ youtubeDlFileName',
) where
import Annex.Common
@@ -144,7 +145,16 @@ youtubeDlCheck url
youtubeDlFileName :: URLString -> Annex (Either String FilePath)
youtubeDlFileName url
| supportedScheme url = flip catchIO (pure . Left . show) $
- htmlOnly url nomedia go
+ htmlOnly url nomedia (youtubeDlFileName' url)
+ | otherwise = return nomedia
+ where
+ nomedia = Left "no media in url"
+
+-- Does not check if the url contains htmlOnly; use when that's already
+-- been verified.
+youtubeDlFileName' :: URLString -> Annex (Either String FilePath)
+youtubeDlFileName' url
+ | supportedScheme url = flip catchIO (pure . Left . show) go
| otherwise = return nomedia
where
go = do