janbar / noson-app

The essential to control music from your SONOS devices on Linux platforms
GNU General Public License v3.0
335 stars 28 forks source link

Are design docs available? #206

Open RanTalbott opened 10 months ago

RanTalbott commented 10 months ago

I'd be interested in working on the problems I've encountered, but not in reverse-engineering the system to do it. Are copies of the design documents available?

janbar commented 10 months ago

As many software this app is not a simple piece of puzzle. There is no design docs, all is in the code itself. So to take the good start, you have to know the app is build using cmake. To design the GUI and all other pieces you should use Qt Creator, then open the CMakeLists.txt with it. Finally you can browse the sources. So first you need to have Qt skills. The graphical GUI is made by the QML engine. All GUI sources are in the folder "gui/controls2_509" for Qt5.9-5.12 or "gui/controls2_515" for Qt>=5.15. The main bootstrap source is "gui/noson.cpp". The app has 3 modular backends compiled as shared libs and loaded by the QML engine:

RanTalbott commented 9 months ago

Is there an API for playing files? I see that noson.cpp registers filestreamer as a broker, but a playurl for "file:///ogg filename" fails. So I assume there must be some other way to invoke it.

I'd like to modify noson.cpp so I can feed it a local filename or list of them, and get it/them played.

janbar commented 9 months ago

The "PLAYURL {URL}" will try to play a file/stream from a remote server. Local URI (file://) has no sense. To do that you have to write the file/stream URL from the noson instance; by default noson listens on port 1400 (or 1401..1409).

Launch the CLI (if you haven't noson already launched, it listen on port 1400)

noson-app --cli

Connect to the Sonos Zone you want to control:

connect Living Room

Then play the file using its URL from noson instance:

playurl http://192.168.2.97:1400/music/track.flac?path=%2fhome%2fjlb%2fMusique%2fEddy%20Mitchell%2fRio%20Grande%2f01%20-%20Y%27a%20pas%20d%27mal%20%c3%a0%20s%27faire%20du%20bien.flac

The form is as follows: http:// {IP} : 1400 / music / track . {media type: flac, mp3, aac, ogg, m4a, m4b) ? path= {the local URI of the song file fully URL ENCODED}

RanTalbott commented 9 months ago

"media type" on URLs doesn't seem to work as expected:

playurl http://192.168.0.11:1400/music/track.ogg?path=%2Fmnt%2Fsdb%2Fran%2Fmusic%2Fogg%2FAndres_Segovia%2FMy_Favorite_Works%2F01-Albeniz_Sevilla.ogg (SONOS)WSResponse: server error (500) (SONOS)Request: invalid response Failed

playurl http://192.168.0.11:1400/music/track.flac?path=%2Fmnt%2Fsdb%2Fran%2Fmusic%2Fogg%2FAndres_Segovia%2FMy_Favorite_Works%2F02-Albeniz_Granada.ogg Succeeded

but nothing plays.

STATUS TransportStatus = ERROR_NO_RESOURCE TransportState = STOPPED AVTransportURI = [http://192.168.0.11:1400/music/track.flac?path=%2Fmnt%2Fsdb%2Fran%2Fmusic%2Fogg%2FAndres_Segovia%2FMy_Favorite_Works%2F02-Albeniz_Granada.ogg] AVTransportTitle = [] CurrentTrack = 1 CurrentTrackDuration = 0:00:00 CurrentTrackURI = [http://192.168.0.11:1400/music/track.flac?path=%2Fmnt%2Fsdb%2Fran%2Fmusic%2Fogg%2FAndres_Segovia%2FMy_Favorite_Works%2F02-Albeniz_Granada.ogg] CurrentTrackTitle = [track.flac?path=/mnt/sdb/ran/music/ogg/Andres_Segovia/My_Favorite_Works/02-Albeniz_Granada.ogg] CurrentTrackAlbum = [] CurrentTrackArtist = [] CurrentCrossfadeMode = 0 CurrentPlayMode = NORMAL CurrentTransportActions = Set, Stop, Pause, Play, X_DLNA_SeekTime, X_DLNA_SeekTrackNr NumberOfTracks = 1 AlarmRunning = 0 AlarmIDRunning = AlarmLoggedStartTime = AlarmState = RemainingSleepTimerDuration =

None of the ogg tag info is there. It appears likely that noson tried to treat it as a flac, and just gave up.

PLAY Succeeded

But nothing happens.

I converted a few tracks to flac, and they seemed to sorta work. But the tags got lost in the conversion, so the status output sucks. And it's not feasible to convert my collection, anyway.

Is it possible to create queues and playlists with the CLI? And to make ogg work?

Thanks,

Ran