diff --git a/pkgs/by-name/ga/gamdl/package.nix b/pkgs/by-name/ga/gamdl/package.nix new file mode 100644 index 0000000000000..20d65b0c81935 --- /dev/null +++ b/pkgs/by-name/ga/gamdl/package.nix @@ -0,0 +1,48 @@ +{ + lib, + python3Packages, + fetchFromGitHub, +}: + +python3Packages.buildPythonApplication { + pname = "gamdl"; + version = "2.8"; + pyproject = true; + + src = fetchFromGitHub { + owner = "glomatico"; + repo = "gamdl"; + rev = "37c857b503ca9ea32c4b39669bbb2d23064f39ff"; + hash = "sha256-uwl/K0KbZKwJ8mxiQOP+nGB3I69X5wv3HhfxBiiv/VM="; + }; + + pythonRelaxDeps = [ + "click" + "pillow" + "yt-dlp" + ]; + + build-system = with python3Packages; [ setuptools ]; + + dependencies = with python3Packages; [ + async-lru + click + httpx + inquirerpy + m3u8 + mutagen + pillow + pywidevine + yt-dlp + ]; + + doCheck = false; # no tests + + meta = { + description = "Command-line app for downloading Apple Music songs, music videos and post videos"; + homepage = "https://github.com/glomatico/gamdl"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ bdim404 ]; + platforms = lib.platforms.all; + }; +} diff --git a/pkgs/development/python-modules/pymp4/default.nix b/pkgs/development/python-modules/pymp4/default.nix new file mode 100644 index 0000000000000..fd1274abfc291 --- /dev/null +++ b/pkgs/development/python-modules/pymp4/default.nix @@ -0,0 +1,38 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + poetry-core, + construct, + pytestCheckHook, +}: + +buildPythonPackage { + pname = "pymp4"; + version = "1.4.0-unstable-2023-08-07"; + pyproject = true; + + src = fetchFromGitHub { + owner = "devine-dl"; + repo = "pymp4"; + rev = "33dc5d620f361cb49d713b60dcb2686ab8696f91"; + hash = "sha256-tPIbehjYHg5+S62sorsWow+u/eBkqJYf6xMI8q4vEgY="; + }; + + pythonRelaxDeps = [ "construct" ]; + + build-system = [ poetry-core ]; + + dependencies = [ construct ]; + + nativeCheckInputs = [ pytestCheckHook ]; + + doCheck = false; + + meta = { + description = "Python library for parsing and manipulating MP4 files"; + homepage = "https://github.com/beardypig/pymp4"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ bdim404 ]; + }; +} diff --git a/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch b/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch new file mode 100644 index 0000000000000..dc83e11ae27c8 --- /dev/null +++ b/pkgs/development/python-modules/pywidevine/construct-2.10-compatibility.patch @@ -0,0 +1,20 @@ +--- a/pywidevine/device.py ++++ b/pywidevine/device.py +@@ -33,7 +33,7 @@ class _Structures: + # - Removed vmp and vmp_len as it should already be within the Client ID + v2 = Struct( + "signature" / magic, +- "version" / Const(Int8ub, 2), ++ "version" / Const(2, Int8ub), + "type_" / CEnum( + Int8ub, + **{t.name: t.value for t in DeviceTypes} +@@ -50,7 +50,7 @@ class _Structures: + # - Removed system_id as it can be retrieved from the Client ID's DRM Certificate + v1 = Struct( + "signature" / magic, +- "version" / Const(Int8ub, 1), ++ "version" / Const(1, Int8ub), + "type_" / CEnum( + Int8ub, + **{t.name: t.value for t in DeviceTypes} diff --git a/pkgs/development/python-modules/pywidevine/default.nix b/pkgs/development/python-modules/pywidevine/default.nix new file mode 100644 index 0000000000000..5bd9a3569940a --- /dev/null +++ b/pkgs/development/python-modules/pywidevine/default.nix @@ -0,0 +1,54 @@ +{ + lib, + buildPythonPackage, + fetchPypi, + poetry-core, + pycryptodome, + protobuf, + requests, + pyyaml, + unidecode, + click, + pymp4, + construct, +}: + +buildPythonPackage { + pname = "pywidevine"; + version = "1.8.0"; + pyproject = true; + + src = fetchPypi { + pname = "pywidevine"; + version = "1.8.0"; + hash = "sha256-wU8/4oZEc0FrnKpz2aISUaAtchOObVTYwaP0S3prBck="; + }; + + patches = [ + ./construct-2.10-compatibility.patch + ]; + + pythonRelaxDeps = [ "protobuf" ]; + + build-system = [ poetry-core ]; + + dependencies = [ + click + construct + protobuf + pycryptodome + pymp4 + pyyaml + requests + unidecode + ]; + + doCheck = false; + + meta = { + description = "Python implementation of Google's Widevine CDM"; + homepage = "https://github.com/devine-project/pywidevine"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ bdim404 ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 037b08734c753..4d666e77b0b52 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -13328,6 +13328,8 @@ self: super: with self; { pymorphy3-dicts-uk = callPackage ../development/python-modules/pymorphy3/dicts-uk.nix { }; + pymp4 = callPackage ../development/python-modules/pymp4 { }; + pympler = callPackage ../development/python-modules/pympler { }; pymsgbox = callPackage ../development/python-modules/pymsgbox { }; @@ -15164,6 +15166,8 @@ self: super: with self; { pywfa = callPackage ../development/python-modules/pywfa { }; + pywidevine = callPackage ../development/python-modules/pywidevine { }; + pywikibot = callPackage ../development/python-modules/pywikibot { }; pywilight = callPackage ../development/python-modules/pywilight { };