From 879adaf5cad00e09d660be1db5c0f2b568cb0d2d Mon Sep 17 00:00:00 2001 From: Onkel Andy Date: Wed, 19 Jul 2023 00:27:27 +0200 Subject: [PATCH] lms plugin: fix wipecache and scan running commands --- lms/commands.py | 2 +- lms/datatypes.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lms/commands.py b/lms/commands.py index ed1cfc582..6f0afe4da 100755 --- a/lms/commands.py +++ b/lms/commands.py @@ -18,7 +18,7 @@ 'runningtime': {'read': True, 'read_cmd': 'rescanprogress totaltime', 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': 'rescanprogress totaltime .* rescan:([0-9]{2}:[0-9]{2}:[0-9]{2})', 'item_attrs': {'custom1': ''}}, 'fail': {'read': True, 'item_type': 'str', 'dev_datatype': 'str', 'reply_pattern': 'rescanprogress totaltime rescan:0 lastscanfailed:(.*)', 'item_attrs': {'custom1': ''}}, 'abortscan': {'read': True, 'write': True, 'write_cmd': 'abortscan', 'item_type': 'bool', 'dev_datatype': 'str', 'reply_pattern': 'abortscan', 'item_attrs': {'custom1': ''}}, - 'wipecache': {'read': True, 'write': True, 'write_cmd': 'wipecache', 'item_type': 'bool', 'dev_datatype': 'str', 'reply_pattern': 'wipecache', 'item_attrs': {'custom1': ''}} + 'wipecache': {'read': True, 'write': True, 'write_cmd': 'wipecache', 'item_type': 'bool', 'dev_datatype': 'LMSWipecache', 'reply_pattern': 'wipecache', 'item_attrs': {'custom1': ''}} }, 'totalgenres': {'read': True, 'write': False, 'read_cmd': 'info total genres ?', 'item_type': 'num', 'dev_datatype': 'str', 'reply_pattern': r'info total genres (\d+)', 'item_attrs': {'initial': True, 'custom1': ''}}, 'totalduration': {'read': True, 'write': False, 'read_cmd': 'info total duration ?', 'item_type': 'num', 'dev_datatype': 'str', 'reply_pattern': r'info total duration ([0-9.]*)', 'item_attrs': {'item_template': 'duration', 'initial': True, 'custom1': ''}}, diff --git a/lms/datatypes.py b/lms/datatypes.py index 10acc5d3d..c60618a47 100755 --- a/lms/datatypes.py +++ b/lms/datatypes.py @@ -8,9 +8,15 @@ # handle feedback if rescan is running or not class DT_LMSRescan(DT.Datatype): def get_shng_data(self, data, type=None, **kwargs): - return True if data in ["1", "done"] else False + return True if data == "1" else False +class DT_LMSWipecache(DT.Datatype): + def get_shng_data(self, data, type=None, **kwargs): + return True if data == "wipecache" else False + def get_send_data(self, data, type=None, **kwargs): + return "wipecache" if data is True else "" + class DT_LMSPlaylists(DT.Datatype): def get_shng_data(self, data, type=None, **kwargs): _playlists = list(filter(None,re.split(r'id:|\sid:|\splaylist:', data)))