Fix followup sync again

This commit is contained in:
Matt 2021-04-30 20:54:52 -04:00
parent 6f9334f76d
commit a1f3d8eb10

View file

@ -68,7 +68,7 @@ class FullSync(object):
return self return self
def libraries(self, library_id=None, update=False): def libraries(self, libraries=None, update=False):
''' Map the syncing process and start the sync. Ensure only one sync is running. ''' Map the syncing process and start the sync. Ensure only one sync is running.
''' '''
@ -76,31 +76,33 @@ class FullSync(object):
self.update_library = update self.update_library = update
self.sync = get_sync() self.sync = get_sync()
if library_id: if libraries:
# Can be a single ID or a comma separated list
libraries = libraries.split(',')
for library_id in libraries:
# Look up library in local Jellyfin database
library = self.get_library(library_id)
# Look up library in local Jellyfin database if library:
library = self.get_library(library_id) if library.media_type == 'mixed':
self.sync['Libraries'].append("Mixed:%s" % library_id)
if library: # Include boxsets library
if library.media_type == 'mixed': libraries = self.get_libraries()
self.sync['Libraries'].append("Mixed:%s" % library_id) boxsets = [row.view_id for row in libraries if row.media_type == 'boxsets']
# Include boxsets library if boxsets:
libraries = self.get_libraries() self.sync['Libraries'].append('Boxsets:%s' % boxsets[0])
boxsets = [row.view_id for row in libraries if row.media_type == 'boxsets'] elif library.media_type == 'movies':
if boxsets: self.sync['Libraries'].append(library_id)
self.sync['Libraries'].append('Boxsets:%s' % boxsets[0]) # Include boxsets library
elif library.media_type == 'movies': libraries = self.get_libraries()
self.sync['Libraries'].append(library_id) boxsets = [row.view_id for row in libraries if row.media_type == 'boxsets']
# Include boxsets library if boxsets:
libraries = self.get_libraries() self.sync['Libraries'].append('Boxsets:%s' % boxsets[0])
boxsets = [row.view_id for row in libraries if row.media_type == 'boxsets'] else:
if boxsets: # Only called if the library isn't already known about
self.sync['Libraries'].append('Boxsets:%s' % boxsets[0]) self.sync['Libraries'].append(library_id)
else: else:
# Only called if the library isn't already known about
self.sync['Libraries'].append(library_id) self.sync['Libraries'].append(library_id)
else:
self.sync['Libraries'].append(library_id)
else: else:
self.mapping() self.mapping()