MPD: added rotate_pause parameter
This commit is contained in:
parent
aebb254b82
commit
f08a1fc8cb
28
mpd_dot3k.py
28
mpd_dot3k.py
|
@ -5,6 +5,8 @@ import threading
|
|||
import dot3k.lcd as lcd
|
||||
from mpd import MPDClient
|
||||
|
||||
rotate_pause = 10 # delay in rotation steps
|
||||
|
||||
char_play = [
|
||||
0b10000,
|
||||
0b11000,
|
||||
|
@ -57,7 +59,7 @@ def display():
|
|||
step_title = step_artist = step_album = 0
|
||||
while True:
|
||||
try:
|
||||
arg = q.get(timeout=0.5)
|
||||
arg = q.get(timeout=0.2)
|
||||
status = arg['status']['state']
|
||||
|
||||
if status == "play":
|
||||
|
@ -74,6 +76,7 @@ def display():
|
|||
album = arg['song']['album']
|
||||
|
||||
step_title = step_artist = step_album = 0
|
||||
delay_title = delay_artist = delay_album = rotate_pause
|
||||
lcd.clear()
|
||||
|
||||
lcd.set_cursor_position(0, 0)
|
||||
|
@ -90,9 +93,24 @@ def display():
|
|||
lcd.write(album)
|
||||
|
||||
except queue.Empty:
|
||||
step_title = (step_title + 1) % (len(title) + 3)
|
||||
step_artist = (step_artist + 1) % (len(artist) + 3)
|
||||
step_album = (step_album + 1) % (len(album) + 3)
|
||||
if step_title == 0 and delay_title > 0:
|
||||
delay_title -= 1
|
||||
else:
|
||||
step_title = (step_title + 1) % (len(title) + 3)
|
||||
if delay_title == 0:
|
||||
delay_title = rotate_pause
|
||||
if step_artist == 0 and delay_artist > 0:
|
||||
delay_artist -= 1
|
||||
else:
|
||||
step_artist = (step_artist + 1) % (len(artist) + 3)
|
||||
if delay_title == 0:
|
||||
delay_artist = rotate_pause
|
||||
if step_album == 0 and delay_album > 0:
|
||||
delay_album -= 1
|
||||
else:
|
||||
step_album = (step_album + 1) % (len(album) + 3)
|
||||
if delay_title == 0:
|
||||
delay_album = rotate_pause
|
||||
|
||||
if len(title) > 15:
|
||||
lcd.set_cursor_position(1, 0)
|
||||
|
@ -103,7 +121,7 @@ def display():
|
|||
if len(album) > 16:
|
||||
lcd.set_cursor_position(0, 2)
|
||||
lcd.write(stringrotate(album, 16, step_album))
|
||||
|
||||
|
||||
|
||||
client = MPDClient()
|
||||
client.connect("localhost", 6600)
|
||||
|
|
Loading…
Reference in New Issue