sync screen
This commit is contained in:
parent
e0f4c06676
commit
8b433e77f4
@ -11,16 +11,16 @@ from datetime import datetime
|
||||
@retry(stop=stop_after_attempt(5))
|
||||
def current_track():
|
||||
mopidy = MopidyClient()
|
||||
if mopidy.playback.get_state() == "stopped":
|
||||
if mopidy.playback.get_state(timeout=5) == "stopped":
|
||||
oled.text("Nothing", 32, 26, 1)
|
||||
oled.text("Playing", 32, 36, 1)
|
||||
return
|
||||
if mopidy.playback.get_state() == "paused":
|
||||
if mopidy.playback.get_state(timeout=5) == "paused":
|
||||
oled.text("Paused", 32, 36, 1)
|
||||
return
|
||||
current_track_data = mopidy.playback.get_current_track()
|
||||
current_track_data = mopidy.playback.get_current_track(timeout=5)
|
||||
time_position = datetime.fromtimestamp(
|
||||
mopidy.playback.get_time_position() / 1000.0
|
||||
mopidy.playback.get_time_position(timeout=5) / 1000.0
|
||||
).strftime("%M:%S")
|
||||
if "ytmusic" in current_track_data["uri"]:
|
||||
if "album" in current_track_data:
|
||||
@ -47,7 +47,7 @@ def current_track():
|
||||
}
|
||||
else:
|
||||
try:
|
||||
stream_title = mopidy.playback.get_stream_title()
|
||||
stream_title = mopidy.playback.get_stream_title(timeout=5)
|
||||
artist_and_song = stream_title.split(" - ")
|
||||
except:
|
||||
stream_title = "None"
|
||||
@ -79,6 +79,6 @@ while True:
|
||||
oled.text("Floppy Player", 26, 0, 1)
|
||||
current_track()
|
||||
oled.show()
|
||||
time.sleep(2)
|
||||
time.sleep(3)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user