python3Packages.pym3u8downloader: init at 0.1.5

This commit is contained in:
Yueh-Shun Li
2024-12-07 21:24:26 +08:00
parent b4d58aeade
commit 835fa4c610
2 changed files with 94 additions and 0 deletions
@@ -0,0 +1,88 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
setuptools,
pyloggermanager,
requests,
pym3u8downloader, # For package tests
}:
buildPythonPackage rec {
pname = "pym3u8downloader";
version = "0.1.5";
pyproject = true;
src = fetchFromGitHub {
owner = "coldsofttech";
repo = "pym3u8downloader";
rev = version;
hash = "sha256-Kcvtl4jP2pSiETTKUmuiBsysxaFfd4K/E2/nXY8Vlw8=";
};
build-system = [ setuptools ];
dependencies = [
pyloggermanager
requests
];
pythonImportsCheck = [ "pym3u8downloader" ];
doCheck = false;
passthru = {
tests = {
pytest = pym3u8downloader.overridePythonAttrs (previousPythonAttrs: {
TEST_SERVER_PORT = "8000";
postPatch =
previousPythonAttrs.postPatch or ""
+ ''
# Patch test data location
substituteInPlace tests/commonclass.py \
--replace-fail \
"f'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/{branch_name}/tests/files'" \
"'http://localhost:$TEST_SERVER_PORT/tests/files'"
# Patch the `is_internet_connected()` method
substituteInPlace pym3u8downloader/__main__.py \
--replace-fail "'http://www.github.com'" "'http://localhost:$TEST_SERVER_PORT'"
'';
doCheck = true;
nativeCheckInputs = [ pytestCheckHook ];
preCheck =
previousPythonAttrs.preCheck or ""
+ ''
python3 -m http.server "$TEST_SERVER_PORT" &
TEST_SERVER_PID="$!"
'';
postCheck =
previousPythonAttrs.postCheck or ""
+ ''
kill -s TERM "$TEST_SERVER_PID"
'';
});
};
};
meta = {
description = "Python class to download and concatenate video files from M3U8 playlists";
longDescription = ''
M3U8 Downloader is a Python class designed to
download and concatenate video files from M3U8 playlists.
This class provides functionality to handle M3U8 playlist files,
download video segments,
concatenate them into a single video file,
and manage various error conditions.
'';
homepage = "https://github.com/coldsofttech/pym3u8downloader";
changelog = "https://github.com/coldsofttech/pym3u8downloader/blob/${src.rev}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ ShamrockLee ];
};
}
+6
View File
@@ -10308,6 +10308,8 @@ self: super: with self; {
pycketcasts = callPackage ../development/python-modules/pycketcasts { };
pycolorecho = callPackage ../development/python-modules/pycolorecho { };
pycomm3 = callPackage ../development/python-modules/pycomm3 { };
pycompliance = callPackage ../development/python-modules/pycompliance { };
@@ -11734,6 +11736,8 @@ self: super: with self; {
py-libzfs = callPackage ../development/python-modules/py-libzfs { };
pyloggermanager = callPackage ../development/python-modules/pyloggermanager { };
py-lru-cache = callPackage ../development/python-modules/py-lru-cache { };
pylnk3 = callPackage ../development/python-modules/pylnk3 { };
@@ -11766,6 +11770,8 @@ self: super: with self; {
pylzma = callPackage ../development/python-modules/pylzma { };
pym3u8downloader = callPackage ../development/python-modules/pym3u8downloader { };
pymacaroons = callPackage ../development/python-modules/pymacaroons { };
pymailgunner = callPackage ../development/python-modules/pymailgunner { };