Skip to content

Commit

Permalink
Fixed imports on lessons; filtered out explicit tracks on Google Music
Browse files Browse the repository at this point in the history
  • Loading branch information
deckerego committed Mar 20, 2017
1 parent 83d13f3 commit 9de7b76
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 42 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ I'm assuming that you are starting with the Raspian Minimal Linux distribution.
1. Make sure your Raspberry Pi is up to date with the latest packages & firmware with `sudo apt-get update; sudo apt-get dist-upgrade`
2. Enable I2C by executing `sudo raspi-config` as described in Adafruit's tutorial: https://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c
3. Add the necessary Python and GStreamer dependencies using the command: `sudo apt-get install wiringpi python-bottle python-requests python-oauth2client python-httplib2 python-setuptools python-pip python-dev python-dateutil python-smbus gstreamer0.10-x gstreamer-tools gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly python-gst0.10`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.1.7/python-hackclock_2.1.7-1_all.deb; sudo dpkg -i python-hackclock_2.1.7-1_all.deb`
4. Install hack-clock via `wget https://github.com/deckerego/hack-clock/releases/download/2.1.8/python-hackclock_2.1.8-1_all.deb; sudo dpkg -i python-hackclock_2.1.8-1_all.deb`
5. Tweak `/etc/hack-clock.conf` and `/etc/default/hack-clock` to fit your needs (GPIO pins, correct weather station, etc.). A list of observed weather stations is available at http://forecast.weather.gov/stations.php
6. Reboot your Pi to re-load modules and start the IDE web server

Expand Down
5 changes: 2 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
hackclock (2.1.7-1) stable; urgency=low
hackclock (2.1.8-1) stable; urgency=low

* Detect if I2S is already _ignored_, then allow standard Pi audio to continue
* Changed icons for "save" and "restore" in IDE
* Filter out explicit songs from Google Music radio streams

-- DeckerEgo <[email protected]> Tue, 01 Mar 2017 21:32:00 -0500
4 changes: 2 additions & 2 deletions home/pi/hack-clock/lessons/1/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

from Libs.Clock import Clock
from Libs.SevenSegment import Display
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display

# Connect to the internal machine clock
clock = Clock()
Expand Down
4 changes: 2 additions & 2 deletions home/pi/hack-clock/lessons/2/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display

# Connect to the internal machine clock
clock = Clock()
Expand Down
4 changes: 2 additions & 2 deletions home/pi/hack-clock/lessons/3/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display

# Connect to the internal machine clock
clock = Clock()
Expand Down
6 changes: 3 additions & 3 deletions home/pi/hack-clock/lessons/4/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.GStreamer import Speaker
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.GStreamer import Speaker

# Connect to the internal machine clock
clock = Clock()
Expand Down
8 changes: 4 additions & 4 deletions home/pi/hack-clock/lessons/5/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.Input import Button
from Libs.GStreamer import Speaker
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.Input import Button
from hackclock.runapp.Libs.GStreamer import Speaker

# Connect to the internal machine clock
clock = Clock()
Expand Down
12 changes: 6 additions & 6 deletions home/pi/hack-clock/lessons/6/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.Weather import Weather
from Libs.Input import Button
from Libs.GStreamer import Speaker
from config import configuration
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.Weather import Weather
from hackclock.runapp.Libs.Input import Button
from hackclock.runapp.Libs.GStreamer import Speaker
from hackclock.config import configuration

# The weather station
station_name = configuration.get('weather_station')
Expand Down
12 changes: 6 additions & 6 deletions home/pi/hack-clock/lessons/final/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/python

from datetime import datetime
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.Weather import Weather
from Libs.Input import Button
from Libs.GStreamer import Speaker
from config import configuration
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.Weather import Weather
from hackclock.runapp.Libs.Input import Button
from hackclock.runapp.Libs.GStreamer import Speaker
from hackclock.config import configuration

# The weather station
station_name = configuration.get('weather_station')
Expand Down
8 changes: 4 additions & 4 deletions home/pi/hack-clock/lessons/gpio/run_clock.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from datetime import datetime
from Libs.SevenSegment import Display
from Libs.Output import Switch
from Libs.Clock import Clock
from Libs.Input import Button
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.Output import Switch
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.Input import Button

Is_Evening = None
LED_On = None
Expand Down
12 changes: 6 additions & 6 deletions home/pi/hack-clock/lessons/musiclover/run_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

from datetime import datetime
import random
from Libs.Clock import Clock
from Libs.SevenSegment import Display
from Libs.Weather import Weather
from Libs.Input import Button
from Libs.GStreamer import Speaker
from config import configuration
from hackclock.runapp.Libs.Clock import Clock
from hackclock.runapp.Libs.SevenSegment import Display
from hackclock.runapp.Libs.Weather import Weather
from hackclock.runapp.Libs.Input import Button
from hackclock.runapp.Libs.GStreamer import Speaker
from hackclock.config import configuration

# Connect to the internal machine clock
clock = Clock()
Expand Down
7 changes: 6 additions & 1 deletion lib/hackclock/runapp/Libs/GoogleMusic.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
logger = logging.getLogger('google_music')

console = logging.StreamHandler()
console.setLevel(logging.WARNING)
console.setLevel(logging.DEBUG)
logger.addHandler(console)

class AudioStream:
Expand All @@ -34,6 +34,11 @@ def __fetchTrackIDs(self, station_id):
tracklist = self.__client.get_station_tracks(station_id, num_tracks=self.__track_prefetch)
logger.info("Received tracks: %r" % json.dumps(tracklist))

# Filter out explicit tracks, where non-explicit is explicitType=2
tracklist = [track for track in tracklist if not 'explicitType' in track or track['explicitType'] == "2"]
logger.info("Non-explicit tracks: %r" % json.dumps(tracklist))

# Fetch both song IDs and Nautilus (old) IDs
songids = [track['id'] for track in tracklist if 'id' in track]
nautids = [track['nid'] for track in tracklist if 'nid' in track]

Expand Down
2 changes: 1 addition & 1 deletion package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rm home/pi/hack-clock/backups/blocks_clock.*

cd ..
echo "Compressing file..."
tar Jcf hackclock_2.1.7.orig.tar.xz hack-clock/
tar Jcf hackclock_2.1.8.orig.tar.xz hack-clock/

cd hack-clock
dpkg-buildpackage -rfakeroot -uc -us
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def all_files(newroot, oldroot):

setup(
name='HackClock',
version='2.1.7',
version='2.1.8',
description='A hackable alarm clock for the Raspberry Pi',
author='DeckerEgo',
author_email='[email protected]',
Expand Down

0 comments on commit 9de7b76

Please sign in to comment.