1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pytestCheckHook, 6 setuptools, 7 pyloggermanager, 8 requests, 9 pym3u8downloader, # For package tests 10}: 11 12buildPythonPackage rec { 13 pname = "pym3u8downloader"; 14 version = "0.1.8"; 15 pyproject = true; 16 17 src = fetchFromGitHub { 18 owner = "coldsofttech"; 19 repo = "pym3u8downloader"; 20 tag = version; 21 hash = "sha256-VfNzHysvEVUNx8OK28v2l3QYTMn0ydE/LH+DBXpLfE8="; 22 }; 23 24 build-system = [ setuptools ]; 25 26 dependencies = [ 27 pyloggermanager 28 requests 29 ]; 30 31 pythonImportsCheck = [ "pym3u8downloader" ]; 32 33 doCheck = false; 34 35 passthru = { 36 tests = { 37 pytest = pym3u8downloader.overridePythonAttrs (previousPythonAttrs: { 38 TEST_SERVER_PORT = "8000"; 39 40 postPatch = previousPythonAttrs.postPatch or "" + '' 41 # Patch test data location 42 substituteInPlace tests/commonclass.py \ 43 --replace-fail \ 44 "f'https://raw.githubusercontent.com/coldsofttech/pym3u8downloader/{branch_name}/tests/files'" \ 45 "'http://localhost:$TEST_SERVER_PORT/tests/files'" 46 # Patch the `is_internet_connected()` method 47 substituteInPlace pym3u8downloader/__main__.py \ 48 --replace-fail "'http://www.github.com'" "'http://localhost:$TEST_SERVER_PORT'" 49 ''; 50 51 doCheck = true; 52 53 nativeCheckInputs = [ pytestCheckHook ]; 54 55 preCheck = previousPythonAttrs.preCheck or "" + '' 56 python3 -m http.server "$TEST_SERVER_PORT" & 57 TEST_SERVER_PID="$!" 58 ''; 59 60 postCheck = previousPythonAttrs.postCheck or "" + '' 61 kill -s TERM "$TEST_SERVER_PID" 62 ''; 63 }); 64 }; 65 }; 66 67 meta = { 68 description = "Python class to download and concatenate video files from M3U8 playlists"; 69 longDescription = '' 70 M3U8 Downloader is a Python class designed to 71 download and concatenate video files from M3U8 playlists. 72 This class provides functionality to handle M3U8 playlist files, 73 download video segments, 74 concatenate them into a single video file, 75 and manage various error conditions. 76 ''; 77 homepage = "https://github.com/coldsofttech/pym3u8downloader"; 78 changelog = "https://github.com/coldsofttech/pym3u8downloader/blob/${src.tag}/CHANGELOG.md"; 79 license = lib.licenses.mit; 80 maintainers = with lib.maintainers; [ ShamrockLee ]; 81 }; 82}