|
@@ -39,7 +39,7 @@ import RPi.GPIO as GPIO
|
39
|
39
|
from PIL import ImageFont
|
40
|
40
|
|
41
|
41
|
basevol = "70"
|
42
|
|
-debouncems = 200
|
|
42
|
+debouncems = 100
|
43
|
43
|
|
44
|
44
|
#fontfile = "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"
|
45
|
45
|
fontfile = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"
|
|
@@ -81,14 +81,15 @@ def get_artist(fn):
|
81
|
81
|
|
82
|
82
|
#originalsongs = os.listdir(basedir)
|
83
|
83
|
originalsongs = []
|
84
|
|
-artists = []
|
|
84
|
+originalartists = []
|
85
|
85
|
for fn in glob.iglob(os.path.join(basedir, '**', '*.wav'), recursive=True):
|
86
|
86
|
originalsongs.append(fn)
|
87
|
87
|
|
88
|
88
|
artist = get_artist(fn)
|
89
|
|
- if artist not in artists:
|
90
|
|
- artists.append(artist)
|
|
89
|
+ if artist not in originalartists:
|
|
90
|
+ originalartists.append(artist)
|
91
|
91
|
|
|
92
|
+artists = originalartists.copy()
|
92
|
93
|
random.shuffle(artists)
|
93
|
94
|
currentartist = artists[0]
|
94
|
95
|
|
|
@@ -208,10 +209,11 @@ def switch_artist():
|
208
|
209
|
global artists
|
209
|
210
|
global currentartist
|
210
|
211
|
|
211
|
|
- ca = currentartist
|
212
|
|
- while currentartist == ca:
|
|
212
|
+ if len(artists) <= 0:
|
|
213
|
+ artists = originalartists.copy()
|
213
|
214
|
random.shuffle(artists)
|
214
|
|
- currentartist = artists[0]
|
|
215
|
+
|
|
216
|
+ currentartist = artists.pop()
|
215
|
217
|
|
216
|
218
|
switch_track()
|
217
|
219
|
|