Fixed initial sync
This commit is contained in:
parent
4332d08292
commit
0b38176fa9
1 changed files with 36 additions and 37 deletions
|
@ -60,12 +60,12 @@ class ThreadedGetMetadata(threading.Thread):
|
||||||
continue
|
continue
|
||||||
# Download Metadata
|
# Download Metadata
|
||||||
try:
|
try:
|
||||||
updateItem['XML'] = plx.GetPlexMetadata(updateItem['itemId'])
|
plexXML = plx.GetPlexMetadata(updateItem['itemId'])
|
||||||
except:
|
except:
|
||||||
raise
|
raise
|
||||||
|
updateItem['XML'] = plexXML
|
||||||
# place item into out queue
|
# place item into out queue
|
||||||
self.out_queue.put(updateItem)
|
self.out_queue.put(updateItem)
|
||||||
del updateItem
|
|
||||||
# Keep track of where we are at
|
# Keep track of where we are at
|
||||||
with self.lock:
|
with self.lock:
|
||||||
getMetadataCount += 1
|
getMetadataCount += 1
|
||||||
|
@ -121,7 +121,6 @@ class ThreadedProcessMetadata(threading.Thread):
|
||||||
title = updateItem['title']
|
title = updateItem['title']
|
||||||
itemSubFkt = getattr(item, method)
|
itemSubFkt = getattr(item, method)
|
||||||
with self.lock:
|
with self.lock:
|
||||||
try:
|
|
||||||
itemSubFkt(
|
itemSubFkt(
|
||||||
plexitem,
|
plexitem,
|
||||||
viewtag=viewName,
|
viewtag=viewName,
|
||||||
|
@ -130,8 +129,6 @@ class ThreadedProcessMetadata(threading.Thread):
|
||||||
# Keep track of where we are at
|
# Keep track of where we are at
|
||||||
processMetadataCount += 1
|
processMetadataCount += 1
|
||||||
processingViewName = title
|
processingViewName = title
|
||||||
except:
|
|
||||||
raise
|
|
||||||
# signals to queue job is done
|
# signals to queue job is done
|
||||||
self.queue.task_done()
|
self.queue.task_done()
|
||||||
|
|
||||||
|
@ -599,42 +596,44 @@ class LibrarySync(threading.Thread):
|
||||||
# Manual sync
|
# Manual sync
|
||||||
for item in elementList:
|
for item in elementList:
|
||||||
# Skipping XML item 'title=All episodes' without a 'ratingKey'
|
# Skipping XML item 'title=All episodes' without a 'ratingKey'
|
||||||
if item.get('ratingKey', False):
|
if not item.get('ratingKey', False):
|
||||||
if self.shouldStop():
|
continue
|
||||||
return False
|
if self.shouldStop():
|
||||||
API = PlexAPI.API(item)
|
return False
|
||||||
plex_checksum = API.getChecksum()
|
API = PlexAPI.API(item)
|
||||||
itemId = API.getKey()
|
plex_checksum = API.getChecksum()
|
||||||
title, sorttitle = API.getTitle()
|
itemId = API.getKey()
|
||||||
self.allPlexElementsId[itemId] = plex_checksum
|
title, sorttitle = API.getTitle()
|
||||||
kodi_checksum = self.allKodiElementsId.get(itemId)
|
self.allPlexElementsId[itemId] = plex_checksum
|
||||||
if kodi_checksum != plex_checksum:
|
kodi_checksum = self.allKodiElementsId.get(itemId)
|
||||||
# Only update if movie is not in Kodi or checksum is
|
if kodi_checksum != plex_checksum:
|
||||||
# different
|
# Only update if movie is not in Kodi or checksum is
|
||||||
self.updatelist.append({
|
# different
|
||||||
'itemId': itemId,
|
self.updatelist.append({'itemId': itemId,
|
||||||
'itemType': itemType,
|
'itemType': itemType,
|
||||||
'method': method,
|
'method': method,
|
||||||
'viewName': viewName,
|
'viewName': viewName,
|
||||||
'viewId': viewId,
|
'viewId': viewId,
|
||||||
'title': title})
|
'title': title})
|
||||||
else:
|
else:
|
||||||
# Initial or repair sync: get all Plex movies
|
# Initial or repair sync: get all Plex movies
|
||||||
for item in elementList:
|
for item in elementList:
|
||||||
# Only look at valid items = Plex library items
|
# Only look at valid items = Plex library items
|
||||||
if item.get('ratingKey', False):
|
if not item.get('ratingKey', False):
|
||||||
if self.shouldStop():
|
continue
|
||||||
return False
|
if self.shouldStop():
|
||||||
API = PlexAPI.API(item)
|
return False
|
||||||
itemId = API.getKey()
|
API = PlexAPI.API(item)
|
||||||
plex_checksum = API.getChecksum()
|
itemId = API.getKey()
|
||||||
self.allPlexElementsId[itemId] = plex_checksum
|
title, sorttitle = API.getTitle()
|
||||||
self.updatelist.append({
|
plex_checksum = API.getChecksum()
|
||||||
'itemId': itemId,
|
self.allPlexElementsId[itemId] = plex_checksum
|
||||||
'itemType': itemType,
|
self.updatelist.append({'itemId': itemId,
|
||||||
'method': method,
|
'itemType': itemType,
|
||||||
'viewName': viewName,
|
'method': method,
|
||||||
'viewId': viewId})
|
'viewName': viewName,
|
||||||
|
'viewId': viewId,
|
||||||
|
'title': title})
|
||||||
return
|
return
|
||||||
|
|
||||||
def GetAndProcessXMLs(self, itemType):
|
def GetAndProcessXMLs(self, itemType):
|
||||||
|
|
Loading…
Reference in a new issue