mopidy-youtube: replace youtube-dl with yt-dlp

This commit is contained in:
Franz Pletz 2024-07-09 01:33:02 +02:00
parent 5a82f82cc5
commit e56afd060b
No known key found for this signature in database
GPG Key ID: 846FDED7792617B4

View File

@ -1,8 +1,10 @@
{ lib {
, fetchFromGitHub lib,
, python3 fetchFromGitHub,
, mopidy python3,
, extraPkgs ? pkgs: [] mopidy,
yt-dlp,
extraPkgs ? pkgs: [ ],
}: }:
python3.pkgs.buildPythonApplication rec { python3.pkgs.buildPythonApplication rec {
@ -17,22 +19,36 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-iFt7r8Ljymc+grNJiOClTHkZOeo7AcYpcNc8tLMPROk="; hash = "sha256-iFt7r8Ljymc+grNJiOClTHkZOeo7AcYpcNc8tLMPROk=";
}; };
propagatedBuildInputs = with python3.pkgs; [ propagatedBuildInputs =
beautifulsoup4 with python3.pkgs;
cachetools [
pykka beautifulsoup4
requests cachetools
youtube-dl pykka
ytmusicapi requests
] ++ [ ytmusicapi
mopidy ]
] ++ extraPkgs pkgs; ++ [
mopidy
yt-dlp
]
++ extraPkgs pkgs;
nativeCheckInputs = with python3.pkgs; [ nativeCheckInputs = with python3.pkgs; [
vcrpy vcrpy
pytestCheckHook pytestCheckHook
]; ];
postPatch = ''
substituteInPlace mopidy_youtube/youtube.py \
--replace-fail 'youtube_dl_package = "youtube_dl"' 'youtube_dl_package = "yt_dlp"'
substituteInPlace tests/conftest.py \
--replace-fail 'import youtube_dl' 'import yt_dlp' \
--replace-fail 'patcher = mock.patch.object(youtube, "youtube_dl", spec=youtube_dl)' \
'patcher = mock.patch.object(youtube, "youtube_dl", spec=yt_dlp)' \
--replace-fail '"youtube_dl_package": "youtube_dl",' '"youtube_dl_package": "yt_dlp",'
'';
disabledTests = [ disabledTests = [
# Test requires a YouTube API key # Test requires a YouTube API key
"test_get_default_config" "test_get_default_config"
@ -45,9 +61,7 @@ python3.pkgs.buildPythonApplication rec {
"tests/test_youtube.py" "tests/test_youtube.py"
]; ];
pythonImportsCheck = [ pythonImportsCheck = [ "mopidy_youtube" ];
"mopidy_youtube"
];
meta = with lib; { meta = with lib; {
description = "Mopidy extension for playing music from YouTube"; description = "Mopidy extension for playing music from YouTube";