Merge pull request #151208 from NixOS/pkg/beets
This commit is contained in:
commit
de5d0afeba
@ -1,33 +1,34 @@
|
|||||||
diff --git i/beets/ui/commands.py w/beets/ui/commands.py
|
diff --git i/beets/ui/commands.py w/beets/ui/commands.py
|
||||||
index 4d010f4b..0b023585 100755
|
index 3a337401..d08a6763 100755
|
||||||
--- i/beets/ui/commands.py
|
--- i/beets/ui/commands.py
|
||||||
+++ w/beets/ui/commands.py
|
+++ w/beets/ui/commands.py
|
||||||
@@ -1741,20 +1741,6 @@ default_commands.append(config_cmd)
|
@@ -1759,21 +1759,6 @@ default_commands.append(config_cmd)
|
||||||
def print_completion(*args):
|
def print_completion(*args):
|
||||||
for line in completion_script(default_commands + plugins.commands()):
|
for line in completion_script(default_commands + plugins.commands()):
|
||||||
print_(line, end=u'')
|
print_(line, end='')
|
||||||
- if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
|
- if not any(map(os.path.isfile, BASH_COMPLETION_PATHS)):
|
||||||
- log.warning(u'Warning: Unable to find the bash-completion package. '
|
- log.warning('Warning: Unable to find the bash-completion package. '
|
||||||
- u'Command line completion might not work.')
|
- 'Command line completion might not work.')
|
||||||
|
-
|
||||||
-
|
-
|
||||||
-BASH_COMPLETION_PATHS = map(syspath, [
|
-BASH_COMPLETION_PATHS = map(syspath, [
|
||||||
- u'/etc/bash_completion',
|
- '/etc/bash_completion',
|
||||||
- u'/usr/share/bash-completion/bash_completion',
|
- '/usr/share/bash-completion/bash_completion',
|
||||||
- u'/usr/local/share/bash-completion/bash_completion',
|
- '/usr/local/share/bash-completion/bash_completion',
|
||||||
- # SmartOS
|
- # SmartOS
|
||||||
- u'/opt/local/share/bash-completion/bash_completion',
|
- '/opt/local/share/bash-completion/bash_completion',
|
||||||
- # Homebrew (before bash-completion2)
|
- # Homebrew (before bash-completion2)
|
||||||
- u'/usr/local/etc/bash_completion',
|
- '/usr/local/etc/bash_completion',
|
||||||
-])
|
-])
|
||||||
-
|
-
|
||||||
|
|
||||||
def completion_script(commands):
|
def completion_script(commands):
|
||||||
"""Yield the full completion shell script as strings.
|
"""Yield the full completion shell script as strings.
|
||||||
diff --git i/test/test_ui.py w/test/test_ui.py
|
diff --git i/test/test_ui.py w/test/test_ui.py
|
||||||
index 5cfed1fd..9d3dc458 100644
|
index 9804b0a1..c3b53243 100644
|
||||||
--- i/test/test_ui.py
|
--- i/test/test_ui.py
|
||||||
+++ w/test/test_ui.py
|
+++ w/test/test_ui.py
|
||||||
@@ -1230,12 +1230,7 @@ class CompletionTest(_common.TestCase, TestHelper):
|
@@ -1229,12 +1229,7 @@ class CompletionTest(_common.TestCase, TestHelper):
|
||||||
stdout=subprocess.PIPE, env=env)
|
stdout=subprocess.PIPE, env=env)
|
||||||
|
|
||||||
# Load bash_completion library.
|
# Load bash_completion library.
|
||||||
@ -36,8 +37,8 @@ index 5cfed1fd..9d3dc458 100644
|
|||||||
- bash_completion = path
|
- bash_completion = path
|
||||||
- break
|
- break
|
||||||
- else:
|
- else:
|
||||||
- self.skipTest(u'bash-completion script not found')
|
- self.skipTest('bash-completion script not found')
|
||||||
+ self.skipTest(u'bash-completion script not found')
|
+ self.skipTest('bash-completion script not found')
|
||||||
try:
|
try:
|
||||||
with open(util.syspath(bash_completion), 'rb') as f:
|
with open(util.syspath(bash_completion), 'rb') as f:
|
||||||
tester.stdin.writelines(f)
|
tester.stdin.writelines(f)
|
||||||
|
@ -1,43 +1,34 @@
|
|||||||
diff --git i/beetsplug/convert.py w/beetsplug/convert.py
|
diff --git i/beetsplug/convert.py w/beetsplug/convert.py
|
||||||
index 70363f6e..2962aa4f 100644
|
index 6bc07c28..039fb452 100644
|
||||||
--- i/beetsplug/convert.py
|
--- i/beetsplug/convert.py
|
||||||
+++ w/beetsplug/convert.py
|
+++ w/beetsplug/convert.py
|
||||||
@@ -81,7 +81,7 @@ def get_format(fmt=None):
|
@@ -118,22 +118,22 @@ class ConvertPlugin(BeetsPlugin):
|
||||||
command = config['convert']['command'].as_str()
|
'id3v23': 'inherit',
|
||||||
elif 'opts' in keys:
|
'formats': {
|
||||||
# Undocumented option for backwards compatibility with < 1.3.1.
|
'aac': {
|
||||||
- command = u'ffmpeg -i $source -y {0} $dest'.format(
|
- 'command': 'ffmpeg -i $source -y -vn -acodec aac '
|
||||||
+ command = u'@ffmpeg@/bin/ffmpeg -i $source -y {0} $dest'.format(
|
+ 'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec aac '
|
||||||
config['convert']['opts'].as_str()
|
'-aq 1 $dest',
|
||||||
)
|
'extension': 'm4a',
|
||||||
if 'extension' in keys:
|
|
||||||
@@ -121,22 +121,22 @@ class ConvertPlugin(BeetsPlugin):
|
|
||||||
u'id3v23': u'inherit',
|
|
||||||
u'formats': {
|
|
||||||
u'aac': {
|
|
||||||
- u'command': u'ffmpeg -i $source -y -vn -acodec aac '
|
|
||||||
+ u'command': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec aac '
|
|
||||||
u'-aq 1 $dest',
|
|
||||||
u'extension': u'm4a',
|
|
||||||
},
|
},
|
||||||
u'alac': {
|
'alac': {
|
||||||
- u'command': u'ffmpeg -i $source -y -vn -acodec alac $dest',
|
- 'command': 'ffmpeg -i $source -y -vn -acodec alac $dest',
|
||||||
+ u'command': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec alac $dest',
|
+ 'command': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec alac $dest',
|
||||||
u'extension': u'm4a',
|
'extension': 'm4a',
|
||||||
},
|
},
|
||||||
- u'flac': u'ffmpeg -i $source -y -vn -acodec flac $dest',
|
- 'flac': 'ffmpeg -i $source -y -vn -acodec flac $dest',
|
||||||
- u'mp3': u'ffmpeg -i $source -y -vn -aq 2 $dest',
|
- 'mp3': 'ffmpeg -i $source -y -vn -aq 2 $dest',
|
||||||
+ u'flac': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec flac $dest',
|
+ 'flac': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec flac $dest',
|
||||||
+ u'mp3': u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -aq 2 $dest',
|
+ 'mp3': '@ffmpeg@/bin/ffmpeg -i $source -y -vn -aq 2 $dest',
|
||||||
u'opus':
|
'opus':
|
||||||
- u'ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
|
- 'ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
|
||||||
+ u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
|
+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libopus -ab 96k $dest',
|
||||||
u'ogg':
|
'ogg':
|
||||||
- u'ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
|
- 'ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
|
||||||
+ u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
|
+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec libvorbis -aq 3 $dest',
|
||||||
u'wma':
|
'wma':
|
||||||
- u'ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
|
- 'ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
|
||||||
+ u'@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
|
+ '@ffmpeg@/bin/ffmpeg -i $source -y -vn -acodec wmav2 -vn $dest',
|
||||||
},
|
},
|
||||||
u'max_bitrate': 500,
|
'max_bitrate': 500,
|
||||||
u'auto': False,
|
'auto': False,
|
||||||
|
@ -1,6 +1,18 @@
|
|||||||
{ stdenv, lib, fetchFromGitHub, writeScript, glibcLocales, diffPlugins, substituteAll
|
{ stdenv
|
||||||
, pythonPackages, imagemagick, gobject-introspection, gst_all_1
|
, lib
|
||||||
, runtimeShell, unstableGitUpdater
|
, fetchFromGitHub
|
||||||
|
, writeScript
|
||||||
|
, glibcLocales
|
||||||
|
, diffPlugins
|
||||||
|
, substituteAll
|
||||||
|
, pythonPackages
|
||||||
|
# can be null, if you wish to disable a reference to it. It's needed for the
|
||||||
|
# artresizer, see:
|
||||||
|
# https://beets.readthedocs.io/en/v1.6.0/plugins/fetchart.html#image-resizing
|
||||||
|
, imagemagick
|
||||||
|
, gobject-introspection
|
||||||
|
, gst_all_1
|
||||||
|
, runtimeShell
|
||||||
|
|
||||||
# external plugins package set
|
# external plugins package set
|
||||||
, beetsExternalPlugins
|
, beetsExternalPlugins
|
||||||
@ -73,9 +85,9 @@ let
|
|||||||
};
|
};
|
||||||
|
|
||||||
pluginsWithoutDeps = [
|
pluginsWithoutDeps = [
|
||||||
"bareasc" "bench" "bpd" "bpm" "bucket" "duplicates" "edit" "embedart"
|
"albumtypes" "bareasc" "bench" "bpd" "bpm" "bucket" "duplicates" "edit" "embedart"
|
||||||
"export" "filefilter" "fish" "freedesktop" "fromfilename" "ftintitle" "fuzzy"
|
"export" "filefilter" "fish" "freedesktop" "fromfilename" "ftintitle" "fuzzy"
|
||||||
"hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs"
|
"hook" "ihate" "importadded" "importfeeds" "info" "inline" "ipfs" "gmusic"
|
||||||
"mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "parentwork" "permissions" "play"
|
"mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "parentwork" "permissions" "play"
|
||||||
"plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
|
"plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
|
||||||
"types" "unimported" "zero"
|
"types" "unimported" "zero"
|
||||||
@ -89,24 +101,15 @@ let
|
|||||||
testShell = "${bashInteractive}/bin/bash --norc";
|
testShell = "${bashInteractive}/bin/bash --norc";
|
||||||
completion = "${bash-completion}/share/bash-completion/bash_completion";
|
completion = "${bash-completion}/share/bash-completion/bash_completion";
|
||||||
|
|
||||||
# This is a stripped down beets for testing of the external plugins.
|
|
||||||
externalTestArgs.beets = (lib.beets.override {
|
|
||||||
enableAlternatives = false;
|
|
||||||
enableCopyArtifacts = false;
|
|
||||||
enableExtraFiles = false;
|
|
||||||
}).overrideAttrs (lib.const {
|
|
||||||
doInstallCheck = false;
|
|
||||||
});
|
|
||||||
|
|
||||||
in pythonPackages.buildPythonApplication rec {
|
in pythonPackages.buildPythonApplication rec {
|
||||||
pname = "beets";
|
pname = "beets";
|
||||||
version = "1.5.0";
|
version = "1.6.0";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "beetbox";
|
owner = "beetbox";
|
||||||
repo = "beets";
|
repo = "beets";
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
sha256 = "sha256-yQMCJUwpjDDhPffBS6LUq6z4iT1VyFQE0R27XEbYXbY=";
|
sha256 = "sha256-fT+rCJJQR7bdfAcmeFRaknmh4ZOP4RCx8MXpq7/D8tM=";
|
||||||
};
|
};
|
||||||
|
|
||||||
propagatedBuildInputs = [
|
propagatedBuildInputs = [
|
||||||
@ -152,7 +155,6 @@ in pythonPackages.buildPythonApplication rec {
|
|||||||
;
|
;
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
imagemagick
|
|
||||||
] ++ (with gst_all_1; [
|
] ++ (with gst_all_1; [
|
||||||
gst-plugins-base
|
gst-plugins-base
|
||||||
gst-plugins-good
|
gst-plugins-good
|
||||||
@ -167,7 +169,7 @@ in pythonPackages.buildPythonApplication rec {
|
|||||||
responses
|
responses
|
||||||
# Although considered as plugin dependencies, they are needed for the
|
# Although considered as plugin dependencies, they are needed for the
|
||||||
# tests, for disabling them via an override makes the build fail. see:
|
# tests, for disabling them via an override makes the build fail. see:
|
||||||
# https://github.com/beetbox/beets/blob/v1.4.9/setup.py
|
# https://github.com/beetbox/beets/blob/v1.6.0/setup.py
|
||||||
pylast
|
pylast
|
||||||
mpd2
|
mpd2
|
||||||
discogs-client
|
discogs-client
|
||||||
@ -177,10 +179,14 @@ in pythonPackages.buildPythonApplication rec {
|
|||||||
patches = [
|
patches = [
|
||||||
# Bash completion fix for Nix
|
# Bash completion fix for Nix
|
||||||
./bash-completion-always-print.patch
|
./bash-completion-always-print.patch
|
||||||
# From some reason upstream assumes the program 'keyfinder-cli' is located
|
|
||||||
# in the path as `KeyFinder`
|
|
||||||
./keyfinder-default-bin.patch
|
|
||||||
]
|
]
|
||||||
|
# Fix path to imagemagick, used for the artresizer.py file. This reference
|
||||||
|
# to imagemagick might be expensive for some people, so the patch can be
|
||||||
|
# disabled if imagemagick is set to null
|
||||||
|
++ lib.optional (imagemagick != null) (substituteAll {
|
||||||
|
src = ./imagemagick-nix-path.patch;
|
||||||
|
inherit imagemagick;
|
||||||
|
})
|
||||||
# We need to force ffmpeg as the default, since we do not package
|
# We need to force ffmpeg as the default, since we do not package
|
||||||
# bs1770gain, and set the absolute path there, to avoid impurities.
|
# bs1770gain, and set the absolute path there, to avoid impurities.
|
||||||
++ lib.optional enableReplaygain (substituteAll {
|
++ lib.optional enableReplaygain (substituteAll {
|
||||||
@ -200,13 +206,10 @@ in pythonPackages.buildPythonApplication rec {
|
|||||||
|
|
||||||
# Disable failing tests
|
# Disable failing tests
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -i -e '/assertIn.*item.*path/d' test/test_info.py
|
|
||||||
echo echo completion tests passed > test/rsrc/test_completion.sh
|
echo echo completion tests passed > test/rsrc/test_completion.sh
|
||||||
|
|
||||||
|
# https://github.com/beetbox/beets/issues/1187
|
||||||
sed -i -e 's/len(mf.images)/0/' test/test_zero.py
|
sed -i -e 's/len(mf.images)/0/' test/test_zero.py
|
||||||
|
|
||||||
# Google Play Music was discontinued
|
|
||||||
rm -r beetsplug/gmusic.py
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
@ -256,7 +259,10 @@ in pythonPackages.buildPythonApplication rec {
|
|||||||
runHook postInstallCheck
|
runHook postInstallCheck
|
||||||
'';
|
'';
|
||||||
|
|
||||||
makeWrapperArgs = [ "--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\"" "--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\"" ];
|
makeWrapperArgs = [
|
||||||
|
"--set GI_TYPELIB_PATH \"$GI_TYPELIB_PATH\""
|
||||||
|
"--set GST_PLUGIN_SYSTEM_PATH_1_0 \"$GST_PLUGIN_SYSTEM_PATH_1_0\""
|
||||||
|
];
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
# FIXME: remove in favor of pkgs.beetsExternalPlugins
|
# FIXME: remove in favor of pkgs.beetsExternalPlugins
|
||||||
|
20
pkgs/tools/audio/beets/imagemagick-nix-path.patch
Normal file
20
pkgs/tools/audio/beets/imagemagick-nix-path.patch
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
diff --git i/beets/util/artresizer.py w/beets/util/artresizer.py
|
||||||
|
index 8683e228..2f38b4d6 100644
|
||||||
|
--- i/beets/util/artresizer.py
|
||||||
|
+++ w/beets/util/artresizer.py
|
||||||
|
@@ -334,13 +334,8 @@ class ArtResizer(metaclass=Shareable):
|
||||||
|
# not, fall back to the older, separate convert and identify
|
||||||
|
# commands.
|
||||||
|
if self.method[0] == IMAGEMAGICK:
|
||||||
|
- self.im_legacy = self.method[2]
|
||||||
|
- if self.im_legacy:
|
||||||
|
- self.im_convert_cmd = ['convert']
|
||||||
|
- self.im_identify_cmd = ['identify']
|
||||||
|
- else:
|
||||||
|
- self.im_convert_cmd = ['magick']
|
||||||
|
- self.im_identify_cmd = ['magick', 'identify']
|
||||||
|
+ self.im_convert_cmd = ['@imagemagick@/bin/magick']
|
||||||
|
+ self.im_identify_cmd = ['@imagemagick@/bin/magick', 'identify']
|
||||||
|
|
||||||
|
def resize(
|
||||||
|
self, maxwidth, path_in, path_out=None, quality=0, max_filesize=0
|
@ -1,26 +0,0 @@
|
|||||||
diff --git a/beetsplug/keyfinder.py b/beetsplug/keyfinder.py
|
|
||||||
index 702003f0..08689cd8 100644
|
|
||||||
--- a/beetsplug/keyfinder.py
|
|
||||||
+++ b/beetsplug/keyfinder.py
|
|
||||||
@@ -31,7 +31,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,
|
|
||||||
})
|
|
||||||
diff --git a/test/test_keyfinder.py b/test/test_keyfinder.py
|
|
||||||
index c8735e47..d7d670a4 100644
|
|
||||||
--- a/test/test_keyfinder.py
|
|
||||||
+++ b/test/test_keyfinder.py
|
|
||||||
@@ -44,7 +44,7 @@ class KeyFinderTest(unittest.TestCase, TestHelper):
|
|
||||||
item.load()
|
|
||||||
self.assertEqual(item['initial_key'], 'C#m')
|
|
||||||
command_output.assert_called_with(
|
|
||||||
- ['KeyFinder', '-f', util.syspath(item.path)])
|
|
||||||
+ ['keyfinder-cli', util.syspath(item.path)])
|
|
||||||
|
|
||||||
def test_add_key_on_import(self, command_output):
|
|
||||||
command_output.return_value = util.CommandOutput(b"dbm", b"")
|
|
@ -1,26 +1,26 @@
|
|||||||
diff --git i/beetsplug/replaygain.py w/beetsplug/replaygain.py
|
diff --git i/beetsplug/replaygain.py w/beetsplug/replaygain.py
|
||||||
index 9d6fa23c..c5800039 100644
|
index b6297d93..5c1cbbc0 100644
|
||||||
--- i/beetsplug/replaygain.py
|
--- i/beetsplug/replaygain.py
|
||||||
+++ w/beetsplug/replaygain.py
|
+++ w/beetsplug/replaygain.py
|
||||||
@@ -391,7 +391,7 @@ class FfmpegBackend(Backend):
|
@@ -139,7 +139,7 @@ class FfmpegBackend(Backend):
|
||||||
|
|
||||||
def __init__(self, config, log):
|
def __init__(self, config, log):
|
||||||
super(FfmpegBackend, self).__init__(config, log)
|
super().__init__(config, log)
|
||||||
- self._ffmpeg_path = "ffmpeg"
|
- self._ffmpeg_path = "ffmpeg"
|
||||||
+ self._ffmpeg_path = "@ffmpeg@/bin/ffmpeg"
|
+ self._ffmpeg_path = "@ffmpeg@/bin/ffmpeg"
|
||||||
|
|
||||||
# check that ffmpeg is installed
|
# check that ffmpeg is installed
|
||||||
try:
|
try:
|
||||||
@@ -1228,11 +1228,10 @@ class ReplayGainPlugin(BeetsPlugin):
|
@@ -975,11 +975,10 @@ class ReplayGainPlugin(BeetsPlugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ReplayGainPlugin, self).__init__()
|
super().__init__()
|
||||||
|
|
||||||
- # default backend is 'command' for backward-compatibility.
|
- # default backend is 'command' for backward-compatibility.
|
||||||
self.config.add({
|
self.config.add({
|
||||||
'overwrite': False,
|
'overwrite': False,
|
||||||
'auto': True,
|
'auto': True,
|
||||||
- 'backend': u'command',
|
- 'backend': 'command',
|
||||||
+ 'backend': u'ffmpeg',
|
+ 'backend': 'ffmpeg',
|
||||||
'threads': cpu_count(),
|
'threads': cpu_count(),
|
||||||
'parallel_on_import': False,
|
'parallel_on_import': False,
|
||||||
'per_disc': False,
|
'per_disc': False,
|
||||||
|
Loading…
Reference in New Issue
Block a user