diff --git a/src/engine.liq b/src/engine.liq index 82b8194c42b94065984e040e73df48e732056016..33209529f3ef2ff54f4697fccbad4fbad938082d 100644 --- a/src/engine.liq +++ b/src/engine.liq @@ -38,11 +38,12 @@ inputs = ref [] def on_metadata_notification(meta) = filename = meta["filename"] track_duration = request.duration(filename) - json_data = json_of(meta) - json_data = '{ "action": "on_metadata", "data": #{json_data}, "track_duration": "#{track_duration}" }' - # There's currently an issue with Liquidsoap http.post requests: - # headers = [("Content-Type","application/json; charset=utf-8")] - # ignore(http.post(headers=headers, data="#{json_data}", "http://#{engine_control}")) + json_data = json_of(meta, compact=true) + json_data = url.encode(json_data) + json_data = '{ "action": "on_metadata", "meta": "#{json_data}", "track_duration": "#{track_duration}" }' + # There's currently an issue with Liquidsoap http.post requests (should be gone with Liquidsoap 2): + #headers = [("Content-Type","application/json; charset=utf-8")] + #ignore(http.post(headers=headers, data="#{json_data}", "localhost:1337")) ignore(system("curl -X POST -H 'Content-Type: application/json' --data '#{json_data}' #{engine_control}")) end