Skip to content

Commit

Permalink
Merge pull request #325887 from NixOS/backport-325678-to-release-24.05
Browse files Browse the repository at this point in the history
[Backport release-24.05] mopidy-youtube: replace youtube-dl with yt-dlp
  • Loading branch information
fpletz authored Jul 9, 2024
2 parents 284e172 + 48e4da3 commit fc85c05
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions pkgs/applications/audio/mopidy/youtube.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{ lib
, fetchFromGitHub
, python3
, mopidy
, extraPkgs ? pkgs: []
{
lib,
fetchFromGitHub,
python3,
mopidy,
yt-dlp,
extraPkgs ? pkgs: [ ],
}:

python3.pkgs.buildPythonApplication rec {
Expand All @@ -17,22 +19,36 @@ python3.pkgs.buildPythonApplication rec {
hash = "sha256-iFt7r8Ljymc+grNJiOClTHkZOeo7AcYpcNc8tLMPROk=";
};

propagatedBuildInputs = with python3.pkgs; [
beautifulsoup4
cachetools
pykka
requests
youtube-dl
ytmusicapi
] ++ [
mopidy
] ++ extraPkgs pkgs;
propagatedBuildInputs =
with python3.pkgs;
[
beautifulsoup4
cachetools
pykka
requests
ytmusicapi
]
++ [
mopidy
yt-dlp
]
++ extraPkgs pkgs;

nativeCheckInputs = with python3.pkgs; [
vcrpy
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 = [
# Test requires a YouTube API key
"test_get_default_config"
Expand All @@ -45,9 +61,7 @@ python3.pkgs.buildPythonApplication rec {
"tests/test_youtube.py"
];

pythonImportsCheck = [
"mopidy_youtube"
];
pythonImportsCheck = [ "mopidy_youtube" ];

meta = with lib; {
description = "Mopidy extension for playing music from YouTube";
Expand Down

0 comments on commit fc85c05

Please sign in to comment.