sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.57k stars 112 forks source link

Can't play Web Radio in Jukebox mode: error creating playlist items: find track by id: not found #481

Closed frabnet closed 6 months ago

frabnet commented 6 months ago

Hi everyone, I'm trying to use Gonic in Jukebox mode to play Internet Radio streams locally on the server.

gonic version: v0.16.3

Built with docker-compose.yml:

version: "2.4"
services:
  gonic:
    image: sentriz/gonic:latest
    environment:
      - TZ = Europe/Rome
      - GONIC_JUKEBOX_ENABLED=true
      - GONIC_JUKEBOX_MPV_EXTRA_ARGS='--audio-device=alsa/default:CARD=Set"
      #force the correct audio card if multiple are present, found running mpv --audio-device=help inside the container
    ports:
      - 4747:80
    volumes:
      - ./data:/data # gonic db etc
      - ./music:/music:ro # your music
      - ./podcasts:/podcasts # your podcasts
      - ./playlists:/playlists # your playlists
      - ./cache:/cache # transcode / covers / etc cache dir
    group_add:
      - audio
    devices:
      - /dev/snd:/dev/snd

Added two radio stations on the Gonic web interface:

Using DSub Android Client, local music is played correctly, but when I play Web Radio it doesn't ouput any audio, and following error is logged:

gonic-1  | 2024/03/11 13:51:13 response  200  GET /jukeboxControl?u=admin&s=xxxxxxxxxxxxxxxxxxxxxxxxxx&t=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&v=1.2.0&c=DSub&action=status
gonic-1  | 2024/03/11 13:52:08 response  200  GET /jukeboxControl?u=admin&s=xxxxxxxxxxxxxxxxxxxxxxxxxx&t=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&v=1.2.0&c=DSub&action=status
gonic-1  | 2024/03/11 13:52:13 response  200  GET /jukeboxControl?u=admin&s=xxxxxxxxxxxxxxxxxxxxxxxxxx&t=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&v=1.2.0&c=DSub&action=set
gonic-1  | 2024/03/11 13:52:13 subsonic error code 0: error creating playlist items: find track by id: not found

Things I've tried:

Any clue if this is a Gonic bug or other test to do?

dweymouth commented 6 months ago

Internet radio stations cannot be played in jukebox mode due to a design flaw in the Subsonic API. The jukeboxControl endpoint only allows clients to pass song IDs, and internet radio stations are not a regular song. The solution would be to propose an OpenSubsonic extension that allows radio IDs to be passed to jukeboxControl, and for Gonic as well as the clients to implement the extension.

sentriz commented 6 months ago

@dweymouth the jukebox can set any sort of ID, be it podcast IDs or song IDs or whatever . much like setRating its a bit polymorphic

looks like i just never implemented internet radio IDs where, but now you can jukeboxControl?action=set&id=ir-1

dweymouth commented 6 months ago

https://www.subsonic.org/pages/api.jsp#jukeboxControl

The spec for ID says

ID of song to add to the jukebox playlist.

It's nice that Gonic supports an extended version of the API (now after your fix). And DSub does too I guess. I still think an OpenSubsonic extension is needed though as the API does not guarantee that IDs are unique across media types (a radio station ID could be the same as a song ID for some servers) so clients shouldn't assume they can pass a radio ID to jukeboxControl. When I implement jukebox in Supersonic, I will probably fall back to local playback for radio stations.

dweymouth commented 6 months ago

started https://github.com/opensubsonic/open-subsonic-api/discussions/86