From 2736807f86a03741d6339203c594e0c73a8fafad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 31 Dec 2017 14:55:51 -0400 Subject: 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. --- Annex/YoutubeDl.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Annex') 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 -- cgit v1.2.3