2015-04-13 21:04:51 +01:00
|
|
|
{ stdenv, fetchFromGitHub, writeScript, glibcLocales
|
2016-02-19 12:12:11 +00:00
|
|
|
, buildPythonApplication, pythonPackages, python, imagemagick
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2016-02-09 20:43:50 +00:00
|
|
|
, enableAcousticbrainz ? true
|
|
|
|
, enableAcoustid ? true
|
|
|
|
, enableBadfiles ? true, flac ? null, mp3val ? null
|
|
|
|
, enableDiscogs ? true
|
|
|
|
, enableEchonest ? true
|
|
|
|
, enableEmbyupdate ? true
|
|
|
|
, enableFetchart ? true
|
|
|
|
, enableLastfm ? true
|
|
|
|
, enableMpd ? true
|
|
|
|
, enableReplaygain ? true, bs1770gain ? null
|
|
|
|
, enableThumbnails ? true
|
|
|
|
, enableWeb ? true
|
2014-12-30 21:53:00 +00:00
|
|
|
|
2015-12-18 04:34:46 +00:00
|
|
|
# External plugins
|
|
|
|
, enableAlternatives ? false
|
|
|
|
|
2014-12-30 21:53:00 +00:00
|
|
|
, bashInteractive, bashCompletion
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert enableAcoustid -> pythonPackages.pyacoustid != null;
|
2015-10-26 09:26:48 +00:00
|
|
|
assert enableBadfiles -> flac != null && mp3val != null;
|
2014-12-30 21:53:00 +00:00
|
|
|
assert enableDiscogs -> pythonPackages.discogs_client != null;
|
|
|
|
assert enableEchonest -> pythonPackages.pyechonest != null;
|
|
|
|
assert enableFetchart -> pythonPackages.responses != null;
|
|
|
|
assert enableLastfm -> pythonPackages.pylast != null;
|
|
|
|
assert enableMpd -> pythonPackages.mpd != null;
|
2015-12-18 01:03:00 +00:00
|
|
|
assert enableReplaygain -> bs1770gain != null;
|
2015-04-14 08:36:12 +01:00
|
|
|
assert enableThumbnails -> pythonPackages.pyxdg != null;
|
2014-12-30 21:53:00 +00:00
|
|
|
assert enableWeb -> pythonPackages.flask != null;
|
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
optionalPlugins = {
|
2016-02-09 20:43:50 +00:00
|
|
|
acousticbrainz = enableAcousticbrainz;
|
2015-10-26 09:26:48 +00:00
|
|
|
badfiles = enableBadfiles;
|
2014-12-30 21:53:00 +00:00
|
|
|
chroma = enableAcoustid;
|
|
|
|
discogs = enableDiscogs;
|
|
|
|
echonest = enableEchonest;
|
2016-02-02 15:07:25 +00:00
|
|
|
embyupdate = enableEmbyupdate;
|
2014-12-30 21:53:00 +00:00
|
|
|
fetchart = enableFetchart;
|
|
|
|
lastgenre = enableLastfm;
|
|
|
|
lastimport = enableLastfm;
|
|
|
|
mpdstats = enableMpd;
|
|
|
|
mpdupdate = enableMpd;
|
|
|
|
replaygain = enableReplaygain;
|
2015-04-13 21:04:51 +01:00
|
|
|
thumbnails = enableThumbnails;
|
2014-12-30 21:53:00 +00:00
|
|
|
web = enableWeb;
|
|
|
|
};
|
|
|
|
|
|
|
|
pluginsWithoutDeps = [
|
2016-02-02 15:07:25 +00:00
|
|
|
"bench" "bpd" "bpm" "bucket" "convert" "cue" "duplicates" "edit" "embedart"
|
2015-10-26 09:26:48 +00:00
|
|
|
"filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "ihate"
|
|
|
|
"importadded" "importfeeds" "info" "inline" "ipfs" "keyfinder" "lyrics"
|
2016-02-02 15:07:25 +00:00
|
|
|
"mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play"
|
2015-06-01 04:51:04 +01:00
|
|
|
"plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
|
|
|
|
"types" "zero"
|
2014-12-30 21:53:00 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
|
|
|
|
|
|
|
|
allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins;
|
2014-12-30 22:13:56 +00:00
|
|
|
allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins;
|
|
|
|
|
2014-12-30 21:53:00 +00:00
|
|
|
testShell = "${bashInteractive}/bin/bash --norc";
|
|
|
|
completion = "${bashCompletion}/share/bash-completion/bash_completion";
|
|
|
|
|
2016-02-19 12:12:11 +00:00
|
|
|
in buildPythonApplication rec {
|
2014-12-30 21:46:22 +00:00
|
|
|
name = "beets-${version}";
|
2016-02-09 20:43:50 +00:00
|
|
|
version = "1.3.17";
|
2014-12-30 02:23:37 +00:00
|
|
|
namePrefix = "";
|
|
|
|
|
2014-12-30 21:46:22 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sampsyo";
|
|
|
|
repo = "beets";
|
|
|
|
rev = "v${version}";
|
2016-02-09 20:43:50 +00:00
|
|
|
sha256 = "1fskxx5xxjqf4xmfjrinh7idjiq6qncb24hiyccv09l47fr1yipc";
|
2014-12-30 02:23:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2014-12-30 21:53:00 +00:00
|
|
|
pythonPackages.enum34
|
2015-06-01 04:51:04 +01:00
|
|
|
pythonPackages.jellyfish
|
2014-12-30 02:23:37 +00:00
|
|
|
pythonPackages.munkres
|
|
|
|
pythonPackages.musicbrainzngs
|
2014-12-30 21:53:00 +00:00
|
|
|
pythonPackages.mutagen
|
2015-04-13 21:04:51 +01:00
|
|
|
pythonPackages.pathlib
|
2014-12-30 21:53:00 +00:00
|
|
|
pythonPackages.pyyaml
|
|
|
|
pythonPackages.unidecode
|
2014-12-30 02:23:37 +00:00
|
|
|
python.modules.sqlite3
|
|
|
|
python.modules.readline
|
2016-02-02 15:07:25 +00:00
|
|
|
] ++ optional enableAcoustid pythonPackages.pyacoustid
|
|
|
|
++ optional (enableFetchart
|
2016-02-09 20:43:50 +00:00
|
|
|
|| enableEmbyupdate
|
|
|
|
|| enableAcousticbrainz)
|
|
|
|
pythonPackages.requests2
|
2016-02-02 15:07:25 +00:00
|
|
|
++ optional enableDiscogs pythonPackages.discogs_client
|
|
|
|
++ optional enableEchonest pythonPackages.pyechonest
|
|
|
|
++ optional enableLastfm pythonPackages.pylast
|
|
|
|
++ optional enableMpd pythonPackages.mpd
|
|
|
|
++ optional enableThumbnails pythonPackages.pyxdg
|
|
|
|
++ optional enableWeb pythonPackages.flask
|
2015-12-18 04:34:46 +00:00
|
|
|
++ optional enableAlternatives (import ./alternatives-plugin.nix {
|
2016-02-19 12:12:11 +00:00
|
|
|
inherit stdenv buildPythonApplication pythonPackages fetchFromGitHub;
|
2015-12-18 04:34:46 +00:00
|
|
|
});
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
buildInputs = with pythonPackages; [
|
|
|
|
beautifulsoup4
|
2015-06-01 04:51:04 +01:00
|
|
|
imagemagick
|
2014-12-30 21:53:00 +00:00
|
|
|
mock
|
|
|
|
nose
|
|
|
|
rarfile
|
|
|
|
responses
|
2014-12-30 02:23:37 +00:00
|
|
|
];
|
|
|
|
|
2014-12-30 22:06:28 +00:00
|
|
|
patches = [
|
2015-12-18 01:03:00 +00:00
|
|
|
./replaygain-default-bs1770gain.patch
|
2014-12-30 22:06:28 +00:00
|
|
|
];
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e '/assertIn.*item.*path/d' test/test_info.py
|
2016-02-10 01:41:15 +00:00
|
|
|
echo echo completion tests passed > test/rsrc/test_completion.sh
|
2014-12-30 21:53:00 +00:00
|
|
|
|
|
|
|
sed -i -e '/^BASH_COMPLETION_PATHS *=/,/^])$/ {
|
|
|
|
/^])$/i u"${completion}"
|
|
|
|
}' beets/ui/commands.py
|
2015-10-26 09:26:48 +00:00
|
|
|
'' + optionalString enableBadfiles ''
|
|
|
|
sed -i -e '/self\.run_command(\[/ {
|
2016-02-01 18:46:02 +00:00
|
|
|
s,"flac","${flac.bin}/bin/flac",
|
2015-10-26 09:26:48 +00:00
|
|
|
s,"mp3val","${mp3val}/bin/mp3val",
|
|
|
|
}' beetsplug/badfiles.py
|
2015-12-18 01:03:00 +00:00
|
|
|
'' + optionalString enableReplaygain ''
|
|
|
|
sed -i -re '
|
|
|
|
s!^( *cmd *= *b?['\'''"])(bs1770gain['\'''"])!\1${bs1770gain}/bin/\2!
|
|
|
|
' beetsplug/replaygain.py
|
|
|
|
sed -i -e 's/if has_program.*bs1770gain.*:/if True:/' \
|
|
|
|
test/test_replaygain.py
|
2014-12-30 21:53:00 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2014-12-30 22:11:57 +00:00
|
|
|
preCheck = ''
|
|
|
|
(${concatMapStrings (s: "echo \"${s}\";") allPlugins}) \
|
|
|
|
| sort -u > plugins_defined
|
|
|
|
find beetsplug -mindepth 1 \
|
|
|
|
\! -path 'beetsplug/__init__.py' -a \
|
|
|
|
\( -name '*.py' -o -path 'beetsplug/*/__init__.py' \) -print \
|
|
|
|
| sed -n -re 's|^beetsplug/([^/.]+).*|\1|p' \
|
|
|
|
| sort -u > plugins_available
|
|
|
|
|
|
|
|
if ! mismatches="$(diff -y plugins_defined plugins_available)"; then
|
|
|
|
echo "The the list of defined plugins (left side) doesn't match" \
|
|
|
|
"the list of available plugins (right side):" >&2
|
|
|
|
echo "$mismatches" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2014-12-30 21:53:00 +00:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2015-04-13 21:04:51 +01:00
|
|
|
LANG=en_US.UTF-8 \
|
2015-09-26 08:29:13 +01:00
|
|
|
LOCALE_ARCHIVE=${assert stdenv.isLinux; glibcLocales}/lib/locale/locale-archive \
|
2014-12-30 21:53:00 +00:00
|
|
|
BEETS_TEST_SHELL="${testShell}" \
|
|
|
|
BASH_COMPLETION_SCRIPT="${completion}" \
|
|
|
|
HOME="$(mktemp -d)" \
|
|
|
|
nosetests -v
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2014-12-30 02:23:37 +00:00
|
|
|
|
2014-12-30 22:13:56 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
tmphome="$(mktemp -d)"
|
|
|
|
|
|
|
|
EDITOR="${writeScript "beetconfig.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
cat > "$1" <<CFG
|
2015-01-22 09:33:48 +00:00
|
|
|
plugins: ${concatStringsSep " " allEnabledPlugins}
|
2014-12-30 22:13:56 +00:00
|
|
|
CFG
|
|
|
|
''}" HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2014-12-30 02:23:37 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Music tagger and library organizer";
|
2015-06-01 04:51:04 +01:00
|
|
|
homepage = http://beets.radbox.org;
|
|
|
|
license = licenses.mit;
|
2016-02-02 15:07:25 +00:00
|
|
|
maintainers = with maintainers; [ aszlig iElectric pjones profpatsch ];
|
2015-09-26 08:29:13 +01:00
|
|
|
platforms = platforms.linux;
|
2014-12-30 02:23:37 +00:00
|
|
|
};
|
|
|
|
}
|