When youtube-dl is not available in PATH, use yt-dlp instead

Debian is going to drop youtube-dl which is not active upstream, and yt-dlp
is the replacement. This will make it be used if youtube-dl gets removed.

If an old version of youtube-dl remains installed, git-annex will still use
it. That might not be desirable, but changing git-annex to use yt-dlp in
preference to youtube-dl when both are installed risks breaking when
the user has annex.youtube-dl-options set to something that is supported
by youtube-dl, but not by yt-dlp.

Sponsored-by: Boyd Stephen Smith Jr. on Patreon
This commit is contained in:
Joey Hess 2022-11-21 14:39:26 -04:00
parent 63b33d4181
commit 5256be61c1
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 9 additions and 6 deletions

View file

@ -249,8 +249,9 @@ youtubeDlOpts addopts = do
return (opts ++ addopts)
youtubeDlCommand :: Annex String
youtubeDlCommand = fromMaybe "youtube-dl" . annexYoutubeDlCommand
<$> Annex.getGitConfig
youtubeDlCommand = annexYoutubeDlCommand <$> Annex.getGitConfig >>= \case
Just c -> pure c
Nothing -> fromMaybe "yt-dlp" <$> liftIO (searchPath "youtube-dl")
supportedScheme :: UrlOptions -> URLString -> Bool
supportedScheme uo url = case parseURIRelaxed url of