-
-
Notifications
You must be signed in to change notification settings - Fork 575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide DJ display name in pregenerated LS code, like the login name live_dj(), for use in video stream #6362
Comments
Our station doesn't do video streaming but such a feature would still be useful to us... We have a banner above our chatroom which displays an animation with the faces of all our djs. We could use these variables, importing them to our web site to switch the banner to ones displaying the dj during his/her live broadcast. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Would still be nice to have, but in the meantime I call the API and have to traverse the list of streamers to get at it. |
@Moonbase59 I looked into this, and tried expanding our API response parsing so we could pass rich JSON data back from the API, but Liquidsoap's type system seems to absolutely hate it. I flagged that with the LS team and haven't heard back. I'd love to be able to supply richer response data from API commands to the LS script, because there are several other things we could do with that. |
Hm, ok, so I stick with my API call for now. The dumb thing is I have to traverse the streamers list and compare the login name to get the real name … code I hate… Here’s part of my video stream code that does that:
Still clumsy and badly indented, I know… ;-) …but works: My assumption was you could easily do it in |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Would still be a "nice-to-have", even if it can be done "the hard way". |
Tagging this as in-progress since we absolutely do want to get into parsing JSON responses inside Liquidsoap. I have an idea on how to do it, I just haven't gotten back around to doing it. Lost most of this month to chronic back pain flare-ups. |
Yeah, it’s actually not hard and I do it for my videostreams all the time. We could also just close this, if it requires extra API calls in LS. My videostream uses it like so: The function to make API GET calls with: def azuracast_api_get(~timeout=2.0, url) =
full_url = "#{my_api_url}/#{url}"
log(level=4, label="api_get", "API #{url} - Sending GET request to '#{full_url}'")
try
response = http.get(full_url,
headers=[
("accept", "application/json"),
("User-Agent", "Liquidsoap AzuraCast"),
("X-API-Key", "#{my_api_key}")
],
timeout=timeout
)
log(level=4, label="api_get", "API #{url} - Response (#{response.status_code}): #{response}")
"#{response}"
catch err do
log(level=2, label="api_get", "API #{url} - Error: #{error.kind(err)} - #{error.message(err)}")
"false"
end
end When metadata updates occur: # API calls take time, let’s run this in a separate thread, so we don’t block anything
a.on_metadata(fun(m) -> thread.run(fast=false, {update_nowplaying(m)})) and within that: if m["is_live"] == "true" then
if live_dj() != "" then
url = "streamers"
djs = azuracast_api_get(url)
# get current live DJ’s name and image from streamers list
let json.parse (dj_list : [{
streamer_username: string,
display_name: string,
has_custom_art: bool,
art: string
}]) = djs
dj = list.find(fun(entry) -> entry.streamer_username == live_dj(), dj_list)
log(level=3, "API #{url} - #{dj}")
show_color := 0xeb0000 # red
show_alpha := 0.5
show_text := "Live: #{dj.display_name}"
if dj.has_custom_art then
# if we have a DJ image, use it instead of the station logo
show_image := dj.art
log(level=3, label="nowplaying", "Show: \"#{show_text()}\", color=0x#{string.hex_of_int(pad=6,show_color())}, alpha=#{show_alpha()}, image='#{show_image()}'")
else
# no image, use station logo
show_image := logo_file
log(level=3, label="nowplaying", "Show: \"#{show_text()}\", color=0x#{string.hex_of_int(pad=6,show_color())}, alpha=#{show_alpha()}, image='#{show_image()}'")
end Get well soon! |
Installation Method
Docker Installation
AzuraCast Release Channel
Rolling Release Channel
Current AzuraCast Version
Rolling Release #9f7825e (2023-06-10 16:39)
What happened?
I’m trying to get my head around showing a "Live: DJ Display Name" indication in my video stream (code will be published here when finished).
Using Liquidsoap 2.2.0+git@dcf405ff4 (installed inside Docker; works well), I’d like to show the current live DJ’s display name, but I can’t get the code and API calls sorted out, so this little request (had to use GH since the "Features" page only allows so much text and no images).
I’ve gotten as far as to add a red "Live" indicator but can only show the DJ’s login name (from using
live_dj()
).It would be just great if we could also have a variable like
live_dj_name
within the pre-generated Liquidsoap code. Since you of course know the possibilities best, could we have that?I think it might possibly fit into
def dj_auth(login)
ordef live_connected(header)
, what do you think?I’m sure it would be a great addition to those stations that use video streaming, to easily get at the DJ display name (and possibly even the DJ’s image), to make a real great video stream.
Relevant log output
No response
The text was updated successfully, but these errors were encountered: