diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index f7d24ad0..2a812a8f 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -402,8 +402,9 @@ class LibrarySync(threading.Thread): heading=lang(29999), message="%s %s..." % (lang(33017), view_name)) + movies.count = 0 for all_movies in mb.get_items(view['id'], "Movie"): - movies.add_all("Movie", all_movies['Items'], view) + movies.add_all("Movie", all_movies, view) log.debug("Movies finished.") return True @@ -415,6 +416,7 @@ class LibrarySync(threading.Thread): if pdialog: pdialog.update(heading=lang(29999), message=lang(33018)) + movies.count = 0 for boxsets in mb.get_items(None, "BoxSet"): movies.add_all("BoxSet", boxsets) @@ -442,8 +444,9 @@ class LibrarySync(threading.Thread): message="%s %s..." % (lang(33019), viewName)) # Initial or repair sync + mvideos.count = 0 for all_mvideos in mb.get_items(view['id'], "MusicVideo"): - mvideos.add_all("MusicVideo", all_mvideos['Items'], view) + mvideos.add_all("MusicVideo", all_mvideos, view) else: log.debug("MusicVideos finished.") @@ -468,8 +471,9 @@ class LibrarySync(threading.Thread): heading=lang(29999), message="%s %s..." % (lang(33020), view['name'])) + tvshows.count = 0 for all_tvshows in mb.get_items(view['id'], "Series"): - tvshows.add_all("Series", all_tvshows['Items'], view) + tvshows.add_all("Series", all_tvshows, view) else: log.debug("TVShows finished.") @@ -491,8 +495,9 @@ class LibrarySync(threading.Thread): for view in views: + music.count = 0 for all_artists in mb.get_artists(view['id']): - music.add_all("MusicArtist", all_artists['Items']) + music.add_all("MusicArtist", all_artists) log.debug("Finished syncing music") diff --git a/resources/lib/objects/_common.py b/resources/lib/objects/_common.py index 5535c8dc..7037d2a0 100644 --- a/resources/lib/objects/_common.py +++ b/resources/lib/objects/_common.py @@ -119,7 +119,6 @@ class Items(object): process = self._get_func(item_type, action) self.total = total or len(items) - self.count = 0 for item in items: @@ -147,7 +146,6 @@ class Items(object): # Generator for newly added content if update: self.total = total or len(items) - self.count = 0 for item in items: @@ -156,8 +154,8 @@ class Items(object): self.title = item.get('Name', "unknown") - yield item self.update_pdialog() + yield item if update: self.count += 1