From 9b01e5a6c7fb8cdf2a87c4b4c8121c8800517144 Mon Sep 17 00:00:00 2001 From: ArchieMeng Date: Sat, 6 Mar 2021 22:54:26 +0800 Subject: [PATCH] fix bug: crash on opening subtitles --- lib/xbmcswift2/xbmcmixin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/xbmcswift2/xbmcmixin.py b/lib/xbmcswift2/xbmcmixin.py index f613187..58eb174 100644 --- a/lib/xbmcswift2/xbmcmixin.py +++ b/lib/xbmcswift2/xbmcmixin.py @@ -312,9 +312,13 @@ def _add_subtitles(self, subtitles): # this method. player = xbmc.Player() monitor = xbmc.Monitor() - for _ in range(30) and not monitor.abortRequested(): + for _ in range(30): if player.isPlaying(): break + + if monitor.abortRequested(): + return + monitor.waitForAbort(1) else: raise Exception('No video playing. Aborted after 30 seconds.')