diff --git a/pkgs/applications/misc/mnamer/default.nix b/pkgs/applications/misc/mnamer/default.nix new file mode 100644 index 000000000000..dd634ae7f137 --- /dev/null +++ b/pkgs/applications/misc/mnamer/default.nix @@ -0,0 +1,46 @@ +{ python3Packages, fetchFromGitHub, lib }: + +python3Packages.buildPythonApplication rec { + pname = "mnamer"; + version = "2.5.3"; + + src = fetchFromGitHub { + owner = "jkwill87"; + repo = "mnamer"; + rev = version; + sha256 = "1frrvfhp85fh82yw9yb6n61by8qp1v7f3c0f623njxk1afawhccd"; + }; + + propagatedBuildInputs = with python3Packages; [ + babelfish + requests + appdirs + teletype + requests-cache + guessit + ]; + + patches = [ + # requires specific old versions of dependencies which have been updated in nixpkgs + ./remove_requirements.patch + + # author reads a private property that changed between versions + ./update_hack.patch + ]; + + checkInputs = [ python3Packages.pytestCheckHook ]; + + # disable test that fail (networking, etc) + disabledTests = [ + "network" + "e2e" + "test_utils.py" + ]; + + meta = with lib; { + homepage = "https://github.com/jkwill87/mnamer"; + description = "An intelligent and highly configurable media organization utility"; + license = licenses.mit; + maintainers = with maintainers; [ urlordjames ]; + }; +} diff --git a/pkgs/applications/misc/mnamer/remove_requirements.patch b/pkgs/applications/misc/mnamer/remove_requirements.patch new file mode 100644 index 000000000000..46fc0571ce5e --- /dev/null +++ b/pkgs/applications/misc/mnamer/remove_requirements.patch @@ -0,0 +1,21 @@ +diff --git a/setup.py b/setup.py +index 245c1dd..fdc17ab 100755 +--- a/setup.py ++++ b/setup.py +@@ -7,16 +7,12 @@ from mnamer.__version__ import VERSION + with open("readme.md", "r", encoding="utf8") as fp: + LONG_DESCRIPTION = fp.read() + +-with open("requirements.txt", "r", encoding="utf8") as fp: +- REQUIREMENTS = fp.read().splitlines() +- + setup( + author="Jessy Williams", + author_email="jessy@jessywilliams.com", + description="A media file organiser", + entry_points={"console_scripts": ["mnamer=mnamer.__main__:main"]}, + include_package_data=True, +- install_requires=REQUIREMENTS, + license="MIT", + long_description=LONG_DESCRIPTION, + long_description_content_type="text/markdown", diff --git a/pkgs/applications/misc/mnamer/update_hack.patch b/pkgs/applications/misc/mnamer/update_hack.patch new file mode 100644 index 000000000000..56c83a20a9ce --- /dev/null +++ b/pkgs/applications/misc/mnamer/update_hack.patch @@ -0,0 +1,13 @@ +diff --git a/mnamer/utils.py b/mnamer/utils.py +index 636b596..e52bd37 100644 +--- a/mnamer/utils.py ++++ b/mnamer/utils.py +@@ -280,7 +280,7 @@ def request_json( + "like Gecko) Chrome/79.0.3945.88 Safari/537.36" + ) + +- initial_cache_state = session._is_cache_disabled # yes, i'm a bad person ++ initial_cache_state = session._disabled # yes, i'm a bad person + try: + session._is_cache_disabled = not cache + response = session.request( diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 44319d78c812..9ae8c059c4f7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25662,6 +25662,8 @@ in mmtc = callPackage ../applications/audio/mmtc { }; + mnamer = callPackage ../applications/misc/mnamer { }; + moc = callPackage ../applications/audio/moc { }; mod-distortion = callPackage ../applications/audio/mod-distortion { };