Skip to content

Instantly share code, notes, and snippets.

@naxxfish
Created August 21, 2014 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naxxfish/d9a38dcd8e6ca7364f11 to your computer and use it in GitHub Desktop.
Save naxxfish/d9a38dcd8e6ca7364f11 to your computer and use it in GitHub Desktop.
This Liqudisoap script allows you to stream from Mixxx and get some metadata out of it
set("log.stdout",true)
set("harbor.bind_addr","127.0.0.1")
meta = ref []
s = input.harbor("mixxx",port=8000,password="derp")
s = mksafe(s)
# Update current metadata
# converted in UTF8
def update_meta(m) =
m = metadata.export(m)
recode = string.recode(out_enc="UTF-8")
def f(x) =
(recode(fst(x)),recode(snd(x)))
end
meta := list.map(f,m)
end
# Apply update_metadata
# every time we see a new
# metadata
s = on_metadata(update_meta,s)
# Return the json content
# of meta
def get_meta(~method,~protocol,~data,~headers,uri) =
m = !meta
http_response(
protocol=protocol,
code=200,
headers=[("Content-Type","application/json; charset=utf-8")],
data=json_of(m)
)
end
output.dummy(s)
# Register get_meta at port 7000
harbor.http.register( port=7000, "/getmeta", get_meta)
@zoschel
Copy link

zoschel commented Mar 28, 2016

An issue in your script, cann you help me?

Mär 28 16:11:49 userver systemd[1]: Starting LSB: Starts the liquidsoap daemon...
Mär 28 16:11:49 userver liquidsoap[3524]: Starting liquidsoap channels: neu.liq At line 38, char 54:
Mär 28 16:11:49 userver liquidsoap[3524]: this value has type
Mär 28 16:11:49 userver liquidsoap[3524]: (protocol:,data:,headers:,,method:)-> (inferred at line 26 char 1 - line 34 char 3)
Mär 28 16:11:49 userver liquidsoap[3524]: but it should be a subtype of
Mär 28 16:11:49 userver liquidsoap[3524]: (protocol:,data:,headers:,)->string
Mär 28 16:11:49 userver liquidsoap[3524]: OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment