From 80373ca7bc10ba200bd193b281011e2f00f6a41a Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Thu, 16 Feb 2017 20:54:18 +0100 Subject: [PATCH 1/2] cue_cut workaround This is the workaround for . I still need to do proper testing on it and maybe we should figure out the proper "formula" for getting to the 0.04 value. --- python_apps/pypo/liquidsoap/ls_script.liq | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python_apps/pypo/liquidsoap/ls_script.liq b/python_apps/pypo/liquidsoap/ls_script.liq index 8055aa48b..ff30adcff 100644 --- a/python_apps/pypo/liquidsoap/ls_script.liq +++ b/python_apps/pypo/liquidsoap/ls_script.liq @@ -44,6 +44,24 @@ def create_source() l = request.equeue(id="s#{!source_id}", length=0.5) l = audio_to_stereo(id="queue_src", l) + + # cue cut fix for liquidsoap <1.2.2 + # + # This was most likely broken on 1.1.1 (debian) as well. + # + # adapted from https://github.com/savonet/liquidsoap/issues/390#issuecomment-277562081 + # + v = list.map(int_of_string, string.split(separator="\.", liquidsoap.version)) + if list.nth(v,0) < 2 and list.nth(v,1) < 3 then + map_metadata(fun (~cue_in_metadata='liq_cue_in', m) -> + # 0.04 might need to be adjusted according to your frame size + if float_of_string(m[cue_in_metadata]) < 0.04 then + [(cue_in_metadata, "0")] + else + [] + end + end) + end l = cue_cut(l) l = amplify(1., override="replay_gain", l) From ac5f608bd84d7c29670712a5cc9934e70f467616 Mon Sep 17 00:00:00 2001 From: Lucas Bickel Date: Sat, 18 Feb 2017 13:35:13 +0100 Subject: [PATCH 2/2] Refactor into def check_version Make the code more readable :) --- python_apps/pypo/liquidsoap/ls_script.liq | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python_apps/pypo/liquidsoap/ls_script.liq b/python_apps/pypo/liquidsoap/ls_script.liq index ff30adcff..7db04d417 100644 --- a/python_apps/pypo/liquidsoap/ls_script.liq +++ b/python_apps/pypo/liquidsoap/ls_script.liq @@ -40,6 +40,11 @@ just_switched = ref false sources = ref [] source_id = ref 0 +def check_version(~version=liquidsoap.version, major, minor) = + v = list.map(int_of_string, string.split(separator="\.", version)) + list.nth(v,0) > major or list.nth(v,0) == major and list.nth(v,1) >= minor +end + def create_source() l = request.equeue(id="s#{!source_id}", length=0.5) @@ -51,9 +56,8 @@ def create_source() # # adapted from https://github.com/savonet/liquidsoap/issues/390#issuecomment-277562081 # - v = list.map(int_of_string, string.split(separator="\.", liquidsoap.version)) - if list.nth(v,0) < 2 and list.nth(v,1) < 3 then - map_metadata(fun (~cue_in_metadata='liq_cue_in', m) -> + if not check_version(1, 3) then + l = map_metadata(fun (~cue_in_metadata='liq_cue_in', m) -> # 0.04 might need to be adjusted according to your frame size if float_of_string(m[cue_in_metadata]) < 0.04 then [(cue_in_metadata, "0")]