Fix deleting items after Plex library removal
This commit is contained in:
parent
38a6c1eae6
commit
524a36d9eb
1 changed files with 17 additions and 12 deletions
|
@ -863,21 +863,26 @@ class LibrarySync(Thread):
|
||||||
for view in self.old_views:
|
for view in self.old_views:
|
||||||
plex_db.removeView(view)
|
plex_db.removeView(view)
|
||||||
delete_items.extend(plex_db.get_items_by_viewid(view))
|
delete_items.extend(plex_db.get_items_by_viewid(view))
|
||||||
# All video removals are the same, so pick Movies() class
|
delete_movies = []
|
||||||
|
delete_tv = []
|
||||||
|
delete_music = []
|
||||||
|
for item in delete_items:
|
||||||
|
if item['kodi_type'] == v.KODI_TYPE_MOVIE:
|
||||||
|
delete_movies.append(item)
|
||||||
|
elif item['kodi_type'] in v.KODI_VIDEOTYPES:
|
||||||
|
delete_tv.append(item)
|
||||||
|
elif item['kodi_type'] in v.KODI_AUDIOTYPES:
|
||||||
|
delete_music.append(item)
|
||||||
|
|
||||||
|
for item in delete_movies:
|
||||||
with itemtypes.Movies() as movie:
|
with itemtypes.Movies() as movie:
|
||||||
for item in (i for i in delete_items
|
|
||||||
if i['kodi_type'] == v.KODI_TYPE_MOVIE):
|
|
||||||
movie.remove(item['plex_id'])
|
movie.remove(item['plex_id'])
|
||||||
|
for item in delete_tv:
|
||||||
with itemtypes.TVShows() as tv:
|
with itemtypes.TVShows() as tv:
|
||||||
for item in (i for i in delete_items
|
|
||||||
if i['kodi_type'] in (v.KODI_TYPE_EPISODE,
|
|
||||||
v.KODI_TYPE_SEASON,
|
|
||||||
v.KODI_TYPE_SHOW)):
|
|
||||||
tv.remove(item['plex_id'])
|
tv.remove(item['plex_id'])
|
||||||
# And for the music DB:
|
# And for the music DB:
|
||||||
|
for item in delete_music:
|
||||||
with itemtypes.Music() as music:
|
with itemtypes.Music() as music:
|
||||||
for item in (i for i in delete_items
|
|
||||||
if i['kodi_type'] in v.KODI_AUDIOTYPES):
|
|
||||||
music.remove(item['plex_id'])
|
music.remove(item['plex_id'])
|
||||||
|
|
||||||
def GetUpdatelist(self, xml, itemType, method, viewName, viewId):
|
def GetUpdatelist(self, xml, itemType, method, viewName, viewId):
|
||||||
|
|
Loading…
Reference in a new issue