diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_amd64 index 75ccf6e83..5ba8bd5a2 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_amd64 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_amd64 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_i386 index cb8a3f19b..b8661d2cb 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_i386 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_lucid_i386 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_amd64 index f1cfb7bc5..0c1f6aa47 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_amd64 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_amd64 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_i386 index ac09e7a6d..e33993a80 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_i386 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_maverick_i386 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_amd64 index 3f616dd20..87b8c0100 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_amd64 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_amd64 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_i386 index c7638465d..1cbd9bc8a 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_i386 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_natty_i386 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_amd64 index 8d153881e..7d08801d3 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_amd64 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_amd64 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_i386 index 3fc7a4a81..0ab7c2c5f 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_i386 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_oneiric_i386 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_amd64 b/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_amd64 index 2454190d1..5d5d214fa 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_amd64 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_amd64 differ diff --git a/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_i386 b/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_i386 index 7f119078d..6397b08c2 100755 Binary files a/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_i386 and b/python_apps/pypo/liquidsoap_bin/liquidsoap_squeeze_i386 differ diff --git a/python_apps/pypo/liquidsoap_scripts/library/externals.liq b/python_apps/pypo/liquidsoap_scripts/library/externals.liq index a3b1a2bc3..6e1b98a60 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/externals.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/externals.liq @@ -1,6 +1,54 @@ # Decoders, enabled when the binary is detected and the os is not Win32. %ifdef add_decoder +# Enable external Musepack decoder. Requires the +# mpcdec binary in the path. Does not work on +# Win32. +def enable_external_mpc_decoder() = + # A list of know extensions and content-type for Musepack. + # Values from http://en.wikipedia.org/wiki/Musepack + mpc_mimes = [ "audio/x-musepack", "audio/musepack" ] + mpc_filexts = [ "mpc", "mp+", "mpp" ] + + def test_mpc(file) = + def get_channels(file) = + int_of_string( + list.hd( + get_process_lines("mpcdec -i #{quote(file)} 2>&1 \ + | grep channels | cut -d' ' -f 2"))) + end + # Get the file's mime + mime = get_mime(file) + # Test mime + if list.mem(mime,mpc_mimes) then + get_channels(file) + else + # Otherwise test file extension + ret = string.extract(pattern='\.(.+)$',file) + if list.length(ret) != 0 then + ext = ret["1"] + if list.mem(ext,mpc_filexts) then + get_channels(file) + else + 0 + end + else + get_channels(file) + end + end + end + + if test_process("which mpcdec") then + log(level=3,"Found mpcdec binary: enabling musepack external decoder.") + mpcdec_p = fun(f) -> "mpcdec #{quote(f)} - 2>/dev/null" + add_oblivious_decoder(name="MPCDEC",description="Decode files using the mpcdec \ + musepack decoder binary",test=test_mpc,mpcdec_p) + else + log(level=3,"Did not find mpcdec binary: musepack decoder disabled.") + end + +end + # Enable external FLAC decoders. Requires flac binary # in the path for audio decoding and metaflac binary for # metadata. Does not work on Win32. Default: disabled. @@ -30,7 +78,7 @@ def enable_external_flac_decoder() = end end end - add_decoder(name="FLAC",description="Decode files using the flac \ + add_decoder(name="EXTERNAL_FLAC",description="Decode files using the flac \ decoder binary.", test=test_flac,flac_p) else log(level=3,"Did not find flac binary: flac decoder disabled.") @@ -57,7 +105,7 @@ def enable_external_flac_decoder() = end list.fold(f,[],ret) end - add_metadata_resolver("FLAC",flac_meta) + add_metadata_resolver("EXTERNAL_FLAC",flac_meta) else log(level=3,"Did not find metaflac binary: flac metadata resolver disabled.") end @@ -126,7 +174,7 @@ def enable_external_faad_decoder() = 0 end end - add_oblivious_decoder(name="FAAD",description="Decode files using \ + add_oblivious_decoder(name="EXTERNAL_FAAD",description="Decode files using \ the faad binary.", test=test_faad, faad_p) def faad_meta(file) = if faad_test(file) then @@ -146,7 +194,7 @@ def enable_external_faad_decoder() = [] end end - add_metadata_resolver("FAAD",faad_meta) + add_metadata_resolver("EXTERNAL_FAAD",faad_meta) else log(level=3,"Did not find faad binary: faad decoder disabled.") end diff --git a/python_apps/pypo/liquidsoap_scripts/library/utils.liq b/python_apps/pypo/liquidsoap_scripts/library/utils.liq index 5967662f4..3d82d8997 100644 --- a/python_apps/pypo/liquidsoap_scripts/library/utils.liq +++ b/python_apps/pypo/liquidsoap_scripts/library/utils.liq @@ -341,34 +341,6 @@ def server.rms(~id="",s) = s end -# Get the base name of a path. -# Implemented using the corresponding shell command. -# @category System -# @param s Path -def basename(s) - lines = get_process_lines("basename #{quote(s)}") - if list.length(lines) > 0 then - list.hd(lines) - else - # Don't know what to do.. output s - s - end -end - -# Get the directory name of a path. -# Implemented using the corresponding shell command. -# @category System -# @param s Path -# @param ~default Value returned in case of error. -def dirname(~default="/nonexistent",s) - lines = get_process_lines("dirname #{quote(s)}") - if list.length(lines) > 0 then - list.hd(lines) - else - default - end -end - # Read some value from standard input (console). # @category System # @param ~hide Hide typed characters (for passwords).