diff --git a/pkgs/applications/video/kodi/addons/sendtokodi/default.nix b/pkgs/applications/video/kodi/addons/sendtokodi/default.nix index a3d289dac3fb..1fa75900b7d4 100644 --- a/pkgs/applications/video/kodi/addons/sendtokodi/default.nix +++ b/pkgs/applications/video/kodi/addons/sendtokodi/default.nix @@ -4,6 +4,7 @@ fetchFromGitHub, kodi, inputstreamhelper, + requests, }: buildKodiAddon rec { @@ -19,27 +20,25 @@ buildKodiAddon rec { }; patches = [ - # Unconditionally depend on packaged yt-dlp. This removes the ability to - # use youtube_dl, which is unmaintained and considered vulnerable (see - # CVE-2024-38519). - ./use-packaged-yt-dlp.patch + # Use yt-dlp, only. This removes the ability to use youtube_dl, which is + # unmaintained and considered vulnerable (see CVE-2024-38519). + ./use-yt-dlp-only.patch ]; propagatedBuildInputs = [ inputstreamhelper + requests ]; postPatch = '' - # Remove vendored youtube-dl and yt-dlp libraries. - rm -r lib/ + # Remove youtube-dl, which is unmaintained and vulnerable. + rm -r lib/youtube_dl lib/youtube_dl_version + # Replace yt-dlp with our own packaged version thereof. + rm -r lib/yt_dlp + echo "${lib.strings.getVersion kodi.pythonPackages.yt-dlp}" >lib/yt_dlp_version + ln -s ${kodi.pythonPackages.yt-dlp}/${kodi.pythonPackages.python.sitePackages}/yt_dlp lib/ ''; - passthru = { - # Instead of the vendored libraries, we propagate yt-dlp via the Python - # path. - pythonPath = with kodi.pythonPackages; makePythonPath [ yt-dlp ]; - }; - meta = with lib; { homepage = "https://github.com/firsttris/plugin.video.sendtokodi"; description = "Plays various stream sites on Kodi using yt-dlp"; diff --git a/pkgs/applications/video/kodi/addons/sendtokodi/use-packaged-yt-dlp.patch b/pkgs/applications/video/kodi/addons/sendtokodi/use-yt-dlp-only.patch similarity index 50% rename from pkgs/applications/video/kodi/addons/sendtokodi/use-packaged-yt-dlp.patch rename to pkgs/applications/video/kodi/addons/sendtokodi/use-yt-dlp-only.patch index b53e1a434fff..fb889b2b2319 100644 --- a/pkgs/applications/video/kodi/addons/sendtokodi/use-packaged-yt-dlp.patch +++ b/pkgs/applications/video/kodi/addons/sendtokodi/use-yt-dlp-only.patch @@ -1,18 +1,18 @@ diff --git a/service.py b/service.py -index 024ad9a..6ef71dd 100644 +index 5d588682..99123b4b 100644 --- a/service.py +++ b/service.py -@@ -243,11 +243,8 @@ def playlistIndex(url, playlist): +@@ -323,12 +323,7 @@ if not sys.argv[2]: + xbmcaddon.Addon().openSettings() + exit() - - # Use the chosen resolver while forcing to use youtube_dl on legacy python 2 systems (dlp is python 3.6+) +-# Use the chosen resolver while forcing to use youtube_dl on legacy python 2 systems (dlp is python 3.6+) -if xbmcplugin.getSetting(int(sys.argv[1]),"resolver") == "0" or sys.version_info[0] == 2: -- from lib.youtube_dl import YoutubeDL +- from youtube_dl import YoutubeDL -else: -- from lib.yt_dlp import YoutubeDL -- +- # import lib.yt_dlp as yt_dlp +- from yt_dlp import YoutubeDL +from yt_dlp import YoutubeDL -+ + # patch broken strptime (see above) patch_strptime() -