我使用了优秀的liquidsoap流媒体引擎,但我在解析来自telnet服务器的alsa.metadata命令的结果时遇到了一些麻烦。
以下是他的输出示例:
--- 10 ---
source_url="http://liquidsoap.local:8020/radio"
title="anastacia - lumere lumera"
--- 9 ---
source_url="http://liquidsoap.local:8020/radio"
title="bob tostes - strangers in the night"
--- 8 ---
source_url="http://liquidsoap.local:8020/radio"
title="lucio battisti - amarsi un po"
--- 7 ---
source_url="http://liquidsoap.local:8020/radio"
title="george white group - nothing compares to you"
--- 6 ---
source_url="http://liquidsoap.local:8020/radio"
title="olivia - true colors"
--- 5 ---
source_url="http://liquidsoap.local:8020/radio"
title="ritmo del mundo - what s love got to do with it"
--- 4 ---
source_url="http://liquidsoap.local:8020/radio"
title="tania maria - come with me"
--- 3 ---
source_url="http://liquidsoap.local:8020/radio"
title="antonio carlos jobim a sting - how insentive"
--- 2 ---
source_url="http://liquidsoap.local:8020/radio"
title="dht - driver s seat"
--- 1 ---
source_url="http://liquidsoap.local:8020/radio"
title="marg nelson - lady marmelade"
它看起来不像任何已知的格式.. csv,json,xml ... 你能告诉我如何制作一个Python数组吗?
例如:
[10] => [source_url] => "http://liquidsoap.local:8020/radio", [title] => "anastacia - lumere lumera",
[9] => [source_url] => "http://liquidsoap.local:8020/radio", [title] => "bob tostes - strangers in the night"
谢谢,
答案 0 :(得分:0)
我使用该脚本来解析元数据:
diff = float(value) - float(device_compare_value)