From 5b1e4c7eab9f26432c2a1d1b36bbfee1524dc21c Mon Sep 17 00:00:00 2001 From: Brian Pepple Date: Sun, 27 Sep 2020 11:18:34 -0400 Subject: [PATCH] Simplify conditional into switch-like form --- jellyfin_kodi/monitor.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/jellyfin_kodi/monitor.py b/jellyfin_kodi/monitor.py index 08756386..d1928fa2 100644 --- a/jellyfin_kodi/monitor.py +++ b/jellyfin_kodi/monitor.py @@ -255,19 +255,17 @@ class Monitor(xbmc.Monitor): if command in ('Mute', 'Unmute', 'SetVolume', 'SetSubtitleStreamIndex', 'SetAudioStreamIndex', 'SetRepeatMode'): - if command == 'Mute': + if command in ['Mute', 'Unmute']: 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': self.player.set_audio_subs(args['Index']) + elif command == 'SetRepeatMode': + xbmc.executebuiltin('xbmc.PlayerControl(%s)' % args['RepeatMode']) elif command == 'SetSubtitleStreamIndex': 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 xbmc.sleep(500) self.player.report_playback()