diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2016-09-13 08:11:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-13 08:11:53 +0200 |
commit | 231ad13118b9cb98fdde8ae64105b97eeac52199 (patch) | |
tree | a19594ebfcfcb410bf3159192fca3b8baaac3c6e | |
parent | 896b2916ab255b650174dc1ae3583fef9df20f6f (diff) | |
parent | 328180bc2f27d9cec92f15f1726c111d0d5dc4a9 (diff) | |
download | nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar.gz nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar.bz2 nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar.lz nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar.xz nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.tar.zst nixlib-231ad13118b9cb98fdde8ae64105b97eeac52199.zip |
Merge pull request #18476 from michalrus/beets-keyfinder-copyartifacts
Beets: fix keyfinder plugin (did not work) and add copyartifacts plugin
-rw-r--r-- | pkgs/tools/audio/beets/copyartifacts-plugin.nix | 24 | ||||
-rw-r--r-- | pkgs/tools/audio/beets/default.nix | 13 | ||||
-rw-r--r-- | pkgs/tools/audio/beets/keyfinder-default-bin.patch | 35 |
3 files changed, 70 insertions, 2 deletions
diff --git a/pkgs/tools/audio/beets/copyartifacts-plugin.nix b/pkgs/tools/audio/beets/copyartifacts-plugin.nix new file mode 100644 index 000000000000..d3b36d15e03e --- /dev/null +++ b/pkgs/tools/audio/beets/copyartifacts-plugin.nix @@ -0,0 +1,24 @@ +{ stdenv, buildPythonApplication, fetchFromGitHub, pythonPackages }: + +buildPythonApplication rec { + name = "beets-copyartifacts"; + + src = fetchFromGitHub { + repo = "beets-copyartifacts"; + owner = "sbarakat"; + rev = "dac4a1605111e24bb5b498aa84cead7c87480834"; + sha256 = "0p5cskfgqinzh48a58hw56f96g9lar3k3g2p0ip1m9kawzf6axng"; + }; + + postPatch = '' + sed -i -e '/install_requires/,/\]/{/beets/d}' setup.py + sed -i -e '/namespace_packages/d' setup.py + printf 'from pkgutil import extend_path\n__path__ = extend_path(__path__, __name__)\n' >beetsplug/__init__.py + ''; + + meta = { + description = "Beets plugin to move non-music files during the import process"; + homepage = "https://github.com/sbarakat/beets-copyartifacts"; + license = stdenv.lib.licenses.mit; + }; +} diff --git a/pkgs/tools/audio/beets/default.nix b/pkgs/tools/audio/beets/default.nix index 9dcfbd10b353..d7fb0e2aab4f 100644 --- a/pkgs/tools/audio/beets/default.nix +++ b/pkgs/tools/audio/beets/default.nix @@ -8,6 +8,7 @@ , enableDiscogs ? true , enableEmbyupdate ? true , enableFetchart ? true +, enableKeyfinder ? true, keyfinder-cli ? null , enableLastfm ? true , enableMpd ? true , enableReplaygain ? true, bs1770gain ? null @@ -15,7 +16,8 @@ , enableWeb ? true # External plugins -, enableAlternatives ? false +, enableAlternatives ? false +, enableCopyArtifacts ? false , bashInteractive, bashCompletion }: @@ -25,6 +27,7 @@ assert enableBadfiles -> flac != null && mp3val != null; assert enableConvert -> ffmpeg != null; assert enableDiscogs -> pythonPackages.discogs_client != null; assert enableFetchart -> pythonPackages.responses != null; +assert enableKeyfinder -> keyfinder-cli != null; assert enableLastfm -> pythonPackages.pylast != null; assert enableMpd -> pythonPackages.mpd != null; assert enableReplaygain -> bs1770gain != null; @@ -42,6 +45,7 @@ let discogs = enableDiscogs; embyupdate = enableEmbyupdate; fetchart = enableFetchart; + keyfinder = enableKeyfinder; lastgenre = enableLastfm; lastimport = enableLastfm; mpdstats = enableMpd; @@ -54,7 +58,7 @@ let pluginsWithoutDeps = [ "beatport" "bench" "bpd" "bpm" "bucket" "cue" "duplicates" "edit" "embedart" "export" "filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "hook" "ihate" - "importadded" "importfeeds" "info" "inline" "ipfs" "keyfinder" "lyrics" + "importadded" "importfeeds" "info" "inline" "ipfs" "lyrics" "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play" "plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the" "types" "zero" @@ -98,12 +102,16 @@ in buildPythonApplication rec { pythonPackages.requests2 ++ optional enableConvert ffmpeg ++ optional enableDiscogs pythonPackages.discogs_client + ++ optional enableKeyfinder keyfinder-cli ++ optional enableLastfm pythonPackages.pylast ++ optional enableMpd pythonPackages.mpd ++ optional enableThumbnails pythonPackages.pyxdg ++ optional enableWeb pythonPackages.flask ++ optional enableAlternatives (import ./alternatives-plugin.nix { inherit stdenv buildPythonApplication pythonPackages fetchFromGitHub; + }) + ++ optional enableCopyArtifacts (import ./copyartifacts-plugin.nix { + inherit stdenv buildPythonApplication pythonPackages fetchFromGitHub; }); buildInputs = with pythonPackages; [ @@ -117,6 +125,7 @@ in buildPythonApplication rec { patches = [ ./replaygain-default-bs1770gain.patch + ./keyfinder-default-bin.patch ]; postPatch = '' diff --git a/pkgs/tools/audio/beets/keyfinder-default-bin.patch b/pkgs/tools/audio/beets/keyfinder-default-bin.patch new file mode 100644 index 000000000000..b0b573bbf313 --- /dev/null +++ b/pkgs/tools/audio/beets/keyfinder-default-bin.patch @@ -0,0 +1,35 @@ +diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py +index b6131a4..b493792 100644 +--- a/beetsplug/keyfinder.py ++++ b/beetsplug/keyfinder.py +@@ -30,7 +30,7 @@ class KeyFinderPlugin(BeetsPlugin): + def __init__(self): + super(KeyFinderPlugin, self).__init__() + self.config.add({ +- u'bin': u'KeyFinder', ++ u'bin': u'keyfinder-cli', + u'auto': True, + u'overwrite': False, + }) +@@ -59,7 +59,7 @@ class KeyFinderPlugin(BeetsPlugin): + continue + + try: +- output = util.command_output([bin, b'-f', ++ output = util.command_output([bin, + util.syspath(item.path)]) + except (subprocess.CalledProcessError, OSError) as exc: + self._log.error(u'execution failed: {0}', exc) +diff --git a/test/test_keyfinder.py b/test/test_keyfinder.py +index 00952fe..01ff8d4 100644 +--- a/test/test_keyfinder.py ++++ b/test/test_keyfinder.py +@@ -46,7 +46,7 @@ class KeyFinderTest(unittest.TestCase, TestHelper): + item.load() + self.assertEqual(item['initial_key'], 'C#m') + self.command_output.assert_called_with( +- ['KeyFinder', '-f', util.syspath(item.path)]) ++ ['keyfinder-cli', util.syspath(item.path)]) + + def test_add_key_on_import(self): + self.command_output.return_value = 'dbm' |