Skip to content

Commit

Permalink
Merge pull request smarthomeNG#786 from onkelandy/lms
Browse files Browse the repository at this point in the history
lms plugin: fix wipecache and scan running commands
  • Loading branch information
onkelandy authored Jul 19, 2023
2 parents a872e75 + 879adaf commit 8aa3ac1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lms/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': ''}},
Expand Down
8 changes: 7 additions & 1 deletion lms/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 8aa3ac1

Please sign in to comment.