Simplify conditional into switch-like form

This commit is contained in:
Brian Pepple 2020-09-27 11:18:34 -04:00 committed by Odd Stråbø
parent 5e188e63dd
commit 5b1e4c7eab
1 changed files with 5 additions and 7 deletions

View File

@ -255,19 +255,17 @@ class Monitor(xbmc.Monitor):
if command in ('Mute', 'Unmute', 'SetVolume', if command in ('Mute', 'Unmute', 'SetVolume',
'SetSubtitleStreamIndex', 'SetAudioStreamIndex', 'SetRepeatMode'): 'SetSubtitleStreamIndex', 'SetAudioStreamIndex', 'SetRepeatMode'):
if command == 'Mute': if command in ['Mute', 'Unmute']:
xbmc.executebuiltin('Mute') xbmc.executebuiltin('Mute')
elif command == 'Unmute':
xbmc.executebuiltin('Mute')
elif command == 'SetVolume':
xbmc.executebuiltin('SetVolume(%s[,showvolumebar])' % args['Volume'])
elif command == 'SetRepeatMode':
xbmc.executebuiltin('xbmc.PlayerControl(%s)' % args['RepeatMode'])
elif command == 'SetAudioStreamIndex': elif command == 'SetAudioStreamIndex':
self.player.set_audio_subs(args['Index']) self.player.set_audio_subs(args['Index'])
elif command == 'SetRepeatMode':
xbmc.executebuiltin('xbmc.PlayerControl(%s)' % args['RepeatMode'])
elif command == 'SetSubtitleStreamIndex': elif command == 'SetSubtitleStreamIndex':
self.player.set_audio_subs(None, args['Index']) self.player.set_audio_subs(None, args['Index'])
elif command == 'SetVolume':
xbmc.executebuiltin('SetVolume(%s[,showvolumebar])' % args['Volume'])
# Kodi needs a bit of time to update it's current status # Kodi needs a bit of time to update it's current status
xbmc.sleep(500) xbmc.sleep(500)
self.player.report_playback() self.player.report_playback()