fix[player]: Don't latch tag if no playlist exists
When the device is in 'tagstartstop' tag mode, and the user presents a new tag to get the serial number and create a playlist using the web UI, the playerapp still remembered the tag as the currently playing tag even though no playlist was found and no playback is running. After the user saves the playlist in the UI and puts the tag on the device again, they expect the playback to start with the new playlist. Instead, nothing happens, because this is counted as the 'stop' event of the tagstartstop mode. The user would have to remove the tag and present it again (after waiting for the tagtimeout) to play the new playlist. Fix this unexpected behaviour by not storing the current tag into the playing_tag field if no playlist existed for the tag. Signed-off-by: Matthias Blankertz <matthias@blankertz.org>
This commit is contained in:
@@ -82,7 +82,7 @@ class PlayerApp:
|
|||||||
uid_str = b''.join('{:02x}'.format(x).encode() for x in new_tag)
|
uid_str = b''.join('{:02x}'.format(x).encode() for x in new_tag)
|
||||||
if self.tag_mode == 'tagremains' or (self.tag_mode == 'tagstartstop' and new_tag != self.playing_tag):
|
if self.tag_mode == 'tagremains' or (self.tag_mode == 'tagstartstop' and new_tag != self.playing_tag):
|
||||||
self._set_playlist(uid_str)
|
self._set_playlist(uid_str)
|
||||||
self.playing_tag = new_tag
|
self.playing_tag = new_tag if self.playlist is not None else None
|
||||||
elif self.tag_mode == 'tagstartstop':
|
elif self.tag_mode == 'tagstartstop':
|
||||||
print('Tag presented again, stopping playback')
|
print('Tag presented again, stopping playback')
|
||||||
self._unset_playlist()
|
self._unset_playlist()
|
||||||
|
|||||||
Reference in New Issue
Block a user