You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to replace the current ssh file-delivery approach with a http POST based API. Here is a bunch of links to previous work pertaining to this change:
I plan on supporting both XML file delivery and the new HTTP API in a coming nowplaying v2.x release so we don't need to switch over klangbecken at the same time. Support for the current XML file delivery mechanism will then be dropped in nowplaying v3 which is going to be released way after we switch klangbecken to use the new api.
Example Client
This is based on the same python-sdk used on the nowplaying side. The same can be acheived with any client that can send POST requests and headers, see the cURL example below for a simple bash example that demonstrates how the request works.
importrequestsfromcloudevents.httpimportCloudEvent, to_structureddefsend_event(url, username, password):
# This data defines a cloudeventattributes= {
"specversion": "1.0",
# as defined by the events-spec repo"type": "ch.rabe.api.events.track.v1.trackStarted",
# for klangbecken the github link is always used as source (as per events-spec)"source": "https://github.com/radiorabe/klangbecken",
# this should reference the actual broadcast and not some digital representation of it# one way to do thas is to use RFC 4087 `crid://` URLs as per the upcoming crid-spec thing."id": "crid://rabe.ch/v1/klangbecken#t=clock=20220209T010400.00Z",
}
data= {
"item.title": "Track Title",
"item.artist": "Artist",
# length in seconds, optional if you also implement sending the# not "completely specced yet" trackFinished event"item.length": 60,
}
event=CloudEvent(attributes, data)
headers, body=to_structured(event)
# send and print eventrequests.post(url, headers=headers, data=body, auth=(username, password))
print(f"Sent {event['id']} from {event['source']} with {event.data}")
if__name__=="__main__":
# local configurl="https://nowplaing.service.int.example.org/webhook"username="rabe"password="rabe"# do worksend_event(url, username, password)
hairmare
changed the title
replace xml file delivery http push based system (eventing shiggalawahnsinn)
replace xml file delivery with http push based system (eventing shiggalawahnsinn)
Jan 3, 2022
The idea is to replace the current ssh file-delivery approach with a http POST based API. Here is a bunch of links to previous work pertaining to this change:
I plan on supporting both XML file delivery and the new HTTP API in a coming nowplaying v2.x release so we don't need to switch over klangbecken at the same time. Support for the current XML file delivery mechanism will then be dropped in nowplaying v3 which is going to be released way after we switch klangbecken to use the new api.
Example Client
This is based on the same python-sdk used on the nowplaying side. The same can be acheived with any client that can send POST requests and headers, see the cURL example below for a simple bash example that demonstrates how the request works.
The same event could be sent using cURL:
In the python-sdk example the
time
anddatacontenttype
are autogenerated. The fields are mandatory in any case.The
data
fields are based on both the DAB+ MOT SLS/DL+ and ID3 standards as documented in the linked events-spec.It might make sense to only send these events when klangbecken considers itself onair, i'm not sure about this yet tho.
For generating the CRIDs, there is also rabe-cridlib if that helps.
Tasks
The text was updated successfully, but these errors were encountered: