Ubuntu: How can I install Sonos on Ubuntu



Question:

How can I install the Sonos controller on Ubuntu and access the music library ?


Solution:1

Here is a tutorial to install Sonos on ubuntu using Wine, PlayonLinux and Samba (for the music library).

Install the Sonos Controller

The first thing to do is to install Wine and PlayonLinux so your computer can use Windows software. Open a terminal (ctrl+alt+t) and copy/paste the following line by line.

sudo apt-get install wine  sudo apt-get install playonlinux  

Then download the latest version of the Sonos Controller for Windows.

Start PlayonLinux and click on "install a program". A new window opens. Select "Install a non listed program" (at the bottom). If it is the first time you use PlayonLinux you may not have this option. Then close the window and re-open it.

Select "install in a new virtual drive". Name the drive however you want (but "sonos" seems a logical choice). Untick the boxes that may be ticked and choose "32-bit installation". Browse to the sonos controller you downloaded and click "next".

The installer starts. Install the software (leave everything as it is) but DO NOT run the application after setup. At the end of the installation PlayonLinux proposes you to create shortcuts. Create one for the sonos.exe file. You now have a Sonos launcher on your desktop. You can change its icon to a Sonos icon and drag it to the launcher.

Sonos is now listed in PlayonLinux. Right click on it and select "configure wine". In "application" make sure "Windows XP" is selected.

In PlayonLinux select "Sonos" and click on "configure" (on the right side of the window). A window opens. Go to "install components", look for "dotnet40" and install it.

Start the application. Click "next" and then choose "don't configure windows firewall". Your Sonos controller is now installed and ready to work.

Make the Sonos Controller fullscreen

If double clicking on the menu bar of the Sonos controller works for you, skip this part of the tutorial.

If double clicking on the menu bar freezes your controller follow these steps to make your controller fullscreen.

Make sure Sonos is not working. Open PlayonLinux, right click on Sonos and select "configure wine". Go to the "graphics" tab and select "emulate a virtual desktop". Increase the resolution to 1000x800. Close Wine.

Start Sonos. The application will start in a virtual desktop. It is ugly but we will get rid of it. Double click on the menu bar to make Sonos fullscreen in the virtual desktop. Close Sonos.

Go back to PlayonLinux, right click, "configure wine". Untick "emulate a virtual desktop". Close Wine and PlayonLinux. Start Sonos. It should be fullscreen.

If your controller is still not fullscreen, repeat the operation but increase the resolution of the virtual desktop to its maximum (similar to your own resolution).

Access the music library

To access your music library is a bit more complicated but still doable. To do so we will use Samba and create a network share.

The first thing to do is to install Samba.

sudo apt-get update  sudo apt-get install samba  

Create a username and a password for Samba (they can be different or similar to your usual username and password). In the following line replace username by the username of your choice.

sudo smbpasswd -a username  

You will then be asked to create a password.

For the following I suppose the folder you wish to share and to set as your music library is your music folder (/home/username/Music). If not change as needed.

Edit the samba configuration file

sudo gedit /etc/samba/smb.conf  

Once the file is open add at the very end

[Folder Name]  path = /home/username/Music  valid users = username  read only = n  

Name the folder whatever you want. Change the path to set it with your username. The username in "valid users" should be the username you set earlier for samba. Save the changes and close gedit.

You now need to restart samba

sudo service smbd restart  

Your music folder is ready to be shared.

Start Sonos. Click on "manage" and open "music library settings". Click "add" and choose "on a networked device such as a network attached storage (NAS) drive".

Write the path this way:

//computer's name/folder name  

So if my computer is called "Poulpe" and I named my folder "Music" in the samba configuration file, my network will be:

//Poulpe/Music  

Sonos asks you a username and a password. Give the one you set at the beggining in samba.

You Sonos is now working, fullscreen, and you can access your music library.

Thanks

It would have been impossible for me to use Sonos on my computer, and to write this tutorial, without this article on Michael's blog, this tutorial on help.ubuntu and a few posts on the sonos support forum from a guy named Keith.

English in not my mother tongue. If there is mistakes or if something could be better explained please tell me, I'd be thankful.


Solution:2

Native applications to control Sonos devices have existed for a few years.

See mine at: https://launchpad.net/~jlbarriere68/+archive/ubuntu/noson-app

The source is hosted at https://github.com/janbar/noson-app .

screenshots: https://uappexplorer.com/app/noson.janbar


Solution:3

I use a free java client utility, so this should do the job. Janos

I got the newest controller not working with wine and also not with play on linux. But I can do most operations with that utility ; )


Solution:4

If you use Spotify - the Spotify native Linux client can now control your Sonos system. One of the best features they've ever added IMO..

You can find out how install the Spotify client on Ubuntu here:


Solution:5

For some time i use this browser based controller now.

simple but works

sudo apt install nodejs-legacy  

just extract the contents of sonos-browser.tar.gz to /home/yourusername/bin/.

run the sonos.sh (or just the command in there)

run the sonos.html inside the sonos folder (bookmark it)

it gives access to favorites and controls (i did my initial setup via android sonos controller)

P.S. you might need to change IP to your SonoS IP, but i guess it should work without any changes too.


Solution:6

For programmers I found it really comfortable to use http://python-soco.com with ipython , example:

import soco  s=soco.SoCo('1.2.3.4')  s.clear_queue()  with open('playlist.m3u', 'r') as f:    for l in f:     s.add_uri_to_queue('http://192.168.1.5:8080/MusicShared/'+l.rstrip('\n'))  s.play _from_queue(0)  

longer example from https://gist.github.com/gwpl/92ab540016bf43359654d5b0f013b1ec :

#!/usr/bin/env python3  import sys  import soco    # Take ip from `socos list` or soco.discover()  ip='192.168.1.106'  print('Playing on Speaker with ip='+ip)  s=soco.SoCo(ip)  print(' get_speaker_info()='+str(s.get_speaker_info()))    s.clear_queue()  for m3u_filename in sys.argv[2:]:      print('Adding m3u...'+m3u_filename)      with open(m3u_filename, 'r') as m3u_filehandler:          for line in m3u_filehandler:              filename = line.rstrip('\n')              print('..."'+filename+'"')              s.add_uri_to_queue('http://192.168.1.99:8080/MusicShared/'+filename)  s.play_from_queue(0)  

(btw. my thread about this : https://twitter.com/GWierzowiecki/status/991453357234585601 )


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »