Skip to content
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

Are design docs available? #206

Open
RanTalbott opened this issue Sep 20, 2023 · 4 comments
Open

Are design docs available? #206

RanTalbott opened this issue Sep 20, 2023 · 4 comments

Comments

@RanTalbott
Copy link

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
Copy link
Owner

janbar commented Sep 20, 2023

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:

  • backend/NosonThumbnailer : this module manages all thumbnails from external providers
  • backend/NosonMediaScanner : this module manages tracks and their metadata available on the running device.
  • backend/NosonApp : this is the CORE app module. It provides services/actions the GUI need to control the sonos devices. Also it is statically linked with my lib "noson" (https://github.com/janbar/noson). This lib is pure C/C++ (it doesn't require Qt) and it is used to inter-operate with sonos devices. As example running the CLI (executable noson-cli), you only use this lib, calling basic functions synchronously. Finally this lib is an other bulk of pieces: it implements the upnp client, micro web server, flac encoder/streamer over http, etc.

@RanTalbott
Copy link
Author

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
Copy link
Owner

janbar commented Sep 30, 2023

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}

  • Note that ' or " or + or blank etc must be URL encoded. Finally the IP is the address of the desktop running the noson instance, therefore yours.
    Typing the command "STATUS" will show you the current URL played by the Sonos zone.
  • Note you can try to play the song from your internet browser too: Simply paste the URL to your browser, and it will play the song !

@RanTalbott
Copy link
Author

"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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants