Skip to content

Play music snippets based on current weather conditions. Uses live data from Yahoo Weather and Spotify

Notifications You must be signed in to change notification settings

Craig88/newbattle-music-cloud

Repository files navigation

Newbattle Music Cloud

Made with Newbattle High School students and the University of Edinburgh as part of the Everybody Makes The School project. Play music snippets based on current weather conditions. Uses live data from Yahoo Weather and Spotify.

Required Python packages

The requirements.txt file lists all the Python packages needed to run the app. To install them run this command:

pip3 install -r requirements.txt

Other libraries

Depending on the computer, these libraries may also be needed. Install them by running these commands:

sudo apt-get install python-gst-1.0
sudo apt-get install pulseaudio

API Keys

API keys for Yahoo and Spotify are stored in the .env file. Treat these like passwords and keep them secret.

Testing

Internet connection test:

ping bbc.co.uk

Sound test:

speaker-test -c2

This lets you control the sound levels if they need adjusted:

alsamixer

Weather test:

python3 test_weather.py

VLC test:

python3 test_vlc.py

Run the app

python3 cloud.py

Other useful titbits

Other libraries that might be needed: gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly

Using Cron to schedule the app

https://crontab-generator.org/ https://www.raspberrypi.org/documentation/linux/usage/cron.md

python3 test_cron.py >> log.txt

python3 /home/pi/Desktop/newbattle-sound-cloud/test_cron.py >> /home/pi/Desktop/newbattle-sound-cloud/log.txt

* * * * * python3 /home/pi/Desktop/newbattle-sound-cloud/test_cron.py >> /home/pi/Desktop/newbattle-sound-cloud/log.txt

* * * * * python3 /home/pi/Desktop/newbattle-sound-cloud/test_vlc.py >> /home/p$

https://developer.yahoo.com/weather/documentation.html

Condition codes https://developer.yahoo.com/weather/documentation.html#codes

This command switches the audio output to HDMI:

amixer cset numid=3 2

Here the output is set to 2, which is HDMI. Setting the output to 1 switches to analogue (headphone jack). The default setting is 0 which is automatic.

About

Play music snippets based on current weather conditions. Uses live data from Yahoo Weather and Spotify

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages