Comments (16)
@svrooij: I did try:
- track: ok
- album: ok
- playlist: ok
artistTopTrack did not work (tried enque and settransporturi). I'll investigate that next year ;)
Thanks a lot!
from sonos2mqtt.
@dirstel playing songs from music services need MetaData
the main sonos library has a metadata helper.
It guesses the metadata based om the track uri. Specifically this method needs to be extended. Check out the Spotify code to find out what you need, the needed values are probably in the metadata of the status info in mqtt.
you can send a PR for support for the other music services. If you cannot get it to work, join us on discord and I might be able to help out with changing the code. (Since I donβt have an account for all those services).
from sonos2mqtt.
Thanks for quick response, showing me I'm not completly nuts :)
I'll try to dig in deeper in this topic. Having a quick glance at the methode you pointed me to, gives me some hint about amazon my work. so I'll try that first (to give my little ones quick access). but I definatly keep looking after deezer.
from sonos2mqtt.
The regular play this commands do automatic metadata generation. If you want to send the metadata yourself you can try to use the advanced command which allows you to also set the metadata, like sending the following to sonos/uuid_of_speaker/control
:
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.SetAVTransportURI",
"val": {
"InstanceID": 0,
"CurrentURI": "your-track-uri",
"CurrentURIMetaData": {
"UpnpClass": "", // this is important
"CdUdn": "", // this is needed sometimes
"ItemId": "", // this is needed sometimes for display purposes
"ParentId": "", // this is needed sometimes to allow browse back up
}
}
}
}
If you find the correct value for some track uri, you can either create a PR on the node-sonos-ts library or send them here and I'll add them. (For me it's hard to test since I don't have an account.)
from sonos2mqtt.
I figured out, how to load a Sonos-Playlist:
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.AddURIToQueue",
"val": {
"InstanceID": 0,
"DesiredFirstTrackNumberEnqueued": 0,
"EnqueueAsNext": true,
"EnqueuedURI":"file:///jffs/settings/savedqueues.rsq#7",
"EnqueuedURIMetaData": {
"UpnpClass": "object.container.playlistContainer",
"ItemId": "SQ:7",
"CdUdn": "RINCON_AssociatedZPUDN"
}
}
}
}
The Playlist is identified by a Number (in the example 7) which is used two times (EnqueuedURI and ItemId)
So the metadata-helper could be called with sth. like "sonos:playlist:" to load a given playlist.
from sonos2mqtt.
Loading a Deezer Album with ID 169734362
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.AddURIToQueue",
"val": {
"InstanceID": 0,
"DesiredFirstTrackNumberEnqueued": 0,
"EnqueueAsNext": true,
"EnqueuedURI":"x-rincon-cpcontainer:1004006calbum-169734362?sid=2&flags=108&sn=23",
"EnqueuedURIMetaData": {
"UpnpClass": "object.container.album.musicAlbum.#HERO",
"ItemId": "1004006calbum-169734362",
"CdUdn": "SA_RINCON519_X_#Svc519-0-Token"
}
}
}
}
Verified with two different albums.
from sonos2mqtt.
Loading a Deezer Playlist with ID 1371651955
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.AddURIToQueue",
"val": {
"InstanceID": 0,
"DesiredFirstTrackNumberEnqueued": 0,
"EnqueueAsNext": true,
"EnqueuedURI":"x-rincon-cpcontainer:1006006cplaylist_spotify%3aplaylist-1371651955?sid=2&flags=108&sn=23",
"EnqueuedURIMetaData": {
"UpnpClass": "object.container.playlistContainer.#DEFAULT",
"ItemId": "1006006cplaylist_spotify%3aplaylist-1371651955",
"CdUdn": "SA_RINCON519_X_#Svc519-0-Token"
}
}
}
}
Verified with two different and an additional private playlist.
from sonos2mqtt.
Loading Deezer artist top tracks with ID 6049784
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.AddURIToQueue",
"val": {
"InstanceID": 0,
"DesiredFirstTrackNumberEnqueued": 0,
"EnqueueAsNext": true,
"EnqueuedURI":"x-rincon-cpcontainer:10fe206ctracks-artist-6049784?sid=2&flags=8300&sn=23",
"EnqueuedURIMetaData": {
"UpnpClass": "object.container.#DEFAULT",
"ItemId": "10fe206ctracks-artist-6049784",
"CdUdn": "SA_RINCON519_X_#Svc519-0-Token"
}
}
}
}
Verified with two different artists.
from sonos2mqtt.
artist radio is not enqued, so this one needs some more investigation.
from sonos2mqtt.
artist radio is not enqued, so this one needs some more investigation.
That is probably a stream that needs to be played with SetTransport.... Because streams cannot be added to a queue
from sonos2mqtt.
queing a single track from deezer by id 1121931512
{
"command": "adv-command",
"input": {
"cmd": "AVTransportService.AddURIToQueue",
"val": {
"InstanceID": 0,
"DesiredFirstTrackNumberEnqueued": 0,
"EnqueueAsNext": true,
"EnqueuedURI":"x-sonos-http:tr%3a1121931512.mp3?sid=2&flags=8224&sn=23",
"EnqueuedURIMetaData": {
"UpnpClass": "object.item.audioItem.musicTrack.#DEFAULT",
"ItemId": "10032020tr%3a1121931512",
"CdUdn": "SA_RINCON519_X_#Svc519-0-Token"
}
}
}
}
Verified with two different tracks.
from sonos2mqtt.
That is probably a stream that needs to be played with SetTransport.... Because streams cannot be added to a queue
seems so, the posted xml was quite large and I'd like to concentrate on the simple and simmilar actions :)
from sonos2mqtt.
Wrote this code based on your spotify code. It is not tested, as I'm "just" using a docker-image and it is hard for me to develop. But as it is "just" some string operations, it may work:
// Deezer
if (parts.length === 3 && parts[0] === 'deezer') {
// const deezerUri = trackUri.replace(/:/g, '%3a');
const deezerUri = parts[2];
track.Title = '';
track.CdUdn = `SA_RINCON${deezerRegion}_X_#Svc${deezerRegion}-0-Token`; // Germany: SA_RINCON519_X_#Svc519-0-Token
if (parts[1] === 'track') {
track.TrackUri = `x-sonos-http:tr%3a${deezerUri}.mp3?sid=2&flags=8224&sn=23`;
track.ItemId = `10032020tr%3a${deezerUri}`;
// track.ParentId = ``; // ToDo: Parent navigation
track.UpnpClass = 'object.item.audioItem.musicTrack.#DEFAULT';
return track;
}
if (parts[1] === 'album') {
track.TrackUri = `x-rincon-cpcontainer:1004006calbum-${deezerUri}?sid=2&flags=108&sn=23`;
track.ItemId = `1004006calbum-${deezerUri}`;
// track.ParentId = ``; // ToDo: Parent navigation
track.UpnpClass = 'object.container.album.musicAlbum.#HERO';
return track;
}
// if (parts[1] === 'artistRadio') {
// track.TrackUri = `x-sonosapi-radio:${deezerUri}?sid=9&flags=8300&sn=7`;
// track.ItemId = `100c206c${deezerUri}`;
// track.Title = 'Artist radio';
// track.UpnpClass = 'object.item.audioItem.audioBroadcast.#artistRadio';
// track.ParentId = `10052064${deezerUri.replace('artistRadio', 'artist')}`;
// return track;
// }
if (parts[1] === 'artistTopTracks') {
track.TrackUri = `x-rincon-cpcontainer:10fe206ctracks-artist-{deezerUri}?sid=2&flags=8300&sn=23
`;
track.ItemId = `tracks-artist-{deezerUri}`;
// track.ParentId = ``; // ToDo: Parent navigation
track.UpnpClass = 'object.container.#DEFAULT';
return track;
}
if (parts[1] === 'playlist') {
track.TrackUri = `x-rincon-cpcontainer:1006006cplaylist_spotify%3aplaylist-${deezerUri}?sid=2&flags=108&sn=23`;
track.ItemId = `1006006cplaylist_spotify%3aplaylist-${deezerUri}`;
// track.Title = 'Spotify playlist';
// track.ParentId = ``; // ToDo: Parent navigation
track.UpnpClass = 'object.container.playlistContainer.#DEFAULT';
return track;
}
}
from sonos2mqtt.
π This issue has been resolved in version 3.1.1-beta.6 π
The release is available on:
Your semantic-release bot π¦π
from sonos2mqtt.
@dirstel this automatic comment means you can try out the new functionality when you install the beta
(svrooij/sonos2mqtt:beta
) instead of the latest
and you can try it out.
from sonos2mqtt.
π This issue has been resolved in version 3.1.2 π
The release is available on:
Your semantic-release bot π¦π
from sonos2mqtt.
Related Issues (20)
- No status changes HOT 3
- Problem with docker image HOT 6
- Sonos Favorites Question HOT 9
- [Feature] Notification before TTS HOT 5
- [Feature] Support for audio formats on HDMI input HOT 4
- Don't set position to `NOT_IMPLEMENTED` HOT 1
- Not all Sonos players are available in MQTT HOT 2
- Configuration in Synology Docker Container HOT 2
- Docker container is very long to stop HOT 2
- bug: SONOS2MQTT_FRIENDLYNAMES env var doesn't work HOT 3
- Randomize AddToQueue HOT 1
- Frage: Ist es mΓΆglich den amazon:effect zu nutzen? HOT 2
- Support for certificates HOT 1
- favlist Readig empty after getting Sonos Favorites HOT 1
- Add loudness state to player state HOT 1
- Sonos2Mqtt Unraid validate distrinct = true HOT 4
- sonos2mqtt stops after reboot HOT 2
- notify-function does not work properly
- How to start playing a Sonos Radio, might be specific issue with "VRT Radio 1" HOT 2
- Group volume and balance HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonos2mqtt.