Ensure shows are deleted before seasons before episodes

This commit is contained in:
croneter 2018-09-23 13:52:08 +02:00
parent 35d0f6a49d
commit 21fb1ad015

View file

@ -6,6 +6,7 @@ from threading import Thread
import Queue import Queue
from random import shuffle from random import shuffle
import copy import copy
from collections import OrderedDict
import xbmc import xbmc
from xbmcvfs import exists from xbmcvfs import exists
@ -65,7 +66,7 @@ class LibrarySync(Thread):
self.old_views = [] self.old_views = []
self.updatelist = [] self.updatelist = []
self.all_plex_ids = {} self.all_plex_ids = {}
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
Thread.__init__(self) Thread.__init__(self)
def suspend_item_sync(self): def suspend_item_sync(self):
@ -726,16 +727,16 @@ class LibrarySync(Thread):
views = [x for x in self.views if x['itemtype'] == v.KODI_TYPE_MOVIE] views = [x for x in self.views if x['itemtype'] == v.KODI_TYPE_MOVIE]
LOG.info("Processing Plex %s. Libraries: %s", item_class, views) LOG.info("Processing Plex %s. Libraries: %s", item_class, views)
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
if self.compare: if self.compare:
with plexdb.Get_Plex_DB() as plex_db: with plexdb.Get_Plex_DB() as plex_db:
# Get movies from Plex server # Get movies from Plex server
# Pull the list of movies and boxsets in Kodi # Pull the list of movies and boxsets in Kodi
try: try:
self.all_kodi_ids = dict( self.all_kodi_ids = OrderedDict(
plex_db.checksum(v.PLEX_TYPE_MOVIE)) plex_db.checksum(v.PLEX_TYPE_MOVIE))
except ValueError: except ValueError:
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
# PROCESS MOVIES ##### # PROCESS MOVIES #####
self.updatelist = [] self.updatelist = []
@ -813,7 +814,7 @@ class LibrarySync(Thread):
views = [x for x in self.views if x['itemtype'] == 'show'] views = [x for x in self.views if x['itemtype'] == 'show']
LOG.info("Media folders for %s: %s", item_class, views) LOG.info("Media folders for %s: %s", item_class, views)
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
if self.compare: if self.compare:
with plexdb.Get_Plex_DB() as plex: with plexdb.Get_Plex_DB() as plex:
# Pull the list of TV shows already in Kodi # Pull the list of TV shows already in Kodi
@ -961,7 +962,7 @@ class LibrarySync(Thread):
if self.suspend_item_sync(): if self.suspend_item_sync():
return False return False
LOG.debug("Start processing music %s", kind) LOG.debug("Start processing music %s", kind)
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
self.all_plex_ids = {} self.all_plex_ids = {}
self.updatelist = [] self.updatelist = []
if not self.process_music(views, if not self.process_music(views,
@ -980,7 +981,7 @@ class LibrarySync(Thread):
self.plex_update_watched(view['id'], item_class) self.plex_update_watched(view['id'], item_class)
# reset stuff # reset stuff
self.all_kodi_ids = {} self.all_kodi_ids = OrderedDict()
self.all_plex_ids = {} self.all_plex_ids = {}
self.updatelist = [] self.updatelist = []
LOG.info("%s sync is finished.", item_class) LOG.info("%s sync is finished.", item_class)