Friday 28 December 2012

Installing SCANPI SHELLPLAYER

The wee app (SCANPI SHELLPLAYER) is written as a set of 9 shell scripts. It's kind of explained at https://bitbucket.org/parbuthnott/scanpi-shellplayer/overview.

Once you've gone to the bitbucket, downloaded it and sent it off to your PI, it's all ready for linking action.

We put the whole 9 files and in one place, with the 'queue' and 'played' directories created next to the shell files. All are in a loopback mounted drive on the big disc under /mnt/scanpi.

== AFTER INITIAL INSTALLATION AND INDEX RUN ==
(the files and directories in place and tested...)
pi@raspberrypi /mnt/scanpi/shellplayer $ ls -l
-rwxrwxr-x 1 pi       www-pub   1827 Nov 13 10:58 album.sh
-rw-r--r-- 1 pi       pi      705587 Dec 25 14:03 allmusicrandom.txt
-rwxrwxr-x 1 www-data www-pub 707812 Dec 21 01:31 allmusic.txt
-rwxrwxr-x 1 pi       www-pub   1297 Nov 13 10:58 band.sh
-rwxrwxr-x 1 pi       www-pub   1481 Nov 13 10:59 exit.sh
-rwxrwxr-x 1 pi       www-pub    284 Dec 28 16:51 go.sh
drwxrwxr-x 2 www-data www-pub  33792 Dec 28 16:57 played
-rwxrwxr-x 1 pi       www-pub   3359 Nov 18 14:39 play.sh
drwxrwxr-x 2 pi       www-pub   5120 Dec 28 16:57 queue
-rwxrwxr-x 1 pi       www-pub   1124 Nov 18 13:24 queue.sh
-rwxrwxr-x 1 pi       www-pub   1066 Nov 18 22:28 reindex.sh
-rwxrwxr-x 1 pi       www-pub   1243 Nov 25 12:12 skip.sh
-rwxrwxr-x 1 pi       www-pub   2286 Nov 13 10:59 track.sh

== TIE-ING THE SHELLPLAYER BITS TOGETHER ==
(make a pile of shortcuts to the shellplayer for the pi user.)
cd
sudo ln -s /mnt/scanpi/ scanpi
sudo ln -s scanpi/shellplayer/album.sh a
sudo ln -s scanpi/shellplayer/band.sh b
sudo ln -s scanpi/shellplayer/exit.sh e
sudo ln -s scanpi/shellplayer/go.sh g
sudo ln -s scanpi/shellplayer/play.sh p
sudo ln -s scanpi/shellplayer/queue.sh q
sudo ln -s scanpi/shellplayer/reindex.sh r
sudo ln -s scanpi/shellplayer/skip.sh s
sudo ln -s scanpi/shellplayer/track.sh t

With the above in place, you should be able to ssh to your PI and type './g' and press 'enter' to start the playing function. Typing './e' and pressing 'enter' will exit / stop the playing function. Typing './s' and pressing 'enter' will skip the current playing track.

If there isn't anything in the queue directory, the shellplayer takes the next line from the allmusicrandom.txt file and plays and removes that. The allmusicrandom.txt file is a randomized list of all the available '.mp3' files in the relevant music directory and is created and updated with the 'reindex.sh' or './r' function.

Queueing something up can be done at an artist / band ('./b'), album ('./a') or track ('./t') level. If you understand the syntax, a specific track can be queued up using the queue function ('./q') directly.

Have fun and feel free to comment on all of this. We've got a browser based queue and playing function all ready in the wings and will post about that soon.

Monday 17 December 2012

Instructions for SCANPI setup

TODO number 2. Taken from the bitbucket see this...
== INSTALLING BITS ==
(get an updated set of files onto the PI)
* sudo apt-get update
* sudo apt-get install vim
* sudo apt-get install apache2
* sudo apt-get install php5
* sudo apt-get install mpg123

== SETTING UP USERS ==
(ensures that apache can read, write, etc)
* sudo groupadd www-pub
* sudo usermod -a -G www-pub pi
* sudo usermod -a -G www-pub www-data

== SET UP AUDIO OUT ==
(points the audio out the headphone socket instead of the HDMI)
* sudo amixer cset numid=3 1

== MOUNTING USB HDD ==
(first make places to mount and set permissions)
sudo mkdir -p /mnt/2tb_USB_hard_disc
sudo mkdir -p /mnt/scanpi
sudo chmod 775 /mnt
sudo chmod 775 /mnt/2tb_USB_hard_disc
sudo chmod 775 /mnt/scanpi

(mount the main disc and test...)
sudo mount -o uid=pi,gid=www-pub /dev/sda1 /mnt/2tb_USB_hard_disc
ls /mnt/2tb_USB_hard_disc/

(create a loopback disc for mounting a second partition)
sudo losetup /dev/loop0 /mnt/2tb_USB_hard_disc/virtualfs

(mount the loopback disc and test...)
sudo mount -t ext3 /dev/loop0 /mnt/scanpi/
ls /mnt/scanpi/

if that all works, then you can do it 'properly'.

== MAKING THE MOUNT STICKY AFTER REBOOT ==
(edit the HDD details for main disc and loopback)
* sudo vim /etc/fstab

 #!shell
 proc            /proc           proc    defaults          0       0
 /dev/mmcblk0p1  /boot           vfat    defaults          0       2
 /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
 # a swapfile is not a swap partition, so no using swapon|off from here on,
 use  dphys-swapfile swap[on|off]  for that

* AFTER EDITING

 #!shell
 proc            /proc           proc    defaults          0       0
 /dev/mmcblk0p1  /boot           vfat    defaults          0       2
 /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1

 # EXTERNAL DISC MOUNTS
 UUID=4830-1CF9 /mnt/2tb_USB_hard_disc vfat uid=pi,gid=www-pub 0 0
 /mnt/2tb_USB_hard_disc/virtualfs /mnt/scanpi ext3 loop,auto 0 0

 # a swapfile is not a swap partition, so no using swapon|off from here on,
 use  dphys-swapfile swap[on|off]  for that

(test the remounting)
* sudo mount -a

== SETTING STATIC IP ==
(making comms easier = set PI as 192.168.0.227)
* more /etc/network/interfaces

 #!shell
 auto lo

 iface lo inet loopback
 iface eth0 inet dhcp

 allow-hotplug wlan0
 iface wlan0 inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 iface default inet dhcp

== AFTER EDITING ==
* more /etc/network/interfaces

 #!shell
 auto lo

 iface lo inet loopback
 iface eth0 inet static
 address 192.168.0.227
 netmask 255.255.255.0
 gateway 192.168.0.1

 allow-hotplug wlan0
 iface wlan0 inet manual
 wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
 iface default inet dhcp

* sudo /etc/init.d/networking restart (might work for you... for me, it
 showed warning... so I did a reboot)
* reboot = ip correct.

After all that, you should have PI with all the bits running, installed, etc. You should be able to get the Apache It Works page at http://192.168.0.227. If you can't, add comment and we'll look into it.

Thursday 13 December 2012

How to get here: part 1

You want to get here?
An UL for you...
  • Get yourself a Raspberry Pi (start here:http://www.raspberrypi.org/faqs)
  • Purchase a big disc (something from here probably)
  • Do some background reading: see the other UL below...
  • Make them talk to one another (that's this post here:TODO)
  • Setup PI as a server etc (and that's written up here)
  • Burn in some way all music to the big disc
  • Install the wee app(s) (here)
  • SCANPIMOB in use (a video? or some such?:TODO)

In progress at first installation...

Thursday 6 December 2012

From here backwards.

We have the beginnings of a logo:


And our SCANPI works smoothly and looks all old school in its home. With dish obviously.

The SCANPI home sits on a foundation of the 'big disc'. The big disc has all the music (and pictures, but we don't talk about them yet) collated, collected and randomly accumulated. It has a 'modern' browse interface by way of the SCANPI website (3 pages of PHP), and a 'modern and mobile' browse interface by way of the SCANPIMOB JQuery Mobile website (3 pages of PHP with the JQuery mobile thing).

The thing SCANPI does that we have never seen before (prior to doing it ourselves) is allow old people like me interact with the physical media. I pick up the CD I want to play from the 'shelves' (colour coded obviously), I turn it over and point it at the nearest camera phone, and I then pick the tracks I want to queue up.

In the background is a thing we've called the 'shellplayer'. No references to scampi at all then. The shellplayer is a small pile of shell scripts which play, skip, queue, album, band, track, exit, and reindex. Each function of the shellplayer has it's own letter to make it all simple enough for my gran to interact with.

To understand how it works will take another pile of text to be moulded and ingested by you at a later date. SCANPI, SCANPIMOB and shellplayer don't do everything perfectly yet, and this blog is going to describe 2 simple things;
  1. How you get to where we are.
  2. The things that are good and bad with here.

If you've got comments already, then stick em in below, or tell me directly.

Wednesday 5 December 2012

SCANPI : the blog

And so it begins. A BLOG to retain all the SCANPI stuff as it comes together, falls apart, is imagined and realised. There will be pictures, how to do stuff, setup information, in play views, future developments and *everything*. I can't wait, I don't know about you...