Use 1 xbmcgui dialog instance in librarysync
This commit is contained in:
parent
b91145ecae
commit
ae51e43145
1 changed files with 28 additions and 26 deletions
|
@ -238,6 +238,7 @@ class LibrarySync(Thread):
|
||||||
self.user = userclient.UserClient()
|
self.user = userclient.UserClient()
|
||||||
self.emby = embyserver.Read_EmbyServer()
|
self.emby = embyserver.Read_EmbyServer()
|
||||||
self.vnodes = videonodes.VideoNodes()
|
self.vnodes = videonodes.VideoNodes()
|
||||||
|
self.dialog = xbmcgui.Dialog()
|
||||||
|
|
||||||
self.syncThreadNumber = int(utils.settings('syncThreadNumber'))
|
self.syncThreadNumber = int(utils.settings('syncThreadNumber'))
|
||||||
self.installSyncDone = True if \
|
self.installSyncDone = True if \
|
||||||
|
@ -266,23 +267,26 @@ class LibrarySync(Thread):
|
||||||
|
|
||||||
icon: "plex": shows Plex icon
|
icon: "plex": shows Plex icon
|
||||||
"error": shows Kodi error icon
|
"error": shows Kodi error icon
|
||||||
|
|
||||||
|
forced: always show popup, even if user setting to off
|
||||||
"""
|
"""
|
||||||
if not (self.showDbSync or forced):
|
if not self.showDbSync:
|
||||||
return
|
if not forced:
|
||||||
|
return
|
||||||
if icon == "plex":
|
if icon == "plex":
|
||||||
xbmcgui.Dialog().notification(
|
self.dialog.notification(
|
||||||
heading=self.addonName,
|
self.addonName,
|
||||||
message=message,
|
message,
|
||||||
icon="special://home/addons/plugin.video.plexkodiconnect/icon.png",
|
"special://home/addons/plugin.video.plexkodiconnect/icon.png",
|
||||||
time=5000,
|
5000,
|
||||||
sound=False)
|
False)
|
||||||
elif icon == "error":
|
elif icon == "error":
|
||||||
xbmcgui.Dialog().notification(
|
self.dialog.notification(
|
||||||
heading=self.addonName,
|
self.addonName,
|
||||||
message=message,
|
message,
|
||||||
icon=xbmcgui.NOTIFICATION_ERROR,
|
xbmcgui.NOTIFICATION_ERROR,
|
||||||
time=7000,
|
7000,
|
||||||
sound=True)
|
True)
|
||||||
|
|
||||||
def syncPMStime(self):
|
def syncPMStime(self):
|
||||||
"""
|
"""
|
||||||
|
@ -458,7 +462,7 @@ class LibrarySync(Thread):
|
||||||
utils.setScreensaver(value=screensaver)
|
utils.setScreensaver(value=screensaver)
|
||||||
# Show warning if itemtypes.py crashed at some point
|
# Show warning if itemtypes.py crashed at some point
|
||||||
if utils.window('plex_scancrashed') == 'true':
|
if utils.window('plex_scancrashed') == 'true':
|
||||||
xbmcgui.Dialog().ok(self.addonName, self.__language__(39408))
|
self.dialog.ok(self.addonName, self.__language__(39408))
|
||||||
utils.window('plex_scancrashed', clear=True)
|
utils.window('plex_scancrashed', clear=True)
|
||||||
|
|
||||||
# Path hack, so Kodis Information screen works
|
# Path hack, so Kodis Information screen works
|
||||||
|
@ -1431,7 +1435,7 @@ class LibrarySync(Thread):
|
||||||
self.logMsg('LibrarySync thread crashed', -1)
|
self.logMsg('LibrarySync thread crashed', -1)
|
||||||
self.logMsg('Error message: %s' % e, -1)
|
self.logMsg('Error message: %s' % e, -1)
|
||||||
# Library sync thread has crashed
|
# Library sync thread has crashed
|
||||||
xbmcgui.Dialog().ok(
|
self.dialog.ok(
|
||||||
heading=self.addonName,
|
heading=self.addonName,
|
||||||
line1=self.__language__(39400))
|
line1=self.__language__(39400))
|
||||||
raise
|
raise
|
||||||
|
@ -1453,8 +1457,6 @@ class LibrarySync(Thread):
|
||||||
|
|
||||||
xbmcplayer = xbmc.Player()
|
xbmcplayer = xbmc.Player()
|
||||||
|
|
||||||
dialog = xbmcgui.Dialog()
|
|
||||||
|
|
||||||
queue = self.queue
|
queue = self.queue
|
||||||
|
|
||||||
startupComplete = False
|
startupComplete = False
|
||||||
|
@ -1482,13 +1484,13 @@ class LibrarySync(Thread):
|
||||||
log("Db version out of date: %s minimum version required: "
|
log("Db version out of date: %s minimum version required: "
|
||||||
"%s" % (currentVersion, minVersion), 0)
|
"%s" % (currentVersion, minVersion), 0)
|
||||||
# DB out of date. Proceed to recreate?
|
# DB out of date. Proceed to recreate?
|
||||||
resp = dialog.yesno(heading=self.addonName,
|
resp = self.dialog.yesno(heading=self.addonName,
|
||||||
line1=string(39401))
|
line1=string(39401))
|
||||||
if not resp:
|
if not resp:
|
||||||
log("Db version out of date! USER IGNORED!", 0)
|
log("Db version out of date! USER IGNORED!", 0)
|
||||||
# PKC may not work correctly until reset
|
# PKC may not work correctly until reset
|
||||||
dialog.ok(heading=self.addonName,
|
self.dialog.ok(heading=self.addonName,
|
||||||
line1=(self.addonName + string(39402)))
|
line1=(self.addonName + string(39402)))
|
||||||
else:
|
else:
|
||||||
utils.reset()
|
utils.reset()
|
||||||
break
|
break
|
||||||
|
@ -1506,8 +1508,8 @@ class LibrarySync(Thread):
|
||||||
log('Current Kodi version: %s' % xbmc.getInfoLabel(
|
log('Current Kodi version: %s' % xbmc.getInfoLabel(
|
||||||
'System.BuildVersion').decode('utf-8'))
|
'System.BuildVersion').decode('utf-8'))
|
||||||
# "Current Kodi version is unsupported, cancel lib sync"
|
# "Current Kodi version is unsupported, cancel lib sync"
|
||||||
dialog.ok(heading=self.addonName,
|
self.dialog.ok(heading=self.addonName,
|
||||||
line1=string(39403))
|
line1=string(39403))
|
||||||
break
|
break
|
||||||
|
|
||||||
# Run start up sync
|
# Run start up sync
|
||||||
|
@ -1532,8 +1534,8 @@ class LibrarySync(Thread):
|
||||||
log("Startup full sync failed. Stopping sync", -1)
|
log("Startup full sync failed. Stopping sync", -1)
|
||||||
# "Startup syncing process failed repeatedly"
|
# "Startup syncing process failed repeatedly"
|
||||||
# "Please restart"
|
# "Please restart"
|
||||||
dialog.ok(heading=self.addonName,
|
self.dialog.ok(heading=self.addonName,
|
||||||
line1=string(39404))
|
line1=string(39404))
|
||||||
break
|
break
|
||||||
|
|
||||||
# Currently no db scan, so we can start a new scan
|
# Currently no db scan, so we can start a new scan
|
||||||
|
|
Loading…
Reference in a new issue