06.09.2016, 13:39 (This post was last modified: 06.09.2016, 13:39 by zoltan.)
(05.03.2016, 13:01)Erwin van der Zwart Wrote: Try this script, the explanation is added into the script. Its still in development and the only thing i need to add is getting albumart URI for streaming content.
Hello Erwin,
I'm getting errors like this,when adjusting volume:
Code:
Line 463: attempt to call field 'tonumber' (a nil value)
Line 485: attempt to call field 'tonumber' (a nil value)
Seems that the volume variable is somehow cleared after FOR loop.
The volume feedback is correct. Start/stop is working, prev/next didn't tried yet.
Using the latest RC firmware (20160714). Copy/paste attempted with chrome, firefox, file download - then open with notepad, notepad++, same behaviour.
When removing lmcore in a different script, the function inttohex and hextoint is not recognised. Gives me errors. Can´t find a reference to these functions anywhere. Could you elaborate further?
Hello, I'm trying it into a HomeLynk and works all fine within AlbumArt. The Album Art scrip creates a html image but all the time it appears like a NO ALBUM ART image, I can meke something to arrange this? Thank you veruy much.
The Script that I use is the Script that you upload to trhis forum post, the version is 1.1
The URL album art that I can see inside 1/1/18 adress is this, for example:
example 1 (tunein Radio) :x-rincon-mp3radio://streaming3.radiocat.net/
example 2 (Apple Music Album) /getaa?s=1&u=x-sonos-http%3asong%253a639380945.mp4%3fsid%3d204%26flags%3d8224%26sn%3d1
I think this version does not support streaming album art, as i already wrote in the post 09-03-2016:
Albumart URL should work now with local content, i'm still searching for a good solution for streaming content album art, but that's a hard one to tackle, when i solved it i let you know.
We created a app for Sonos that is still in development (we have it running on several sites for beta testing), in this app i solved the issue (puzzle) with streaming art.
Or you wait for the app or i must prepare a new version script for you..
(23.11.2015, 12:49)admin Wrote: We don't have any Sonos devices so what we can help with is limited.
You can use Node.js library with debug enabled to monitor which kind of requests are being sent and then implement the same thing in LM.
Some hints for your case:
- To find your playlist id (SQ:1 or similar), you need to get a list of all playlists and find it there
- Use RemoveAllTracksFromQueue to empty current queue
- Use SetPlayMode to set repeat / shuffle
- You don't have to add tracks one by one, you can load the whole playlist (stored queue) in one call
Yes.. it works.
I attached a little bit changed upnpavcmd function.
And two new functions:
Code:
-- find all playlist
function getPlaylists(ip, port)
cBrowse = '<ObjectID>SQ:</ObjectID>' ..
'<BrowseFlag>BrowseDirectChildren</BrowseFlag>' ..
'<Filter>*</Filter>' ..
'<StartingIndex>0</StartingIndex>' ..
'<RequestedCount>25</RequestedCount>' ..
'<SortCriteria>*</SortCriteria>'
res,err = upnpavcmd(ip, port, 'Browse', cBrowse)
return res,err
end
-- add saved queue (playlist) to queue
function qPlaylist(pId)
uriprm = '<EnqueuedURI>file:///jffs/settings/savedqueues.rsq#'..pId..'</EnqueuedURI>' ..
'<EnqueuedURIMetaData></EnqueuedURIMetaData>' ..
'<DesiredFirstTrackNumberEnqueued>0</DesiredFirstTrackNumberEnqueued>' ..
'<EnqueueAsNext>1</EnqueueAsNext>'
return uriprm
end
-- find all playlist (run once and note playlist id)
res,err = getPlaylists(ip, 1400)
log(res)
And then you can use:
Code:
-- clear current queue
upnpavcmd(ip, 1400, 'RemoveAllTracksFromQueue')
-- add playlist to queue
upnpavcmd(ip, 1400, 'AddURIToQueue', qPlaylist(2)) -- add the playlist id here
-- play
uri_queue = "x-rincon-queue:RINCON_B8E937A06A3E01400#0" -- add the right URI for the queue
upnpavcmd(ip, 1400, 'SetAVTransportURI', '<CurrentURI>'..uri_queue..'</CurrentURI><CurrentURIMetaData/>')
upnpavcmd(ip, 1400, 'Play', '<Speed>1</Speed>')
Hi Guy,
how can i find the right URI?
uri_queue = "x-rincon-queue:RINCON_<my macadress?>" -- add the right URI for the queue
(23.11.2015, 12:49)admin Wrote: We don't have any Sonos devices so what we can help with is limited.
You can use Node.js library with debug enabled to monitor which kind of requests are being sent and then implement the same thing in LM.
Some hints for your case:
- To find your playlist id (SQ:1 or similar), you need to get a list of all playlists and find it there
- Use RemoveAllTracksFromQueue to empty current queue
- Use SetPlayMode to set repeat / shuffle
- You don't have to add tracks one by one, you can load the whole playlist (stored queue) in one call
Yes.. it works.
I attached a little bit changed upnpavcmd function.
And two new functions:
Code:
-- find all playlist
function getPlaylists(ip, port)
cBrowse = '<ObjectID>SQ:</ObjectID>' ..
'<BrowseFlag>BrowseDirectChildren</BrowseFlag>' ..
'<Filter>*</Filter>' ..
'<StartingIndex>0</StartingIndex>' ..
'<RequestedCount>25</RequestedCount>' ..
'<SortCriteria>*</SortCriteria>'
res,err = upnpavcmd(ip, port, 'Browse', cBrowse)
return res,err
end
-- add saved queue (playlist) to queue
function qPlaylist(pId)
uriprm = '<EnqueuedURI>file:///jffs/settings/savedqueues.rsq#'..pId..'</EnqueuedURI>' ..
'<EnqueuedURIMetaData></EnqueuedURIMetaData>' ..
'<DesiredFirstTrackNumberEnqueued>0</DesiredFirstTrackNumberEnqueued>' ..
'<EnqueueAsNext>1</EnqueueAsNext>'
return uriprm
end
-- find all playlist (run once and note playlist id)
res,err = getPlaylists(ip, 1400)
log(res)
And then you can use:
Code:
-- clear current queue
upnpavcmd(ip, 1400, 'RemoveAllTracksFromQueue')
-- add playlist to queue
upnpavcmd(ip, 1400, 'AddURIToQueue', qPlaylist(2)) -- add the playlist id here
-- play
uri_queue = "x-rincon-queue:RINCON_B8E937A06A3E01400#0" -- add the right URI for the queue
upnpavcmd(ip, 1400, 'SetAVTransportURI', '<CurrentURI>'..uri_queue..'</CurrentURI><CurrentURIMetaData/>')
upnpavcmd(ip, 1400, 'Play', '<Speed>1</Speed>')
Hi,
one question. Unfortunately I get an error message at the function: getPlaylists()
Error message:
Code:
string: HTTP/1.1 500 Internal Server Error
CONTENT-LENGTH: 347
CONTENT-TYPE: text/xml; charset="utf-8"
EXT:
Server: Linux UPnP/1.0 Sonos/48.2-61220 (ZPS14)
Connection: close
and when I execute the command with various IDs and look in the app to see which playlist the ID could be, the playlists are somehow mixed, although I of course take them all out of the queue first.
-- add playlist to queue
upnpavcmd(ip, 1400, 'AddURIToQueue', qPlaylist(2)) --
I can control unique playlists. I don't understand the problem.
Thanks for your reply. What do you mean, have you try the sonos app from LM appstore?? I installed it, yes. But how do I get the corresponding playlists?
That's a pity when code expires.
Then I can never implement and sell the LM for customers?
As for outdated code I was referring to Sonos UPnP support which can change from version to version. Changes that break backward compatibility in LM happen rarely.