From ff6bacf415982e46e3e3eeec7b50aed30345dab1 Mon Sep 17 00:00:00 2001
From: Sebastian S <su4lfred@gmail.com>
Date: Sat, 19 Jan 2019 13:17:50 +0100
Subject: [PATCH] Don't clear playlist if busy spinner is active

---
 resources/lib/monitor.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/resources/lib/monitor.py b/resources/lib/monitor.py
index ab031086..d488092b 100644
--- a/resources/lib/monitor.py
+++ b/resources/lib/monitor.py
@@ -84,9 +84,9 @@ class Monitor(xbmc.Monitor):
                     Otherwise the next played item will be added the previous queue.
                 '''
                 if method == "Player.OnStop":
-                    xbmc.sleep(2000) # let's wait for the player so we don't clear the canceled playlist by mistake.
+                    xbmc.sleep(3000) # let's wait for the player so we don't clear the canceled playlist by mistake.
 
-                    if xbmc.getCondVisibility("!Player.HasMedia"):
+                    if xbmc.getCondVisibility("!Player.HasMedia + !Window.IsVisible(busydialog)"):
 
                         xbmc.executebuiltin("Playlist.Clear")
                         LOG.info("[ playlist ] cleared")