2015-04-13 22:04:51 +02:00
|
|
|
{ stdenv, fetchFromGitHub, writeScript, glibcLocales
|
2016-11-09 12:11:07 +01:00
|
|
|
, python2Packages, imagemagick
|
2014-12-30 03:23:37 +01:00
|
|
|
|
2016-02-09 21:43:50 +01:00
|
|
|
, enableAcousticbrainz ? true
|
|
|
|
, enableAcoustid ? true
|
|
|
|
, enableBadfiles ? true, flac ? null, mp3val ? null
|
2016-05-02 17:18:07 +02:00
|
|
|
, enableConvert ? true, ffmpeg ? null
|
2016-02-09 21:43:50 +01:00
|
|
|
, enableDiscogs ? true
|
|
|
|
, enableEmbyupdate ? true
|
|
|
|
, enableFetchart ? true
|
2016-09-10 01:44:10 +02:00
|
|
|
, enableKeyfinder ? true, keyfinder-cli ? null
|
2016-02-09 21:43:50 +01:00
|
|
|
, enableLastfm ? true
|
|
|
|
, enableMpd ? true
|
|
|
|
, enableReplaygain ? true, bs1770gain ? null
|
|
|
|
, enableThumbnails ? true
|
|
|
|
, enableWeb ? true
|
2014-12-30 22:53:00 +01:00
|
|
|
|
2015-12-18 05:34:46 +01:00
|
|
|
# External plugins
|
2016-09-10 01:43:42 +02:00
|
|
|
, enableAlternatives ? false
|
|
|
|
, enableCopyArtifacts ? false
|
2015-12-18 05:34:46 +01:00
|
|
|
|
2016-09-28 17:46:29 +02:00
|
|
|
, bashInteractive, bash-completion
|
2014-12-30 22:53:00 +01:00
|
|
|
}:
|
|
|
|
|
2016-11-09 12:11:07 +01:00
|
|
|
assert enableAcoustid -> python2Packages.pyacoustid != null;
|
2015-10-26 10:26:48 +01:00
|
|
|
assert enableBadfiles -> flac != null && mp3val != null;
|
2016-05-02 17:18:07 +02:00
|
|
|
assert enableConvert -> ffmpeg != null;
|
2016-11-09 12:11:07 +01:00
|
|
|
assert enableDiscogs -> python2Packages.discogs_client != null;
|
|
|
|
assert enableFetchart -> python2Packages.responses != null;
|
2016-09-10 01:44:10 +02:00
|
|
|
assert enableKeyfinder -> keyfinder-cli != null;
|
2016-11-09 12:11:07 +01:00
|
|
|
assert enableLastfm -> python2Packages.pylast != null;
|
|
|
|
assert enableMpd -> python2Packages.mpd != null;
|
2015-12-18 02:03:00 +01:00
|
|
|
assert enableReplaygain -> bs1770gain != null;
|
2016-11-09 12:11:07 +01:00
|
|
|
assert enableThumbnails -> python2Packages.pyxdg != null;
|
|
|
|
assert enableWeb -> python2Packages.flask != null;
|
2014-12-30 22:53:00 +01:00
|
|
|
|
|
|
|
with stdenv.lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
optionalPlugins = {
|
2016-02-09 21:43:50 +01:00
|
|
|
acousticbrainz = enableAcousticbrainz;
|
2015-10-26 10:26:48 +01:00
|
|
|
badfiles = enableBadfiles;
|
2014-12-30 22:53:00 +01:00
|
|
|
chroma = enableAcoustid;
|
2016-05-02 17:18:07 +02:00
|
|
|
convert = enableConvert;
|
2014-12-30 22:53:00 +01:00
|
|
|
discogs = enableDiscogs;
|
2016-02-02 16:07:25 +01:00
|
|
|
embyupdate = enableEmbyupdate;
|
2014-12-30 22:53:00 +01:00
|
|
|
fetchart = enableFetchart;
|
2016-09-10 01:44:10 +02:00
|
|
|
keyfinder = enableKeyfinder;
|
2014-12-30 22:53:00 +01:00
|
|
|
lastgenre = enableLastfm;
|
|
|
|
lastimport = enableLastfm;
|
|
|
|
mpdstats = enableMpd;
|
|
|
|
mpdupdate = enableMpd;
|
|
|
|
replaygain = enableReplaygain;
|
2015-04-13 22:04:51 +02:00
|
|
|
thumbnails = enableThumbnails;
|
2014-12-30 22:53:00 +01:00
|
|
|
web = enableWeb;
|
|
|
|
};
|
|
|
|
|
|
|
|
pluginsWithoutDeps = [
|
2016-08-02 11:33:20 +02:00
|
|
|
"beatport" "bench" "bpd" "bpm" "bucket" "cue" "duplicates" "edit" "embedart"
|
|
|
|
"export" "filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "hook" "ihate"
|
2016-09-10 01:44:10 +02:00
|
|
|
"importadded" "importfeeds" "info" "inline" "ipfs" "lyrics"
|
2016-02-02 16:07:25 +01:00
|
|
|
"mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play"
|
2015-06-01 05:51:04 +02:00
|
|
|
"plexupdate" "random" "rewrite" "scrub" "smartplaylist" "spotify" "the"
|
|
|
|
"types" "zero"
|
2014-12-30 22:53:00 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
enabledOptionalPlugins = attrNames (filterAttrs (_: id) optionalPlugins);
|
|
|
|
|
|
|
|
allPlugins = pluginsWithoutDeps ++ attrNames optionalPlugins;
|
2014-12-30 23:13:56 +01:00
|
|
|
allEnabledPlugins = pluginsWithoutDeps ++ enabledOptionalPlugins;
|
|
|
|
|
2014-12-30 22:53:00 +01:00
|
|
|
testShell = "${bashInteractive}/bin/bash --norc";
|
2016-09-28 17:46:29 +02:00
|
|
|
completion = "${bash-completion}/share/bash-completion/bash_completion";
|
2014-12-30 22:53:00 +01:00
|
|
|
|
2016-11-09 12:11:07 +01:00
|
|
|
in python2Packages.buildPythonApplication rec {
|
2014-12-30 22:46:22 +01:00
|
|
|
name = "beets-${version}";
|
2016-11-28 08:52:26 +01:00
|
|
|
version = "1.4.1";
|
2014-12-30 03:23:37 +01:00
|
|
|
|
2014-12-30 22:46:22 +01:00
|
|
|
src = fetchFromGitHub {
|
2016-11-28 08:52:26 +01:00
|
|
|
owner = "beetbox";
|
2014-12-30 22:46:22 +01:00
|
|
|
repo = "beets";
|
|
|
|
rev = "v${version}";
|
2016-11-28 08:52:26 +01:00
|
|
|
sha256 = "1yj2m7l157lldhxanwifp3yv1c6k649iwhn061mcf26q4n8qmspk";
|
2014-12-30 03:23:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2016-11-09 12:11:07 +01:00
|
|
|
python2Packages.enum34
|
|
|
|
python2Packages.jellyfish
|
|
|
|
python2Packages.munkres
|
|
|
|
python2Packages.musicbrainzngs
|
|
|
|
python2Packages.mutagen
|
|
|
|
python2Packages.pathlib
|
|
|
|
python2Packages.pyyaml
|
|
|
|
python2Packages.unidecode
|
|
|
|
] ++ optional enableAcoustid python2Packages.pyacoustid
|
2016-02-02 16:07:25 +01:00
|
|
|
++ optional (enableFetchart
|
2016-02-09 21:43:50 +01:00
|
|
|
|| enableEmbyupdate
|
|
|
|
|| enableAcousticbrainz)
|
2016-11-09 12:11:07 +01:00
|
|
|
python2Packages.requests2
|
2016-05-02 17:18:07 +02:00
|
|
|
++ optional enableConvert ffmpeg
|
2016-11-09 12:11:07 +01:00
|
|
|
++ optional enableDiscogs python2Packages.discogs_client
|
2016-09-10 01:44:10 +02:00
|
|
|
++ optional enableKeyfinder keyfinder-cli
|
2016-11-09 12:11:07 +01:00
|
|
|
++ optional enableLastfm python2Packages.pylast
|
|
|
|
++ optional enableMpd python2Packages.mpd
|
|
|
|
++ optional enableThumbnails python2Packages.pyxdg
|
|
|
|
++ optional enableWeb python2Packages.flask
|
2015-12-18 05:34:46 +01:00
|
|
|
++ optional enableAlternatives (import ./alternatives-plugin.nix {
|
2016-11-09 12:11:07 +01:00
|
|
|
inherit stdenv python2Packages fetchFromGitHub;
|
2016-09-10 01:43:42 +02:00
|
|
|
})
|
|
|
|
++ optional enableCopyArtifacts (import ./copyartifacts-plugin.nix {
|
2016-11-09 12:11:07 +01:00
|
|
|
inherit stdenv python2Packages fetchFromGitHub;
|
2015-12-18 05:34:46 +01:00
|
|
|
});
|
2014-12-30 22:53:00 +01:00
|
|
|
|
2016-11-09 12:11:07 +01:00
|
|
|
buildInputs = with python2Packages; [
|
2014-12-30 22:53:00 +01:00
|
|
|
beautifulsoup4
|
2015-06-01 05:51:04 +02:00
|
|
|
imagemagick
|
2014-12-30 22:53:00 +01:00
|
|
|
mock
|
|
|
|
nose
|
|
|
|
rarfile
|
|
|
|
responses
|
2014-12-30 03:23:37 +01:00
|
|
|
];
|
|
|
|
|
2014-12-30 23:06:28 +01:00
|
|
|
patches = [
|
2015-12-18 02:03:00 +01:00
|
|
|
./replaygain-default-bs1770gain.patch
|
2016-09-10 01:44:10 +02:00
|
|
|
./keyfinder-default-bin.patch
|
2014-12-30 23:06:28 +01:00
|
|
|
];
|
2014-12-30 22:53:00 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -i -e '/assertIn.*item.*path/d' test/test_info.py
|
2016-02-10 02:41:15 +01:00
|
|
|
echo echo completion tests passed > test/rsrc/test_completion.sh
|
2014-12-30 22:53:00 +01:00
|
|
|
|
|
|
|
sed -i -e '/^BASH_COMPLETION_PATHS *=/,/^])$/ {
|
|
|
|
/^])$/i u"${completion}"
|
|
|
|
}' beets/ui/commands.py
|
2015-10-26 10:26:48 +01:00
|
|
|
'' + optionalString enableBadfiles ''
|
|
|
|
sed -i -e '/self\.run_command(\[/ {
|
2016-02-01 19:46:02 +01:00
|
|
|
s,"flac","${flac.bin}/bin/flac",
|
2015-10-26 10:26:48 +01:00
|
|
|
s,"mp3val","${mp3val}/bin/mp3val",
|
|
|
|
}' beetsplug/badfiles.py
|
2016-05-02 17:18:07 +02:00
|
|
|
'' + optionalString enableConvert ''
|
|
|
|
sed -i -e 's,\(util\.command_output(\)\([^)]\+\)),\1[b"${ffmpeg.bin}/bin/ffmpeg" if args[0] == b"ffmpeg" else args[0]] + \2[1:]),' beetsplug/convert.py
|
2015-12-18 02:03:00 +01: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 22:53:00 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2014-12-30 23:11:57 +01: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 22:53:00 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
|
2015-04-13 22:04:51 +02:00
|
|
|
LANG=en_US.UTF-8 \
|
2015-09-26 09:29:13 +02:00
|
|
|
LOCALE_ARCHIVE=${assert stdenv.isLinux; glibcLocales}/lib/locale/locale-archive \
|
2014-12-30 22:53:00 +01:00
|
|
|
BEETS_TEST_SHELL="${testShell}" \
|
|
|
|
BASH_COMPLETION_SCRIPT="${completion}" \
|
|
|
|
HOME="$(mktemp -d)" \
|
|
|
|
nosetests -v
|
|
|
|
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
2014-12-30 03:23:37 +01:00
|
|
|
|
2014-12-30 23:13:56 +01:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
tmphome="$(mktemp -d)"
|
|
|
|
|
|
|
|
EDITOR="${writeScript "beetconfig.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
cat > "$1" <<CFG
|
2015-01-22 10:33:48 +01:00
|
|
|
plugins: ${concatStringsSep " " allEnabledPlugins}
|
2014-12-30 23:13:56 +01:00
|
|
|
CFG
|
|
|
|
''}" HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
EDITOR=true HOME="$tmphome" "$out/bin/beet" config -e
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
|
|
|
'';
|
2014-12-30 03:23:37 +01:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Music tagger and library organizer";
|
2015-06-01 05:51:04 +02:00
|
|
|
homepage = http://beets.radbox.org;
|
|
|
|
license = licenses.mit;
|
2016-05-17 13:57:28 +02:00
|
|
|
maintainers = with maintainers; [ aszlig domenkozar pjones profpatsch ];
|
2015-09-26 09:29:13 +02:00
|
|
|
platforms = platforms.linux;
|
2014-12-30 03:23:37 +01:00
|
|
|
};
|
|
|
|
}
|