From fb80530069aef214889f23cd03b08475c8266f20 Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Wed, 12 Jun 2013 16:04:57 -0400 Subject: [PATCH] CC-5229: map_metadata in Liquidsoap is applied twice fixed --- python_apps/pypo/liquidsoap_scripts/ls_lib.liq | 17 ++++++++++++----- .../pypo/liquidsoap_scripts/ls_script.liq | 4 +--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq index a044edc7c..e2123e26d 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_lib.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_lib.liq @@ -23,12 +23,19 @@ end # A function applied to each metadata chunk def append_title(m) = log("Using stream_format #{!stream_metadata_type}") - if !stream_metadata_type == 1 then - [("title", "#{!show_name} - #{m['artist']} - #{m['title']}")] - elsif !stream_metadata_type == 2 then - [("title", "#{!station_name} - #{!show_name}")] + + if list.mem_assoc("mapped", m) then + #protection against applying this function twice. It shouldn't be happening + #and bug file with Liquidsoap. + m else - [("title", "#{m['artist']} - #{m['title']}")] + if !stream_metadata_type == 1 then + [("title", "#{!show_name} - #{m['artist']} - #{m['title']}"), ("mapped", "true")] + elsif !stream_metadata_type == 2 then + [("title", "#{!station_name} - #{!show_name}"), ("mapped", "true")] + else + [("title", "#{m['artist']} - #{m['title']}"), ("mapped", "true")] + end end end diff --git a/python_apps/pypo/liquidsoap_scripts/ls_script.liq b/python_apps/pypo/liquidsoap_scripts/ls_script.liq index 4d6318529..36d85a372 100644 --- a/python_apps/pypo/liquidsoap_scripts/ls_script.liq +++ b/python_apps/pypo/liquidsoap_scripts/ls_script.liq @@ -73,11 +73,9 @@ create_source() queue = add(!sources, normalize=false) pair = insert_metadata(queue) -f = fst(pair) +dynamic_metadata_callback := fst(pair) queue = snd(pair) -dynamic_metadata_callback := f - output.dummy(fallible=true, queue) http = input.http_restart(id="http")