kodiPackages.sendtokodi: fix PYTHON_PATH conflict with Kodi and yt-dlp (#420504)

This commit is contained in:
Aaron Andersen
2025-06-28 19:38:44 -04:00
committed by GitHub
2 changed files with 23 additions and 24 deletions
@@ -4,42 +4,41 @@
fetchFromGitHub,
kodi,
inputstreamhelper,
requests,
}:
buildKodiAddon rec {
pname = "sendtokodi";
namespace = "plugin.video.sendtokodi";
version = "0.9.557";
version = "0.9.924";
src = fetchFromGitHub {
owner = "firsttris";
repo = "plugin.video.sendtokodi";
rev = "v${version}";
hash = "sha256-Ga+9Q7x8+sEmQmteHbSyCahZ/T/l28BAEM84w7bf7z8=";
tag = "v${version}";
hash = "sha256-ycp5/NbRX2rcRRpbpX6LlplyxdfoIwCw39EyQDcyzOU=";
};
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";
@@ -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()