This commit is contained in:
marcelveldt 2016-01-19 21:28:05 +01:00
commit 7e81db596e
8 changed files with 35 additions and 44 deletions

View file

@ -170,10 +170,9 @@ class Artwork():
if not xbmcgui.Dialog().yesno("Image Texture Cache", "Running the image cache process can take some time.", "Are you sure you want continue?"):
return
self.logMsg("Doing Image Cache Sync", 1)
dialog = xbmcgui.DialogProgressBG()
dialog = xbmcgui.DialogProgress()
dialog.create("Emby for Kodi", "Image Cache Sync")
# ask to rest all existing or not
@ -213,9 +212,11 @@ class Artwork():
percentage = 0
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
for url in result:
if dialog.iscanceled():
break
percentage = int((float(count) / float(total))*100)
textMessage = str(count) + " of " + str(total) + " (" + str(len(self.imageCacheThreads)) + ")"
dialog.update(percentage, message="Updating Image Cache: " + textMessage)
dialog.update(percentage, "Updating Image Cache: " + textMessage)
self.CacheTexture(url[0])
count += 1
cursor.close()
@ -230,20 +231,22 @@ class Artwork():
percentage = 0
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
for url in result:
if dialog.iscanceled():
break
percentage = int((float(count) / float(total))*100)
textMessage = str(count) + " of " + str(total)
dialog.update(percentage, message="Updating Image Cache: " + textMessage)
dialog.update(percentage, "Updating Image Cache: " + textMessage)
self.CacheTexture(url[0])
count += 1
cursor.close()
dialog.update(100, message="Waiting for all threads to exit: " + str(len(self.imageCacheThreads)))
dialog.update(100, "Waiting for all threads to exit: " + str(len(self.imageCacheThreads)))
self.logMsg("Waiting for all threads to exit", 1)
while len(self.imageCacheThreads) > 0:
for thread in self.imageCacheThreads:
if thread.isFinished:
self.imageCacheThreads.remove(thread)
dialog.update(100, message="Waiting for all threads to exit: " + str(len(self.imageCacheThreads)))
dialog.update(100, "Waiting for all threads to exit: " + str(len(self.imageCacheThreads)))
self.logMsg("Waiting for all threads to exit: " + str(len(self.imageCacheThreads)), 1)
xbmc.sleep(500)

View file

@ -200,6 +200,5 @@ class KodiMonitor(xbmc.Monitor):
utils.window('emby_onWake', value="true")
elif method == "Playlist.OnClear":
utils.window('emby_customPlaylist', clear=True, windowid=10101)
#xbmcgui.Window(10101).clearProperties()
utils.window('emby_customPlaylist', clear=True)
self.logMsg("Clear playlist properties.")

View file

@ -251,6 +251,9 @@ class LibrarySync(threading.Thread):
self.logMsg(
"SyncDatabase (finished %s in: %s)"
% (itemtype, str(elapsedTime).split('.')[0]), 1)
else:
# Close the Kodi cursor
kodicursor.close()
# sync music
if music_enabled:
@ -282,7 +285,6 @@ class LibrarySync(threading.Thread):
pDialog.close()
embycursor.close()
kodicursor.close()
utils.settings('SyncInstallRunDone', value="true")
utils.settings("dbCreatedWithVersion", self.clientInfo.getVersion())

View file

@ -74,7 +74,7 @@ class PlaybackUtils():
sizePlaylist = playlist.size()
currentPosition = startPos
propertiesPlayback = utils.window('emby_playbackProps', windowid=10101) == "true"
propertiesPlayback = utils.window('emby_playbackProps') == "true"
introsPlaylist = False
dummyPlaylist = False
@ -91,11 +91,11 @@ class PlaybackUtils():
# Otherwise we get a loop.
if not propertiesPlayback:
utils.window('emby_playbackProps', value="true", windowid=10101)
utils.window('emby_playbackProps', value="true")
self.logMsg("Setting up properties in playlist.", 1)
if (not homeScreen and not seektime and
utils.window('emby_customPlaylist', windowid=10101) != "true"):
utils.window('emby_customPlaylist') != "true"):
self.logMsg("Adding dummy file to playlist.", 2)
dummyPlaylist = True
@ -182,7 +182,7 @@ class PlaybackUtils():
# We just skipped adding properties. Reset flag for next time.
elif propertiesPlayback:
self.logMsg("Resetting properties playback flag.", 2)
utils.window('emby_playbackProps', clear=True, windowid=10101)
utils.window('emby_playbackProps', clear=True)
#self.pl.verifyPlaylist()
########## SETUP MAIN ITEM ##########
@ -202,7 +202,7 @@ class PlaybackUtils():
self.setListItem(listitem)
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listitem)
elif ((introsPlaylist and utils.window('emby_customPlaylist', windowid=10101) == "true") or
elif ((introsPlaylist and utils.window('emby_customPlaylist') == "true") or
(homeScreen and not sizePlaylist)):
# Playlist was created just now, play it.
self.logMsg("Play playlist.", 1)

View file

@ -400,8 +400,9 @@ class Player(xbmc.Player):
def onPlayBackStopped( self ):
# Will be called when user stops xbmc playing a file
self.logMsg("ONPLAYBACK_STOPPED", 2)
xbmcgui.Window(10101).clearProperties()
self.logMsg("Clear playlist properties.")
utils.window('emby_customPlaylist', clear=True)
utils.window('emby_playbackProps', clear=True)
self.logMsg("Clear playlist properties.", 1)
self.stopAll()
def onPlayBackEnded( self ):

View file

@ -51,7 +51,7 @@ class Playlist():
playlist.clear()
started = False
utils.window('emby_customplaylist', value="true", windowid=10101)
utils.window('emby_customplaylist', value="true")
position = 0

View file

@ -240,18 +240,12 @@ class Read_EmbyServer():
"MediaSources"
)
result = doUtils.downloadUrl(url, parameters=params)
try:
items['Items'].extend(result['Items'])
except TypeError:
# Connection timed out, reduce the number
jump -= 50
self.limitindex = jump
self.logMsg("New throttle for items requested: %s" % jump, 1)
else:
index += jump
if dialog:
percentage = int((float(index) / float(total))*100)
dialog.update(percentage)
items['Items'].extend(result['Items'])
index += jump
if dialog:
percentage = int((float(index) / float(total))*100)
dialog.update(percentage)
return items
def getViews(self, type, root=False):
@ -429,18 +423,12 @@ class Read_EmbyServer():
)
}
result = doUtils.downloadUrl(url, parameters=params)
try:
items['Items'].extend(result['Items'])
except TypeError:
# Connection timed out, reduce the number
jump -= 50
self.limitindex = jump
self.logMsg("New throttle for items requested: %s" % jump, 1)
else:
index += jump
if dialog:
percentage = int((float(index) / float(total))*100)
dialog.update(percentage)
items['Items'].extend(result['Items'])
index += jump
if dialog:
percentage = int((float(index) / float(total))*100)
dialog.update(percentage)
return items
def getAlbums(self, basic=False, dialog=None):

View file

@ -71,13 +71,11 @@ class Service():
"emby_online", "emby_serverStatus", "emby_onWake",
"emby_syncRunning", "emby_dbCheck", "emby_kodiScan",
"emby_shouldStop", "emby_currUser", "emby_dbScan", "emby_sessionId",
"emby_initialScan"
"emby_initialScan", "emby_customplaylist", "emby_playbackProps"
]
for prop in properties:
utils.window(prop, clear=True)
# Clear playlist properties
xbmcgui.Window(10101).clearProperties()
# Clear video nodes properties
videonodes.VideoNodes().clearProperties()