/AutoSpot

A command-line Spotify-client based on Pyspotify2.

Primary LanguagePython

AutoSpot
=====

A Spotify-client based on Pyspotify2.
It has three different guis: Text, graphical on computer screen and graphical with a small 2.2" TFT (Raspberry Pi only).
Tested on Linux (Arch Linux, Ubuntu and Fedora) and on Raspberry Pi. 
To use it you need some stuff installed first:

sudo apt-get install libffi-dev python-dev python-alsaaudio
(sudo dnf install libffi-devel python-devel python-alsaaudio)

sudo easy_install3 -U RPIO - necessery?	

sudo pip-3.2 install pyalsaaudio
(sudo pip install pyalsaaudio)

Install libspotify:
For 32-bit systems:
wget https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-i686-release.tar.gz
Or for 64-bit:
wget https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-x86_64-release.tar.gz

tar zxvf libspotify*
cd libspotify*
sudo make install prefix=/usr/local

Install pyspotify
sudo pip-3.2 install pyspotify
or
sudo pip install pyspotify

-Get a Binary Spotify App key from https://devaccount.spotify.com/my-account/keys/
and store it in the current directory. Download the Binary key and store it as "spotify_appkey.key". 


Install Autospot:
sudo python setup.py install

-Rename "settings_editthis" to "settings.txt".
-Edit settings.txt and add your Spotify credentials.
-Run ('python autospot.py').

Package built with instructions from https://packaging.python.org/en/latest/distributing.html#setup-for-project-distributors

Some notes on operatingsystem for the Pi. I still have to find the best system, it should boot quick! Buildroot-rpi is doing that, 
but it's hard to build to support libspotify. Arch Linux boots in 13 seconds to command line, good. Tiny Core, small but slow to load 
due to the system with dynamically loading extensions. 

Arch Linux:
pacman -S python2-pip gcc alsa-lib wget make tk
pip2 install pyalsaaudio
wget https://developer.spotify.com/download/libspotify/libspotify-12.1.103-Linux-armv6-bcm2708hardfp-release.tar.gz
tar zxvf libspotify*
cd libspotify*
make install prefix=/usr/local
pip2 install pyspotify
Create symbolic link: ln -s /usr/bin/python2 /usr/bin/python
Edit /etc/ld.so.conf, add "/usr/local/lib"
Run ldconfig
nano settings.py
Add:
username="YourUsername"
password="YourPassword"
Save
Run 'A2.py'

SPI & Gpio permissions on Rpi:
groupadd spi
groupadd gpio
usermod -aG spi alarm
usermod -aG gpio alarm
nano /etc/udev/rules.d/raspberrypi.rules 
SUBSYSTEM=="vchiq|input", MODE="0777"
KERNEL=="mouse*|mice|event*",  MODE="0777"
KERNEL=="spidev0.[0-9]*", GROUP="spi"
KERNEL=="gpiomem", GROUP="gpio"

reboot