Code optimization

This commit is contained in:
croneter 2017-08-21 18:59:47 +02:00
parent 5f45cc1c9b
commit 7b6834b326
2 changed files with 3 additions and 10 deletions

View file

@ -172,10 +172,7 @@ class Main():
Start up playback_starter in main Python thread Start up playback_starter in main Python thread
""" """
# Put the request into the 'queue' # Put the request into the 'queue'
while window('plex_command'): plex_command('PLAY', argv[2])
sleep(50)
window('plex_command',
value='play_%s' % argv[2])
# Wait for the result # Wait for the result
while not pickl_window('plex_result'): while not pickl_window('plex_result'):
sleep(50) sleep(50)

View file

@ -21,9 +21,6 @@ class Monitor_Window(Thread):
Monitors window('plex_command') for new entries that we need to take care Monitors window('plex_command') for new entries that we need to take care
of, e.g. for new plays initiated on the Kodi side with addon paths. of, e.g. for new plays initiated on the Kodi side with addon paths.
Possible values of window('plex_command'):
'play_....': to start playback using playback_starter
Adjusts state.py accordingly Adjusts state.py accordingly
""" """
# Borg - multiple instances, shared state # Borg - multiple instances, shared state
@ -40,9 +37,8 @@ class Monitor_Window(Thread):
if window('plex_command'): if window('plex_command'):
value = window('plex_command') value = window('plex_command')
window('plex_command', clear=True) window('plex_command', clear=True)
if value.startswith('play_'): if value.startswith('PLAY-'):
queue.put(value) queue.put(value.replace('PLAY-', ''))
elif value == 'SUSPEND_LIBRARY_THREAD-True': elif value == 'SUSPEND_LIBRARY_THREAD-True':
state.SUSPEND_LIBRARY_THREAD = True state.SUSPEND_LIBRARY_THREAD = True
elif value == 'SUSPEND_LIBRARY_THREAD-False': elif value == 'SUSPEND_LIBRARY_THREAD-False':