mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Merge branch 'master' of https://github.com/MediaBrowser/Emby.Kodi
This commit is contained in:
commit
7e81db596e
8 changed files with 35 additions and 44 deletions
|
@ -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?"):
|
if not xbmcgui.Dialog().yesno("Image Texture Cache", "Running the image cache process can take some time.", "Are you sure you want continue?"):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
self.logMsg("Doing Image Cache Sync", 1)
|
self.logMsg("Doing Image Cache Sync", 1)
|
||||||
|
|
||||||
dialog = xbmcgui.DialogProgressBG()
|
dialog = xbmcgui.DialogProgress()
|
||||||
dialog.create("Emby for Kodi", "Image Cache Sync")
|
dialog.create("Emby for Kodi", "Image Cache Sync")
|
||||||
|
|
||||||
# ask to rest all existing or not
|
# ask to rest all existing or not
|
||||||
|
@ -213,9 +212,11 @@ class Artwork():
|
||||||
percentage = 0
|
percentage = 0
|
||||||
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
|
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
|
||||||
for url in result:
|
for url in result:
|
||||||
|
if dialog.iscanceled():
|
||||||
|
break
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
textMessage = str(count) + " of " + str(total) + " (" + str(len(self.imageCacheThreads)) + ")"
|
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])
|
self.CacheTexture(url[0])
|
||||||
count += 1
|
count += 1
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
@ -230,20 +231,22 @@ class Artwork():
|
||||||
percentage = 0
|
percentage = 0
|
||||||
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
|
self.logMsg("Image cache sync about to process " + str(total) + " images", 1)
|
||||||
for url in result:
|
for url in result:
|
||||||
|
if dialog.iscanceled():
|
||||||
|
break
|
||||||
percentage = int((float(count) / float(total))*100)
|
percentage = int((float(count) / float(total))*100)
|
||||||
textMessage = str(count) + " of " + str(total)
|
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])
|
self.CacheTexture(url[0])
|
||||||
count += 1
|
count += 1
|
||||||
cursor.close()
|
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)
|
self.logMsg("Waiting for all threads to exit", 1)
|
||||||
while len(self.imageCacheThreads) > 0:
|
while len(self.imageCacheThreads) > 0:
|
||||||
for thread in self.imageCacheThreads:
|
for thread in self.imageCacheThreads:
|
||||||
if thread.isFinished:
|
if thread.isFinished:
|
||||||
self.imageCacheThreads.remove(thread)
|
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)
|
self.logMsg("Waiting for all threads to exit: " + str(len(self.imageCacheThreads)), 1)
|
||||||
xbmc.sleep(500)
|
xbmc.sleep(500)
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,5 @@ class KodiMonitor(xbmc.Monitor):
|
||||||
utils.window('emby_onWake', value="true")
|
utils.window('emby_onWake', value="true")
|
||||||
|
|
||||||
elif method == "Playlist.OnClear":
|
elif method == "Playlist.OnClear":
|
||||||
utils.window('emby_customPlaylist', clear=True, windowid=10101)
|
utils.window('emby_customPlaylist', clear=True)
|
||||||
#xbmcgui.Window(10101).clearProperties()
|
|
||||||
self.logMsg("Clear playlist properties.")
|
self.logMsg("Clear playlist properties.")
|
|
@ -251,6 +251,9 @@ class LibrarySync(threading.Thread):
|
||||||
self.logMsg(
|
self.logMsg(
|
||||||
"SyncDatabase (finished %s in: %s)"
|
"SyncDatabase (finished %s in: %s)"
|
||||||
% (itemtype, str(elapsedTime).split('.')[0]), 1)
|
% (itemtype, str(elapsedTime).split('.')[0]), 1)
|
||||||
|
else:
|
||||||
|
# Close the Kodi cursor
|
||||||
|
kodicursor.close()
|
||||||
|
|
||||||
# sync music
|
# sync music
|
||||||
if music_enabled:
|
if music_enabled:
|
||||||
|
@ -282,7 +285,6 @@ class LibrarySync(threading.Thread):
|
||||||
pDialog.close()
|
pDialog.close()
|
||||||
|
|
||||||
embycursor.close()
|
embycursor.close()
|
||||||
kodicursor.close()
|
|
||||||
|
|
||||||
utils.settings('SyncInstallRunDone', value="true")
|
utils.settings('SyncInstallRunDone', value="true")
|
||||||
utils.settings("dbCreatedWithVersion", self.clientInfo.getVersion())
|
utils.settings("dbCreatedWithVersion", self.clientInfo.getVersion())
|
||||||
|
|
|
@ -74,7 +74,7 @@ class PlaybackUtils():
|
||||||
sizePlaylist = playlist.size()
|
sizePlaylist = playlist.size()
|
||||||
currentPosition = startPos
|
currentPosition = startPos
|
||||||
|
|
||||||
propertiesPlayback = utils.window('emby_playbackProps', windowid=10101) == "true"
|
propertiesPlayback = utils.window('emby_playbackProps') == "true"
|
||||||
introsPlaylist = False
|
introsPlaylist = False
|
||||||
dummyPlaylist = False
|
dummyPlaylist = False
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ class PlaybackUtils():
|
||||||
# Otherwise we get a loop.
|
# Otherwise we get a loop.
|
||||||
if not propertiesPlayback:
|
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)
|
self.logMsg("Setting up properties in playlist.", 1)
|
||||||
|
|
||||||
if (not homeScreen and not seektime and
|
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)
|
self.logMsg("Adding dummy file to playlist.", 2)
|
||||||
dummyPlaylist = True
|
dummyPlaylist = True
|
||||||
|
@ -182,7 +182,7 @@ class PlaybackUtils():
|
||||||
# We just skipped adding properties. Reset flag for next time.
|
# We just skipped adding properties. Reset flag for next time.
|
||||||
elif propertiesPlayback:
|
elif propertiesPlayback:
|
||||||
self.logMsg("Resetting properties playback flag.", 2)
|
self.logMsg("Resetting properties playback flag.", 2)
|
||||||
utils.window('emby_playbackProps', clear=True, windowid=10101)
|
utils.window('emby_playbackProps', clear=True)
|
||||||
|
|
||||||
#self.pl.verifyPlaylist()
|
#self.pl.verifyPlaylist()
|
||||||
########## SETUP MAIN ITEM ##########
|
########## SETUP MAIN ITEM ##########
|
||||||
|
@ -202,7 +202,7 @@ class PlaybackUtils():
|
||||||
self.setListItem(listitem)
|
self.setListItem(listitem)
|
||||||
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, 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)):
|
(homeScreen and not sizePlaylist)):
|
||||||
# Playlist was created just now, play it.
|
# Playlist was created just now, play it.
|
||||||
self.logMsg("Play playlist.", 1)
|
self.logMsg("Play playlist.", 1)
|
||||||
|
|
|
@ -400,8 +400,9 @@ class Player(xbmc.Player):
|
||||||
def onPlayBackStopped( self ):
|
def onPlayBackStopped( self ):
|
||||||
# Will be called when user stops xbmc playing a file
|
# Will be called when user stops xbmc playing a file
|
||||||
self.logMsg("ONPLAYBACK_STOPPED", 2)
|
self.logMsg("ONPLAYBACK_STOPPED", 2)
|
||||||
xbmcgui.Window(10101).clearProperties()
|
utils.window('emby_customPlaylist', clear=True)
|
||||||
self.logMsg("Clear playlist properties.")
|
utils.window('emby_playbackProps', clear=True)
|
||||||
|
self.logMsg("Clear playlist properties.", 1)
|
||||||
self.stopAll()
|
self.stopAll()
|
||||||
|
|
||||||
def onPlayBackEnded( self ):
|
def onPlayBackEnded( self ):
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Playlist():
|
||||||
playlist.clear()
|
playlist.clear()
|
||||||
started = False
|
started = False
|
||||||
|
|
||||||
utils.window('emby_customplaylist', value="true", windowid=10101)
|
utils.window('emby_customplaylist', value="true")
|
||||||
|
|
||||||
position = 0
|
position = 0
|
||||||
|
|
||||||
|
|
|
@ -240,18 +240,12 @@ class Read_EmbyServer():
|
||||||
"MediaSources"
|
"MediaSources"
|
||||||
)
|
)
|
||||||
result = doUtils.downloadUrl(url, parameters=params)
|
result = doUtils.downloadUrl(url, parameters=params)
|
||||||
try:
|
items['Items'].extend(result['Items'])
|
||||||
items['Items'].extend(result['Items'])
|
|
||||||
except TypeError:
|
index += jump
|
||||||
# Connection timed out, reduce the number
|
if dialog:
|
||||||
jump -= 50
|
percentage = int((float(index) / float(total))*100)
|
||||||
self.limitindex = jump
|
dialog.update(percentage)
|
||||||
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)
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getViews(self, type, root=False):
|
def getViews(self, type, root=False):
|
||||||
|
@ -429,18 +423,12 @@ class Read_EmbyServer():
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
result = doUtils.downloadUrl(url, parameters=params)
|
result = doUtils.downloadUrl(url, parameters=params)
|
||||||
try:
|
items['Items'].extend(result['Items'])
|
||||||
items['Items'].extend(result['Items'])
|
|
||||||
except TypeError:
|
index += jump
|
||||||
# Connection timed out, reduce the number
|
if dialog:
|
||||||
jump -= 50
|
percentage = int((float(index) / float(total))*100)
|
||||||
self.limitindex = jump
|
dialog.update(percentage)
|
||||||
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)
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getAlbums(self, basic=False, dialog=None):
|
def getAlbums(self, basic=False, dialog=None):
|
||||||
|
|
|
@ -71,13 +71,11 @@ class Service():
|
||||||
"emby_online", "emby_serverStatus", "emby_onWake",
|
"emby_online", "emby_serverStatus", "emby_onWake",
|
||||||
"emby_syncRunning", "emby_dbCheck", "emby_kodiScan",
|
"emby_syncRunning", "emby_dbCheck", "emby_kodiScan",
|
||||||
"emby_shouldStop", "emby_currUser", "emby_dbScan", "emby_sessionId",
|
"emby_shouldStop", "emby_currUser", "emby_dbScan", "emby_sessionId",
|
||||||
"emby_initialScan"
|
"emby_initialScan", "emby_customplaylist", "emby_playbackProps"
|
||||||
]
|
]
|
||||||
for prop in properties:
|
for prop in properties:
|
||||||
utils.window(prop, clear=True)
|
utils.window(prop, clear=True)
|
||||||
|
|
||||||
# Clear playlist properties
|
|
||||||
xbmcgui.Window(10101).clearProperties()
|
|
||||||
# Clear video nodes properties
|
# Clear video nodes properties
|
||||||
videonodes.VideoNodes().clearProperties()
|
videonodes.VideoNodes().clearProperties()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue