Fix Library Repair Sync
This commit is contained in:
parent
9781131cd2
commit
79349ce4af
2 changed files with 20 additions and 13 deletions
|
@ -135,8 +135,12 @@ class Main:
|
||||||
return
|
return
|
||||||
|
|
||||||
else:
|
else:
|
||||||
utils.logMsg("PLEX", "Requesting full library scan", 1)
|
if mode == 'repair':
|
||||||
utils.window('plex_runLibScan', value="full")
|
utils.window('plex_runLibScan', value="repair")
|
||||||
|
utils.logMsg("PLEX", "Requesting repair lib sync", 1)
|
||||||
|
elif mode == 'manualsync':
|
||||||
|
utils.logMsg("PLEX", "Requesting full library scan", 1)
|
||||||
|
utils.window('plex_runLibScan', value="full")
|
||||||
|
|
||||||
elif mode == "texturecache":
|
elif mode == "texturecache":
|
||||||
import artwork
|
import artwork
|
||||||
|
|
|
@ -405,10 +405,13 @@ class LibrarySync(Thread):
|
||||||
return
|
return
|
||||||
|
|
||||||
@utils.LogTime
|
@utils.LogTime
|
||||||
def fullSync(self, manualrun=False, repair=False):
|
def fullSync(self, repair=False):
|
||||||
|
"""
|
||||||
|
repair=True: force sync EVERY item
|
||||||
|
"""
|
||||||
# self.compare == False: we're syncing EVERY item
|
# self.compare == False: we're syncing EVERY item
|
||||||
# True: we're syncing only the delta, e.g. different checksum
|
# True: we're syncing only the delta, e.g. different checksum
|
||||||
self.compare = manualrun or repair
|
self.compare = not repair
|
||||||
|
|
||||||
xbmc.executebuiltin('InhibitIdleShutdown(true)')
|
xbmc.executebuiltin('InhibitIdleShutdown(true)')
|
||||||
screensaver = utils.getScreensaver()
|
screensaver = utils.getScreensaver()
|
||||||
|
@ -675,8 +678,7 @@ class LibrarySync(Thread):
|
||||||
% self.views, 1)
|
% self.views, 1)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def GetUpdatelist(self, xml, itemType, method, viewName, viewId,
|
def GetUpdatelist(self, xml, itemType, method, viewName, viewId):
|
||||||
dontCheck=False):
|
|
||||||
"""
|
"""
|
||||||
THIS METHOD NEEDS TO BE FAST! => e.g. no API calls
|
THIS METHOD NEEDS TO BE FAST! => e.g. no API calls
|
||||||
|
|
||||||
|
@ -689,8 +691,6 @@ class LibrarySync(Thread):
|
||||||
see itemtypes.py
|
see itemtypes.py
|
||||||
viewName: Name of the Plex view (e.g. 'My TV shows')
|
viewName: Name of the Plex view (e.g. 'My TV shows')
|
||||||
viewId: Id/Key of Plex library (e.g. '1')
|
viewId: Id/Key of Plex library (e.g. '1')
|
||||||
dontCheck: If True, skips checksum check but assumes
|
|
||||||
that all items in xml must be processed
|
|
||||||
|
|
||||||
Output: self.updatelist, self.allPlexElementsId
|
Output: self.updatelist, self.allPlexElementsId
|
||||||
self.updatelist APPENDED(!!) list itemids (Plex Keys as
|
self.updatelist APPENDED(!!) list itemids (Plex Keys as
|
||||||
|
@ -706,7 +706,7 @@ class LibrarySync(Thread):
|
||||||
self.allPlexElementsId APPENDED(!!) dict
|
self.allPlexElementsId APPENDED(!!) dict
|
||||||
= {itemid: checksum}
|
= {itemid: checksum}
|
||||||
"""
|
"""
|
||||||
if self.compare or not dontCheck:
|
if self.compare:
|
||||||
# Only process the delta - new or changed items
|
# Only process the delta - new or changed items
|
||||||
for item in xml:
|
for item in xml:
|
||||||
itemId = item.attrib.get('ratingKey')
|
itemId = item.attrib.get('ratingKey')
|
||||||
|
@ -1511,7 +1511,7 @@ class LibrarySync(Thread):
|
||||||
log("Db version: %s" % settings('dbCreatedWithVersion'), 0)
|
log("Db version: %s" % settings('dbCreatedWithVersion'), 0)
|
||||||
self.syncPMStime()
|
self.syncPMStime()
|
||||||
log("Initial start-up full sync starting", 0)
|
log("Initial start-up full sync starting", 0)
|
||||||
librarySync = fullSync(manualrun=True)
|
librarySync = fullSync()
|
||||||
# Initialize time offset Kodi - PMS
|
# Initialize time offset Kodi - PMS
|
||||||
window('emby_dbScan', clear=True)
|
window('emby_dbScan', clear=True)
|
||||||
if librarySync:
|
if librarySync:
|
||||||
|
@ -1535,11 +1535,14 @@ class LibrarySync(Thread):
|
||||||
# Currently no db scan, so we can start a new scan
|
# Currently no db scan, so we can start a new scan
|
||||||
elif window('emby_dbScan') != "true":
|
elif window('emby_dbScan') != "true":
|
||||||
# Full scan was requested from somewhere else, e.g. userclient
|
# Full scan was requested from somewhere else, e.g. userclient
|
||||||
if window('plex_runLibScan') == "full":
|
if window('plex_runLibScan') in ("full", "repair"):
|
||||||
log('Full library scan requested, starting', 0)
|
log('Full library scan requested, starting', 0)
|
||||||
window('emby_dbScan', value="true")
|
window('emby_dbScan', value="true")
|
||||||
|
if window('plex_runLibScan') == "full":
|
||||||
|
fullSync()
|
||||||
|
elif window('plex_runLibScan') == "repair":
|
||||||
|
fullSync(repair=True)
|
||||||
window('plex_runLibScan', clear=True)
|
window('plex_runLibScan', clear=True)
|
||||||
fullSync(manualrun=True)
|
|
||||||
window('emby_dbScan', clear=True)
|
window('emby_dbScan', clear=True)
|
||||||
# Full library sync finished
|
# Full library sync finished
|
||||||
self.showKodiNote(string(39407), forced=True)
|
self.showKodiNote(string(39407), forced=True)
|
||||||
|
@ -1576,7 +1579,7 @@ class LibrarySync(Thread):
|
||||||
self.syncPMStime()
|
self.syncPMStime()
|
||||||
window('emby_dbScan', value="true")
|
window('emby_dbScan', value="true")
|
||||||
log('Running background full lib scan', 0)
|
log('Running background full lib scan', 0)
|
||||||
fullSync(manualrun=True)
|
fullSync()
|
||||||
window('emby_dbScan', clear=True)
|
window('emby_dbScan', clear=True)
|
||||||
# Full library sync finished
|
# Full library sync finished
|
||||||
self.showKodiNote(string(39407), forced=False)
|
self.showKodiNote(string(39407), forced=False)
|
||||||
|
|
Loading…
Add table
Reference in a new issue