beets: Merge pull request #15165: Fix ffmpeg call

This patches the ffmpeg command path so that it will work without ffmpeg
being in the user's current path. The commit contains a suggestion from
me to patch command_output() instead of just replacing "ffmpeg" so that
if a user configuration alters the default commands it will still work.
This commit is contained in:
aszlig 2016-05-02 18:56:19 +02:00
commit 0d5ff13701
No known key found for this signature in database
GPG Key ID: D0EBD0EC8C2DC961

View File

@ -4,6 +4,7 @@
, enableAcousticbrainz ? true , enableAcousticbrainz ? true
, enableAcoustid ? true , enableAcoustid ? true
, enableBadfiles ? true, flac ? null, mp3val ? null , enableBadfiles ? true, flac ? null, mp3val ? null
, enableConvert ? true, ffmpeg ? null
, enableDiscogs ? true , enableDiscogs ? true
, enableEchonest ? true , enableEchonest ? true
, enableEmbyupdate ? true , enableEmbyupdate ? true
@ -22,6 +23,7 @@
assert enableAcoustid -> pythonPackages.pyacoustid != null; assert enableAcoustid -> pythonPackages.pyacoustid != null;
assert enableBadfiles -> flac != null && mp3val != null; assert enableBadfiles -> flac != null && mp3val != null;
assert enableConvert -> ffmpeg != null;
assert enableDiscogs -> pythonPackages.discogs_client != null; assert enableDiscogs -> pythonPackages.discogs_client != null;
assert enableEchonest -> pythonPackages.pyechonest != null; assert enableEchonest -> pythonPackages.pyechonest != null;
assert enableFetchart -> pythonPackages.responses != null; assert enableFetchart -> pythonPackages.responses != null;
@ -38,6 +40,7 @@ let
acousticbrainz = enableAcousticbrainz; acousticbrainz = enableAcousticbrainz;
badfiles = enableBadfiles; badfiles = enableBadfiles;
chroma = enableAcoustid; chroma = enableAcoustid;
convert = enableConvert;
discogs = enableDiscogs; discogs = enableDiscogs;
echonest = enableEchonest; echonest = enableEchonest;
embyupdate = enableEmbyupdate; embyupdate = enableEmbyupdate;
@ -52,7 +55,7 @@ let
}; };
pluginsWithoutDeps = [ pluginsWithoutDeps = [
"bench" "bpd" "bpm" "bucket" "convert" "cue" "duplicates" "edit" "embedart" "bench" "bpd" "bpm" "bucket" "cue" "duplicates" "edit" "embedart"
"filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "ihate" "filefilter" "freedesktop" "fromfilename" "ftintitle" "fuzzy" "ihate"
"importadded" "importfeeds" "info" "inline" "ipfs" "keyfinder" "lyrics" "importadded" "importfeeds" "info" "inline" "ipfs" "keyfinder" "lyrics"
"mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play" "mbcollection" "mbsubmit" "mbsync" "metasync" "missing" "permissions" "play"
@ -96,6 +99,7 @@ in buildPythonApplication rec {
|| enableEmbyupdate || enableEmbyupdate
|| enableAcousticbrainz) || enableAcousticbrainz)
pythonPackages.requests2 pythonPackages.requests2
++ optional enableConvert ffmpeg
++ optional enableDiscogs pythonPackages.discogs_client ++ optional enableDiscogs pythonPackages.discogs_client
++ optional enableEchonest pythonPackages.pyechonest ++ optional enableEchonest pythonPackages.pyechonest
++ optional enableLastfm pythonPackages.pylast ++ optional enableLastfm pythonPackages.pylast
@ -131,6 +135,8 @@ in buildPythonApplication rec {
s,"flac","${flac.bin}/bin/flac", s,"flac","${flac.bin}/bin/flac",
s,"mp3val","${mp3val}/bin/mp3val", s,"mp3val","${mp3val}/bin/mp3val",
}' beetsplug/badfiles.py }' beetsplug/badfiles.py
'' + 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
'' + optionalString enableReplaygain '' '' + optionalString enableReplaygain ''
sed -i -re ' sed -i -re '
s!^( *cmd *= *b?['\'''"])(bs1770gain['\'''"])!\1${bs1770gain}/bin/\2! s!^( *cmd *= *b?['\'''"])(bs1770gain['\'''"])!\1${bs1770gain}/bin/\2!