Piclodio: Raspberry Pi Alarm Clock Radio
New version of Piclodio available!
Piclodio is a web application to transform the Raspberry Pi into an internet clock radio. I had done an article for the first version there at one point. Obviously, you can install the application on any nunux machine as long as it supports the Django framework. The following commands will however only work on a Debian basis.
So why a new version would you ask me? Well for several reasons:
- Using a framework (Django). As a user, we don't care, but for a developer it is important. This will allow the application to evolve, to maintain it and above all to have a clean base for other people to bring their lots of features into the code.
- New interface. The old one looked good on a smartphone but was not very suitable for PC type terminals.
- Better performance. Switching from PHP to Python. Rpi love python.
- New features. Possibility to set several alarm clocks, choose the day, stop the alarm clock automatically and manage several web radios
The code is open and available on Github. Don't hesitate to fork and pull-request your improvements. You can also just comment on your ideas in this article. Here is a small preview of the interface
In short, let's move on to the installation!
Installation
Installing the Django framework
1
2
3
|
wget https://www.djangoproject.com/download/1.6/tarball/
tar xzf Django–1.6.tar.gz
sudo python setup.py install
|
You can verify your installation with the following command. This should give you the version of Django.
1
|
python –c « import django; print(django.get_version()) »
|
Installation of the web server, the media player, the database and the python module to connect django to the web server.
1
|
sudo apt–get install mplayer at sqlite3 apache2 libapache2–mod–wsgi
|
The project uses a particular python module. This is python-crontab.
1
2
3
|
wget https://pypi.python.org/packages/source/p/python–crontab/python–crontab–1.7.0.tar.gz
cd python–crontab–1.7.0/
sudo python setup.py install
|
We are now retrieving Piclodio from Github. We install it in the web server directory and give the rights to this directory to the apache user.
1
2
3
|
cd /var/www
sudo git clone https://github.com/Sispheor/Piclodio2.git
sudo chown –R www–data:www–data /var/www/Piclodio2/
|
We copy the configuration file for apache (vHost)
1
|
sudo cp /var/www/Piclodio2/apache/piclodio.conf /etc/apache2/sites–available/
|
VHost activation
1
|
a2ensite piclodio
|
This last command line invites us to restart apache.
1
|
service apache2 restart
|
Finally, you must authorize the apache server to use the multimedia player. We type
1
|
sudo visudo
|
and we add this line at the end of the file
1
|
www–data ALL=NOPASSWD:/usr/bin/mplayer* ,/usr/bin/pgrep mplayer ,/usr/bin/killall mplayer, /usr/bin/at
|
And There you go! The application is available at the ip address of your Rpi via your browser.
If you want to set a specific url, you need to modify the vHost in the apache config file. For example if I want to contact the application via the url http: // address_ip_du_rpi / piclodio I will modify the configuration file as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
WSGIScriptAlias /piclodio /var/www/Piclodio2/apache/wsgi.py
Alias /static/ /var/www/Piclodio2/webgui/static/
<Directory /var/www/Piclodio2/apache>
Order deny,allow
Allow from all
# Require all granted # enable it on apache 2.4
</Directory>
<Directory /var/www/Piclodio2/webgui/static/>
Order deny,allow
Allow from all
# Require all granted # enable it on apache 2.4
</Directory>
|
Restart apache to take this into account and it's good.