This commit is contained in:
marcelveldt 2016-01-18 12:05:16 +01:00
commit 72d279a3a9
2 changed files with 34 additions and 30 deletions

View file

@ -494,7 +494,7 @@ class LibrarySync(threading.Thread):
heading="Emby for Kodi",
message="Comparing movies from view: %s..." % viewName)
all_embymovies = emby.getMovies(viewId, basic=True)
all_embymovies = emby.getMovies(viewId, basic=True, dialog=pdialog)
for embymovie in all_embymovies['Items']:
if self.shouldStop():
@ -515,7 +515,7 @@ class LibrarySync(threading.Thread):
del updatelist[:]
else:
# Initial or repair sync
all_embymovies = emby.getMovies(viewId)
all_embymovies = emby.getMovies(viewId, dialog=pdialog)
total = all_embymovies['TotalRecordCount']
embymovies = all_embymovies['Items']
@ -543,7 +543,7 @@ class LibrarySync(threading.Thread):
if pdialog:
pdialog.update(heading="Emby for Kodi", message="Gathering boxsets from server...")
boxsets = emby.getBoxset()
boxsets = emby.getBoxset(dialog=pdialog)
if compare:
# Manual sync
@ -652,7 +652,7 @@ class LibrarySync(threading.Thread):
heading="Emby for Kodi",
message="Comparing musicvideos from view: %s..." % viewName)
all_embymvideos = emby.getMusicVideos(viewId, basic=True)
all_embymvideos = emby.getMusicVideos(viewId, basic=True, dialog=pdialog)
for embymvideo in all_embymvideos['Items']:
if self.shouldStop():
@ -673,7 +673,7 @@ class LibrarySync(threading.Thread):
del updatelist[:]
else:
# Initial or repair sync
all_embymvideos = emby.getMusicVideos(viewId)
all_embymvideos = emby.getMusicVideos(viewId, dialog=pdialog)
total = all_embymvideos['TotalRecordCount']
embymvideos = all_embymvideos['Items']
@ -755,7 +755,7 @@ class LibrarySync(threading.Thread):
heading="Emby for Kodi",
message="Comparing tvshows from view: %s..." % viewName)
all_embytvshows = emby.getShows(viewId, basic=True)
all_embytvshows = emby.getShows(viewId, basic=True, dialog=pdialog)
for embytvshow in all_embytvshows['Items']:
if self.shouldStop():
@ -775,7 +775,7 @@ class LibrarySync(threading.Thread):
total = len(updatelist)
del updatelist[:]
else:
all_embytvshows = emby.getShows(viewId)
all_embytvshows = emby.getShows(viewId, dialog=pdialog)
total = all_embytvshows['TotalRecordCount']
embytvshows = all_embytvshows['Items']
@ -818,7 +818,7 @@ class LibrarySync(threading.Thread):
heading="Emby for Kodi",
message="Comparing episodes from view: %s..." % viewName)
all_embyepisodes = emby.getEpisodes(viewId, basic=True)
all_embyepisodes = emby.getEpisodes(viewId, basic=True, dialog=pdialog)
for embyepisode in all_embyepisodes['Items']:
if self.shouldStop():
@ -921,9 +921,9 @@ class LibrarySync(threading.Thread):
message="Comparing %s..." % type)
if type != "artists":
all_embyitems = process[type][0](basic=True)
all_embyitems = process[type][0](basic=True, dialog=pdialog)
else:
all_embyitems = process[type][0]()
all_embyitems = process[type][0](dialog=pdialog)
for embyitem in all_embyitems['Items']:
if self.shouldStop():
@ -952,7 +952,7 @@ class LibrarySync(threading.Thread):
total = len(updatelist)
del updatelist[:]
else:
all_embyitems = process[type][0]()
all_embyitems = process[type][0](dialog=pdialog)
total = all_embyitems['TotalRecordCount']
embyitems = all_embyitems['Items']

View file

@ -149,7 +149,7 @@ class Read_EmbyServer():
}
return doUtils.downloadUrl(url, parameters=params)
def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False):
def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False, dialog=None):
doUtils = self.doUtils
items = {
@ -219,7 +219,9 @@ class Read_EmbyServer():
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
def getViews(self, type, root=False):
@ -276,15 +278,15 @@ class Read_EmbyServer():
return views
def getMovies(self, parentId, basic=False):
def getMovies(self, parentId, basic=False, dialog=None):
items = self.getSection(parentId, "Movie", basic=basic)
items = self.getSection(parentId, "Movie", basic=basic, dialog=dialog)
return items
def getBoxset(self):
def getBoxset(self, dialog=None):
items = self.getSection(None, "BoxSet")
items = self.getSection(None, "BoxSet", dialog=dialog)
return items
@ -294,9 +296,9 @@ class Read_EmbyServer():
return items
def getMusicVideos(self, parentId, basic=False):
def getMusicVideos(self, parentId, basic=False, dialog=None):
items = self.getSection(parentId, "MusicVideo", basic=basic)
items = self.getSection(parentId, "MusicVideo", basic=basic, dialog=dialog)
return items
@ -306,9 +308,9 @@ class Read_EmbyServer():
return items
def getShows(self, parentId, basic=False):
def getShows(self, parentId, basic=False, dialog=None):
items = self.getSection(parentId, "Series", basic=basic)
items = self.getSection(parentId, "Series", basic=basic, dialog=dialog)
return items
@ -332,9 +334,9 @@ class Read_EmbyServer():
return items
def getEpisodes(self, parentId, basic=False):
def getEpisodes(self, parentId, basic=False, dialog=None):
items = self.getSection(parentId, "Episode", basic=basic)
items = self.getSection(parentId, "Episode", basic=basic, dialog=dialog)
return items
@ -350,7 +352,7 @@ class Read_EmbyServer():
return items
def getArtists(self):
def getArtists(self, dialog=None):
doUtils = self.doUtils
items = {
@ -406,12 +408,14 @@ class Read_EmbyServer():
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
def getAlbums(self, basic=False):
def getAlbums(self, basic=False, dialog=None):
items = self.getSection(None, "MusicAlbum", sortby="DateCreated", basic=basic)
items = self.getSection(None, "MusicAlbum", sortby="DateCreated", basic=basic, dialog=dialog)
return items
@ -421,9 +425,9 @@ class Read_EmbyServer():
return items
def getSongs(self, basic=False):
def getSongs(self, basic=False, dialog=None):
items = self.getSection(None, "Audio", basic=basic)
items = self.getSection(None, "Audio", basic=basic, dialog=dialog)
return items