Filter repair sync by content type

Basic, will need to be reviewed eventually
This commit is contained in:
angelblue05 2016-09-20 04:17:11 -05:00
parent 29a229971f
commit ba7e060009

View file

@ -58,6 +58,8 @@ class LibrarySync(threading.Thread):
self.emby = embyserver.Read_EmbyServer() self.emby = embyserver.Read_EmbyServer()
self.vnodes = videonodes.VideoNodes() self.vnodes = videonodes.VideoNodes()
self.kodi_version = int(xbmc.getInfoLabel('System.BuildVersion')[:2])
threading.Thread.__init__(self) threading.Thread.__init__(self)
@ -241,6 +243,31 @@ class LibrarySync(threading.Thread):
message = "Manual sync" message = "Manual sync"
elif repair: elif repair:
message = "Repair sync" message = "Repair sync"
repair_list = []
choices = ['all', 'movies', 'musicvideos', 'tvshows']
if music_enabled:
choices.append('music')
if self.kodi_version > 15:
# Jarvis or higher
types = xbmcgui.Dialog().multiselect("Select content type to repair", choices)
if types is None:
pass
elif 0 in types: # all
choices.pop(0)
repair_list.extend(choices)
else:
for index in types:
repair_list.append(choices[index])
else:
resp = xbmcgui.Dialog().select("Select content type to repair", choices)
if resp == 0: # all
choices.pop(resp)
repair_list.extend(choices)
else:
repair_list.append(choices[resp])
log.info("Repair queued for: %s", repair_list)
else: else:
message = "Initial sync" message = "Initial sync"
window('emby_initialScan', value="true") window('emby_initialScan', value="true")
@ -260,6 +287,10 @@ class LibrarySync(threading.Thread):
'tvshows': self.tvshows 'tvshows': self.tvshows
} }
for itemtype in process: for itemtype in process:
if repair and itemtype not in repair_list:
continue
startTime = datetime.now() startTime = datetime.now()
completed = process[itemtype](embycursor, kodicursor, pDialog) completed = process[itemtype](embycursor, kodicursor, pDialog)
if not completed: if not completed:
@ -285,6 +316,9 @@ class LibrarySync(threading.Thread):
# sync music # sync music
if music_enabled: if music_enabled:
if repair and 'music' not in repair_list:
pass
else:
musicconn = utils.kodiSQL('music') musicconn = utils.kodiSQL('music')
musiccursor = musicconn.cursor() musiccursor = musicconn.cursor()