From ecedb87619dd02593f735ef36e60710f2b876b68 Mon Sep 17 00:00:00 2001 From: jdaalder Date: Tue, 12 Nov 2024 10:35:53 +1100 Subject: [PATCH] Changes requested from review https://github.com/xbmc/repo-plugins/pull/4596#pullrequestreview-2428290465 --- resources/lib/playback.py | 2 -- resources/lib/store.py | 8 +++----- resources/lib/switchback_service.py | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/resources/lib/playback.py b/resources/lib/playback.py index b1a14db..68b906e 100644 --- a/resources/lib/playback.py +++ b/resources/lib/playback.py @@ -30,6 +30,4 @@ class Playback: channelnumberlabel:str = None channelgroup:str = None - def toJson(self): - return json.dumps(self, default=lambda o: o.__dict__) diff --git a/resources/lib/store.py b/resources/lib/store.py index 075a982..9b62ada 100644 --- a/resources/lib/store.py +++ b/resources/lib/store.py @@ -85,11 +85,9 @@ def save_switchback_list(): :return: """ with open(Store.switchback_list_file, 'w', encoding='utf-8') as f: - temp_json = [] - for playback in Store.switchback_list: - temp_json.append(playback.toJson()) - temp_json = ',\n'.join(temp_json) - f.write(f"[\n{temp_json}\n]\n") + json_string = json.dumps([vars(playback) for playback in Store.switchback_list], indent=4) + f.write(json_string) + diff --git a/resources/lib/switchback_service.py b/resources/lib/switchback_service.py index ca1c6b1..307e3cc 100644 --- a/resources/lib/switchback_service.py +++ b/resources/lib/switchback_service.py @@ -25,7 +25,7 @@ def run(): # (Playback record is created onAVStarted in player.py, so check here that it is available) elif Store.current_playback and Store.kodi_player.isPlaying(): Store.current_playback.resumetime = Store.kodi_player.getTime() - xbmc.sleep(500) + Store.kodi_event_monitor.waitForAbort(0.5) # and, we're done... footprints(startup=False)