Calling Sonos users

General HouseBot discussion. Any issues that don't fit into any of the other topics belong here.
Post Reply
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Calling Sonos users

Post by Osler »

Couch Potato said he had one and Richard said he could borrow one...

Attached is a .hbx file for control of a single sonos zone. It has a theme (still in progress), a single script device which encapsulates the zone, the master script for the zone, and a script to obtain the unique device name (UDN) of all of your sonos zones.

Full transport and rendering control is provided. The ability to browse all media files and add said files to a queue is provided. Additional functions will be added to better mimic the Sonos handheld controller with future script updates.

You will need to download my latest .wsc components seperately. I will post those shortly.

EDIT:

The files below are the latest files available. This zip file includes all the components, scripts, and import files needed. In addition, directions for installing are also provided.

03/08/2008: Files updated. Help document does not reflect changes that have been made. You will need to add an additional property called ZPScriptInterval to your device and set it to a value >=500. This is the frequency with which the script executes in milliseconds. The Single Device Import.hbx file reflects this new property; however, the theme import does not.

10/16/2008: Newest files uploaded. Help document is up to date. This fixes the issue of random crashes due to a change in the .wsc to use asynchronous find. Connection / Disconnection detection is more robust and the script is extremely stable at this point.

02/01/2009: Files updated. Help document is up to date. The ability to browse the available media has been enhanced and the use of the power scroll feature built into the ZonePlayer can now be used. In addition, the ability to force the script to resubscribe/reconnect to the ZonePlayer at a user definable interval has been included. This should be used in situations of network instability. Also, a property has been added that keeps track of all other ZonePlayers that are currently linked to the zone the script is associated with (i.e., slave zones). Please see the help for more information. New properties are as follows:
ZPBrowsePercent
ZPBrowseReturn
ZPSearchType
ZPSearchString
ZPForcedResubscription
ZPResubscriptioninterval
ZPLinkedZones

04/14/2009
Simple command line tool called ZPCMD added. You will need to download both .zip files to get the command line tool to function.

04/19/2009
SonosWatcher.exe added. You will need to download both SonosWatcher.zip and the HouseBot ZonePlayer Device Files_[date].zip.

05/01/2009
ZonePlayer script updated to 2.0.4a. This script now recognizes when a line-in source is specified via ZPPlayNowURI in the form x-rincon-stream:RINCON_XXXXXXXXXXXX. Once I have added the code to take a snapshot of the ZP settings prior to initiating a line-in source, I will upload version 2.0.4. In addition, this files includes the new version of the .wsc that has the SeekPosition function. Though not used currently by the script, it will be needed with the next version.

Osler
Attachments
HouseBot ZonePlayer Device Files_05012009.zip
(1.64 MiB) Downloaded 4063 times
SonosWatcher.zip
(8.25 KiB) Downloaded 1692 times
ZPCMD.zip
(6.18 KiB) Downloaded 2539 times
Last edited by Osler on Fri May 01, 2009 10:59 am, edited 12 times in total.
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

.wsc files attached
Last edited by Osler on Mon Dec 03, 2007 12:25 am, edited 1 time in total.
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Screenshots

Post by Osler »

Screenshot of panel with media library that is browseable in the left pane. The first row of buttons at the bottom of the pane allow you to move through the library. The second row of buttons allow you to add tracks to the queue in 1 of 4 ways: 1) Add - add to the end of the queue; 2) Now - add it to the queue and play it now; 3) Next - add it to the queue such that it is positioned within the queue to play next 4) ClearAdd - clear the queue and then add the selected track.

The buttons beneath the queue (right pane) allow you to manipulate songs within the queue. You can select a track in the queue and play it now or play it next. You can remove a track from the queue. You can clear the queue. The currently playing song is highlighted in the queue with the select bar. In addition, the track number of the currently playing song is prefixed with a "dot" as well.

Second shot shows the menu pane drilled down to track level (using Genre -> Childrens Music -> Baby Einstein in this case).

Most recent script, wsc, and .hbx will be uploaded upon request.

Osler
Attachments
Sonos_Screenshot_MainMenu.jpg
Sonos_Screenshot_MainMenu.jpg (34.12 KiB) Viewed 118814 times
Sonos_Screenshot_Drilled.jpg
Sonos_Screenshot_Drilled.jpg (42.64 KiB) Viewed 118813 times
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Hi-Res shot
Attachments
Sonos_Screenshot11.jpg
Sonos_Screenshot11.jpg (284.61 KiB) Viewed 118820 times
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Just seen this... looks great :-)

Everything seems to be working, please do keep posting any updated scripts - and the theme graphics will be great to start to play with too.

Cheers Kevin
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Ok - I've been playing a little now and I have three zones of Sonos setup within HouseBot. It all seems to work really nicely . Except I left it running overnight last night and this morning HouseBot had crashed and was showing 140MB of memory usage . So I started it up again this morning and left it and the memory usage is slowly rising from around 20MB to 40MB once I use remotes and now at 70MB. Some purging does occur to reduce this but the trend is upwards. Is it possible that there are memory issues either with the script invocation mechanism or the code itself ?

I have three scripts running and I have setup a 'repeat all' loop on my tracks, different in each zone, to get constant updates and I'll see what state we're in tomorrow. BTW These devices are the only ones I have in HB currently.

Just as an aside. Now we have 'on demand' feature in v2.5 for people outside the US with Napster (great job Sonos) it would be such a nice feature to have a script ability to recover artist/album info from Napsters DB - and to play a song 'on demand' by supplying artist, album / trackname. A 1 million track JukeBox... :D Pretty sure however that Sonos will have made this very difficult (non UPnP) although their Desktop Controller can do it.

Kevin

<EDIT> :oops: Absolutely typical - immediately I posted this message I saw a huge drop in HouseBots memory from 50MB back to 28MB. Last night I was running a couple of other plugins - including one new 'beta' test version which could very well have been the culprit . Let me see where we are at tomorrow - all may be well here still Kevin
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Kevin:

Thanks for testing this out. I have yet to add my other two zones into the mix, as I am still debugging little-by-little. I have had the continuously running script up for days at a time on one zone without any issues (other than a power outage and my router going on the fritz....which I really hope aren't related to my code). I am in the process of optimizing the code at this point. Please find attached a new .hbx import. This has the latest script (optimized, with the new features depicted in the screenshots above for additions to queue and queue management) as well as the latest ZonePlayer.wsc file to replace the current one (simply copy it to where the current one is, no need to re-register). This new script fixes some issues with the queue updated twice in some instances, creating a flicker effect on the screen as well.

If you are interested in adding Napster, Rhapsody, etc. then I need to enlist your help as I don't use these services. If you are interested in providing me with some info, then download the Intel UPnP Tools (or let me know and I can post the necessary tools).

My next step is adding album art to the mix. The album art files can be downloaded from the ZonePlayer....I just haven't quite figured out how to do it yet.

Suggestions on interface layout would also be appreciated.

Osler
Last edited by Osler on Mon Dec 03, 2007 12:24 am, edited 1 time in total.
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

I have installed the new versions and all seems well :D Overnight HouseBot had grown to 70MB but not crashed so ATM I am apportioning blame on the other plugin . I suspect a garbage collection when it occurs will reduce this anyway. I'll keep an eye on this.

Re Interface layout... I am quite new to HouseBot and I suspect some comments might be a reflection on limitations of the UI capabilities.

For example I expected a click, or more possibly a double click on the left hand pane eg Albums to drill down for me , rather than the 'back' 'forward' buttons. I found the latter a bit non intuitive.
I've no idea if the above can be achieved within HB though. I assume hierarchically expanding displays are out. A scroll bar in the LHS pane would be nice too as would being able to hit a key on the keyboard to jump to that area of a long list, although not so useful on PPC.

Also just cosmetically the '.' before the currently playing track I think would be nicer as a < or something after the track number , or even better inclusion of a space before so that the track numbers remain aligned vertically, even when 2 or 3 digits . or perhaps a different font or boldening/weight for current track.

1 Track One Artist Album
2 < Track Two Artist Album
or better
1 Track One Artist Album
> 2 Track Two Artist Album
or the bold option...
The above don't show well here due to the proportional font / space removal but you get the idea..

I found I had quite a bit of editing to accomplish within the theme but this may be just me - and there's a global find/replace available for my device names. Again HB not you. I just need to get more familiar with it. I played with HB back in Meedio days but due to appalling communication problems with Meedio I ditched it. I'm back now it's in its original hands and about to promote a new plugin written by a friend - that has been on hold for a while.

A quick Q - do I have to recreate my devices from your new imported one each time or are my existing devices OK - with the script pointer change ?

On Napster etc - I do have the UPnP tools (Intel & MST NetMonitor) but UPnP is brank new to me and I am just a hobbyist VB/C programmer. If that's enough for you to work with then great ,and I'll help all I can. It is possible to set up a 30 day trial with Napster on Sonos though too - which might better preserve your sanity ;-) I have Rhapsody, Napster and Pandora enabled.

Cheers Kevin
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Double click to drill can be done...you just need to change the double click property of the list control to perform the property substitution accomplished by the select button I have at the bottom of the left panel. Open the theme and click on the left pane list control. In the double click property change, make it match the property change for the select button. You will still need to use back, pg down, and pg up, though (pg up and down are due to limitations on the size of a list that can be imported into HB...though this may not be an issue for you). I have it set up this way because I use it with a touchscreen and double click is a bit tricky with fingers. Also, you can change the number of items displayed at a time by opening the script and scrolling down to the BrowseMedia sub (last sub, methinks). The item to change is commented...currently set to 14 I believe. Scrollbar will appear automatically if the list size exceeds the display area. If you set this value to "0" then all items will be returned...if HB croaks when you do this, you have exceeded the list size limit (recently increased by Scott so it may work for you) and will need to use page up and down.

You can use the existing device, just make sure you check the beggining of the script to make sure your current device has all of the properties the script is expecting. If not, create the property and add it to the device then point it to the new script.

Yes, there are some issues with the queue display that need to be fixed for cosmetic reasons. I am in the process of doing this currently. I can't bold a particular item in the list...but I could make it all caps or add the carat as you suggested.
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Getting there... need to familiarise myself with HB some more...

One thing - when playing internet radio stations that display station name plus current track / artist information etc on the handheld controller - it isn't being picked up as a Sonos property in HB anywhere .. although it is from Napster, Rhapsody and Pandora sources. The latter all segment this into the appropriate fields - I suspect that radio stations output more of a long compound information field to display.

Kevin
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Yes...the internet radio thing is an issue I haven't fixed yet. What is being displayed is "track" information....it's just that with internet radio that information is not necessarily what you expect it to be. I need to add the logic to pull the friendly name for the radio station when internet radio is selected....just haven't gotten around to it yet. Currently what is displayed is variable....but typically the html address of the station. :oops:

Another thing to note is that "All" doesn't work for library selection either. This also is a logic problem that I just need to find the time to fix. Hopefully I can get to these things this weekend.

There also appears to be an issue with the list control truncating items unnecessarily in the queue (the "..."). I have attempted to work around this by standardizing the length of items displayed but it needs more attention.

If you have a line-in source, please test this for me as I don't have a ZP with line-in. The code should provide access to select this from the menu...just don't know if it works or not.

From here on out, I will only post the script and provide you with info on any necessary property additions.

Like you, I only do this as a hobby and I don't do C+ so you are way ahead of me :D

Would you want a boolean value for a library reindex from within HB?

Osler
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Updated script:

1) Fixed display of radio station info.

2) Fixed queue display.

3) Select "All" is working.

4) Increased the number of menu items displayed to 100 at a time.

5) Fixed "Play Next" for queue manipulation (queue wasn't updating).

You will need both the updated script and .wsc file (all in .zip file).

Osler
Last edited by Osler on Mon Dec 03, 2007 12:24 am, edited 1 time in total.
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Nice..the radio updates work well , and I've added the extra field to the theme (album I think) .

What I do find is that once you're playing a radio station you can't regain control from the theme, you have to back out from the hand controller.

Kevin
Osler
HouseBot Guru
Posts: 742
Joined: Fri Feb 03, 2006 11:18 pm

Post by Osler »

Hmmm...I have it set such that when internet radio is played from housebot, the queue is cleared. If something is added to the queue (where queue size = 0) while internet radio is playing the AV Transport should change from the radio station to the queue. If you have set radio to play from the handheld conroller this may not work as expected (queue isn't cleared (size <> 0) and the logic fails).

As a work-around for now, if this happens....hit clear in the queue pane. This will clear the queue as well as set the AV Transport to nothing (i.e., clear the radio station). Once this is done, add songs as you like to the queue and it should work as expected. Not intuitive...but hey. I did it this way because it always annoyed me that there was no way to clear the AV Transport from the controller once you played internet radio. You had to use "Play Now" followed by "Clear Queue" to completely clear the transport. I'm a bit anal and like to clear the AV Transport when I stop using Sonos.

I will see about getting the housebot controller to play a bit better with the sonos handheld controller. I was noticing some things today as I was installing an additional zone (using the handheld controller) that need to be addressed.

As an aside, I am going to demo Napster and see if I can get it to work. This is probably the more important service for you as a UK user...yes?

Osler
CouchPotatoe
Senior Member
Posts: 103
Joined: Sun Jul 31, 2005 2:43 pm
Location: Yorkshire UK

Post by CouchPotatoe »

Osler wrote: As an aside, I am going to demo Napster and see if I can get it to work. This is probably the more important service for you as a UK user...yes?
Yes, indeed it's our only 'legal' one . I'm not sure where you're based but it maybe that you have to be inventive (virtual travel) to get the Napster trial to work for you.

BTW I find this ability to create a huge library for 'on demand' is a very attractive proposition for a reasonable outlay - costs around 1 CD per month. It has totally changed the way I listen. The station/mixes work really well to introduce you to new artists. Still buy some CD's as it's the only way to get high quality of course. (FLAC/WAV)

At some stage you said it may be possible to get the album art too - that will be interesting - do you know if you will be able to provide a path to the image file for display by other programs ? I'm not sure what would happen for embedded artwork tags/data ?

Reminds me.. I need to look at the script component to see if I can access the path to the current playing track too which would be useful.

Kevin
Post Reply