Prepare your Raspberry Pi for AlbumPlays

This topic is applicable to Sonos owners only.

The Raspberry Pi was introduced in a previous topic, covering how it enhances AlbumPlays, what you need to get, and how to install it.

The aim of this step is to the ease support and installation of AlbumPlays, and to allow AlbumPlays to access your NAS (if you have one), and to install an AlbumPlays prerequistite.

1. Allow Windows Explorer to access files on your RPi

Install, support & upgrades of AlbumPlays are each simplified if you can access and update Raspberry Pi files and folders using Windows Explorer on your PC.

click here details
  1. log into the RPi using the TightVNC Viewer on your PC
  2. create a new folder, inside your home directory, for easy-access sharing with Windows
    • click on the FileManager icon (filing cabinet icon; see #1 in illustration below)
    • navigate to the home directory (/home/pi) … the FileManager should be pre-positioned there by default, if not you can navigate there quickly via a click on the brown home folder folder icon (#2 in illustration below)
    • from here, it is just the same as creating a folder in Windows:
      • right click anywhere in blank space, in the FileManager’s right hand white panel, to open the pop-up menu shown as #3 below
      • select Create New and then Folder
    • Give the folder a meaningful name (no embedded blanks) …. I named my folder share, as will be seen in a later step of this procedure
    • create a folder to share with Windows
  3. Open a terminal session on the RPi .. (black folder icon)
  4. Install Windows connectivity software onto the RPi
    copy (or type) the following into the terminal session, pressing the Enter key at the end

    sudo apt-get install samba samba-common-bin
    
  5. Share the folder that you just created
    Continuing in the terminal session: copy (or type) the following, pressing the Enter key at the end

    sudo nano /etc/samba/smb.conf
    
    • Linux’s nano editor will open.
    • move the cursor to the bottom of the document using the down arrow keys (mouse clicks don’t work in Nano).
    • copy (or type) the following (substitute your folder name into the line path=/home/pi/share if you named your folder something other than share)

          ### Added for AlbumPlays
          [PiShare]
          comment=Raspberry Pi Share
          path=/home/pi/share
          browseable=Yes
          writeable=Yes
          only guest=no
          create mask=0777
          directory mask=0777
          public=no
      
    • nb: PiShare will become the Windows name for the shared folder … ie. RPi’s /home/pi/share folder will be seen as \\RASPBERRYPI\PiShare in Windows.

    • exit nano via Ctrl+x keys
    • confirm that you want to save your changes, by pressing y when asked.
    • then press Enter to confirm overwrite of the existing file.
       
  6. Give your pi password to cross platform services
    Copy (or type) the following command into the RPi terminal session, and then press Enter

    sudo smbpasswd -a pi
    

    You will then be required to enter your password (raspberry) twice, for verification

  7. Test

    • go to Windows on your PC, and open Network
    • open RASPBERRYPI
    • you will need to provide credentials; username = pi, password = raspberry
    • there should be two network folders: PiShare is the easy-access directory that you created on the RPi, and is useful for transferring items to|from the RPi. There will also network folder named pi, which will be your home directory on the Rpi (this is where we will install AlbumPlays in a later step)
    • Explorer view of the RPi
    • Open PiShare, and create a text document in there using the Windows Explorer (right click, New|TextDocument)
    • open the file, and type in some phrase, then save and close it
    • go to your RPi desktop, and verify that the file is accessible from RPi … open the file (double click) … modify and save the contents .. close the file
    • go back to Windows, reopen the file, and verify that you are seeing the modified contents
Problems?

If you don’t see the RPi in the Network display, check your PC’s workgroup name:
– in Windows, right click on Computer (aka My Computer)
– select Properties
– check your workgroup name, as illustrated below
Windows workgroup name
– if the name is something other than workgroup, you need to make a further change to the smb.conf configuration file
– open a terminal session on the RPi
– type, pressing Enter at the end

        sudo nano /etc/samba/smb.conf

 
– carefully move the cursor down until you find the section headed up by [global] …. it is towards the top of the file, about 1 page down
– look in that section for the line starting with workgroup = … it is probably

       workgroup = workgroup

 
– change the right hand side to reflect your own workgroup name
– press Ctrl+x
– type y to save your changes
– and press enter to overwrite
– reboot the RPi, and repeat the above test

collapse

2. [If you have a NAS] – Create a share on your NAS, accessible from both Linux (RPi) and Windows

If you are using the database transfer option to make Spy track play observations available to the main AlbumPlays module, it is best that the RPi be able to store them to some other always-on device, such as a NAS.

click here details
  1. Create a new share folder on your NAS
    • create a folder to be shared between your Windows PC and your Raspberry Pi (Linux)
    • take a note of which network sharing protocol your NAS is using:
      • cifs if it mentions smb, or samba or cifs or Common Internet File System
      • nfs if it mentions Network File System or NFS
    • set the folder permissions so that everybody has read|write access to the folder, and all files which will be created in it.
      • the UI to achieve this will vary depending upon which NAS you have … google your NAS type and either CIFS permissions or NFS permissions
    • click here to see configuration on my NAS
       
  2. Record the IP address of your NAS
    If you don’t already know the IP address, log into your NAS … the IP address will be prominently displayed
    Otherwise open Windows command Prompt, and type the following, where xxx is your NAS name

    ping xxxx
    
  3. Create a folder on the RPi to represent the shared folder

    • log into the RPi using the TightVNC Viewer on your PC
    • Open a terminal session on the RPi .. (black folder icon)
    • copy, or type the following commands into the terminal session; one line at a time. pressing Enter at the end of each line
    • The 1st line navigates to your home directory, the 2nd creates a folder named NAS, and the 3rd protects your shared files by turning on file locking

      cd ~
      mkdir NAS
      sudo update-rc.d rpcbind enable 
      

       

  4. Define a Linix mount point on the RPi

    • continuing with the terminal session:
    • firstly, type the following line to save a backup copy of an important configuration file that we are about to modify

      sudo cp /etc/fstab /etc/fstab.backup
      
    • then open the file for editing

      sudo nano /etc/fstab
      
    • add the following line to the bottom of the file; where wwww is either cifs or nfs (as noted in the first of this procedure), and x.x.x.x is your NAS’ IP address, and yyyy is name of the NAS share which you created above, and zzz is the name of the RPi folder you created (NAS in my example) …. nb: after paste, this line line will probably wrap out of view .. if so press the home key to take you to the beginning … then make your alterations for IP address etc

    • important: remember to follow capitalisation carefully with Linux commands and file & directory names

      //x.x.x.x/yyyy /home/pi/zzz wwww guest,uid=pi,gid.pi,nobrl,noauto,x-systemd.automount  0 0
      
    • update the file; ctrl+x, then y, and then press the Enter key
       

  5. Reboot the RPi

    Menu button (the one with the Raspberry icon), then take the Shutdown menu item, with the radio button set to reboot
     

  6. Test

    • create a text file in the NAS share using Windows
    • open the folder that you created in the RPi’s home directory
    • open the file (double click), update the contents, save & close
    • create a text file in the RPi folder
    • open both files in Windows, verify that the contents of the initial file have been updated

collapse

 

3. Install Synaptic (a graphical package manager)

Up until now we have used the command line (sudo apt-get) to install software onto the RPi. A tool with a GUI makes it easier to browse & find what is available.

click here details
  1. log into the RPi using the TightVNC Viewer on your PC
  2. Open a terminal session on the RPi .. (black folder icon)
  3. copy, or type the following commands into the terminal session; one line at a time. pressing Enter at the end of each line

    • the 1st line updates the RPi’s view of the most current versions and dependencies for available software, and the 2nd line installs Synaptic

      sudo apt-get update
      sudo apt-get install synaptic
      

collapse

 

4. Install CherryPy (a prerequisite for AlbumPlays SPY mode

AlbumPlays’ Observe & Detect module uses CherryPy to create the menu which enables you to control and observe the O&D module from your PC.
This step uses Synaptic, which we installed in step #3 above

click here details
  1. press the Menu button (raspberry pi icon), and select Preferences
  2. open Synaptic with the option Synaptic Package Manager
  3. login: User pi, password raspberry
  4. read and close the small tutorial pop-up window
  5. press the Reload button, this will update Synaptic’s view of the latest version and fixes to all available software.
    Synaptic Reload
  6. press the button alongside, its name is Mark All Upgrades
    This will respond by listing any of your installed packages which have an new or fixed version.

    • press Mark to specify that all upgrades should be installed
  7. press the search button (magnifying glass icon), and type CherryPy
    Synaptic Search
  8. check python-cherrypy3 from the list, and select mark for installation from the menu which pops up
    nb: take care not to select python3-cherrypy3 … we are running Python2, not python3
    Synaptic select CherryPy
  9. press the Apply button
    Review the list of items which will be installed, the disk space required, and the size of the Internet download which will be required … your download size may be different to that illustrated below, as it will depend upon what updates are available for you
    Synaptic Apply
  10. Press this new Apply button
  11. It takes a while.
    There is no visible change to the desktop as CherryPy is an under-the-covers thing.

collapse

 

Next step: Install AlbumPlays’ Spy Observe & Detect module onto your RPi – coming soon

Previous step: Configuring your Raspberry Pi
Site map: Index to my Raspberry Pi installation & support pages