Closed dani closed 4 years ago
I never used radios on Funkwhale, how do they work?
I don't see anything related to radios on the API docs for Funkwhale, I'll go and have a look at the network traffic on the web UI to see if I can understand them.
Haven't looked how they work through the API, but from a user perspective, they are a bit like dynamic playlists. They can be created "on the fly" when you browse an artist page (you get a button "Start radio"), or you can create your own radios : you add one or more filters which can include or exclude artists or tags. This dynamic aspect is what make them easier to work with than playlists. My main use case : I play all my music randomly, but exclude some specific artists/songs I don't like.
I see, that's a good use-case.
I'll look into the web UI or poke @EliotBerriot when he come back from vacarion to see if and how it can be implemented.
@apognu similarly as I wrote at #15 the radios also have existing endpoints. This is for listing the radios (empty on the demo):
curl -X GET "https://demo.funkwhale.audio/api/v1/radios/radios/" -H "accept: application/json"
{
"count":0,
"next":null,
"previous":null,
"results":[]
}
and these were the subsequent calls using the web UI when I started playing a radio:
curl 'https://mydomain/api/v1/radios/sessions/' -H 'authority: mydomain' -H 'accept: application/json, text/plain, */*' -H 'origin: https://mydomain' -H 'authorization: JWT mytokenreplacedhere' -H 'user-agent: myuseragentreplacedhere' -H 'content-type: application/json;charset=UTF-8' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-mode: cors' -H 'referer: https://mydomain/library/radios' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' --data-binary '{"radio_type":"custom","related_object_id":null,"custom_radio":1}' --compressed
response:
{
"id": 3,
"radio_type": "custom",
"related_object_id": null,
"user": 2,
"creation_date": "2019-12-22T02:05:09.175299Z",
"custom_radio": 1
}
and to get the first track:
curl 'https://mydomain/api/v1/radios/tracks/' -H 'authority: mydomain' -H 'accept: application/json, text/plain, */*' -H 'origin: https://mydomain' -H 'authorization: JWT mytokenreplacedhere' -H 'user-agent: myuseragentreplacedhere' -H 'content-type: application/json;charset=UTF-8' -H 'sec-fetch-site: same-origin' -H 'sec-fetch-mode: cors' -H 'referer: https://mydomain/library/radios' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-US,en;q=0.9' --data-binary '{"session":3}' --compressed
response:
{
"id": 17,
"session": 3,
"position": 1,
"track": {
"album": {
"id": 82,
"fid": "https://mydomain/federation/music/albums/2f13a752-eca2-444f-ad02-7b65895a0297",
"mbid": "bcee1c09-50c1-4b09-90e7-f3a732246efe",
"title": "Go: The Very Best of Moby",
"artist": {
"id": 100,
"fid": "https://mydomain/federation/music/artists/fdfb9cb5-8cb1-4606-a865-61baad1ffad3",
"mbid": "8970d868-0723-483b-a75b-51088913d3d4",
"name": "Moby",
"creation_date": "2019-12-06T19:26:16.468649Z",
"is_local": true
},
"release_date": "2007-01-01",
"cover": {
"small_square_crop": "https://mydomain/media/__sized__/albums/covers/2019/12/06/bcee1c09-50c1-4b09-90e7-f3a732246efe-crop-c0-5__0-5-50x50-70.jpg",
"square_crop": "https://mydomain/media/__sized__/albums/covers/2019/12/06/bcee1c09-50c1-4b09-90e7-f3a732246efe-crop-c0-5__0-5-400x400-70.jpg",
"original": "https://mydomain/media/albums/covers/2019/12/06/bcee1c09-50c1-4b09-90e7-f3a732246efe.jpg",
"medium_square_crop": "https://mydomain/media/__sized__/albums/covers/2019/12/06/bcee1c09-50c1-4b09-90e7-f3a732246efe-crop-c0-5__0-5-200x200-70.jpg"
},
"creation_date": "2019-12-06T19:26:16.472309Z",
"is_local": true
},
"uploads": [],
"listen_url": "/api/v1/listen/8216ac34-d36d-4e00-ad74-b28510cc71e0/",
"tags": [],
"attributed_to": {
"id": 3,
"fid": "https://mydomain/federation/actors/me",
"url": null,
"creation_date": "2019-11-11T22:01:16.259931Z",
"summary": null,
"preferred_username": "me",
"name": "me",
"last_fetch_date": "2019-11-11T22:01:16.259944Z",
"domain": "mydomain",
"type": "Person",
"manually_approves_followers": false,
"full_username": "me@mydomain"
},
"id": 1293,
"fid": "https://mydomain/federation/music/tracks/8216ac34-d36d-4e00-ad74-b28510cc71e0",
"mbid": "09e92e67-a2eb-4f94-8876-a96c29467889",
"title": "In This World (Push vocal club mix)",
"artist": {
"id": 100,
"fid": "https://mydomain/federation/music/artists/fdfb9cb5-8cb1-4606-a865-61baad1ffad3",
"mbid": "8970d868-0723-483b-a75b-51088913d3d4",
"name": "Moby",
"creation_date": "2019-12-06T19:26:16.468649Z",
"is_local": true
},
"creation_date": "2019-12-06T19:26:19.333402Z",
"is_local": true,
"position": 10,
"disc_number": 2,
"copyright": null,
"license": null
}
}
and one more tracks
call to immediately load the next track - repeated infinitely as the playback progresses...
Work on this has started with fd1741ca53e72efc23aaa0b7beabe43d9e21aa0b.
Great. Will give it a try as soon as it reaches the playstore
The release was just published.
This feature is still hidden away behind the Experiments gate, since testing was not as thorough as I would have liked. It should propagate to the Play Store in a few hours (or more, since Google seems to be quite slow since Covid).
Please also note that, for now, I only consider custom user radios, not the native Funkwhale radios (least played and random). But this should be quite easy to implement.
Do not hesitate to send your feedback.
Juste installed the new version. Seems to work (with a custom radio)! Will test it a bit more in the following days
Thanks for the initial report.
I will start working on native radios right away, so that with any feedback you may have on the current implementation, the feature could go stable by 1.0.18.
Awesome! Was waiting for that one. Thanks for your work @apognu , will test and report back in the coming days ;-)
@dani @Jucgshu Did you have the chance to test this further?
Did you encounter anything strange, not optimized, or maybe crashs?
Tested a bit, without any issue (but not that much, as I mainly use it in my car, and since March, I do not drive a lot ^^)
Every bit of testing is useful. ;)
Hi @apognu . Yes, did some tests. Seems to work ok as for the playing part without issue. Only problem I have is I loose notifications when playing Otter on another device (say the bt audio device from my car). Notifications on the phone app seem stable enough. I do not seem to experience this pb with favorites (only radios).
I've seen you've committed a change to notifications to being explicitly public, so maybe that could fix this.
That's weird that you experience a different behavior between radios and favorites, since this uses the exact same system.
This could be the same bug, but wouldn't hold my breath, if you have no problem outside radios.
This seems stable enough, I'll push those in the next update (with the added candy of native "Random" and "Less listened" radios).
Have to be honest, I've mostly tested radios. Will check again favorites tomorrow.
I just tested, I can play radio without prbl. But why the default radios aren't present ? (eg Your content, Random, Less listened).
The first version only retrieved custom radios. The native radios are now implemented in develop and will be part of the stable release (this weekend, I hope).
Only "random" and "less listened", though. Did not see anything called "your content".
Did some more tests: confirmed pbs on notifications on my bt audio car system with radios, not favorites: titles/artists appear for some secs, then immediately disappear. I'll try to do a short movie to illustrate.
I noticed and fixed a bug yesterday, where radios would make the app crash a few seconds after creating the notification or changing radio track.
It was due to the radio UI being woken up by a signal after the UI was destroyed, so it hit a NPE.
What you just described really looks like this issue. If so, this is fixed in develop.
If you are willig to uninstall your current app, you could install the debug release built from the tip of our develop branch from here to check if the issue is gone.
If it is not, this release includes a way for your get the app logs for the latest crash, that would help me debug it.
Radio support is now stable on Google Play. Please open new issues for any problem you may encounter.
Looks like radios are not supported in Otter yet. It'd be a great improvement (I only use radios, not playlists) :-)