mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
Merge pull request #513 from mcarlton00/followup-sync
Fix subsequent syncs from the addon menu better
This commit is contained in:
commit
7c833767cd
3 changed files with 30 additions and 24 deletions
|
@ -335,6 +335,9 @@ def get_sync():
|
||||||
sync['Whitelist'] = list(set(sync.get('Whitelist', [])))
|
sync['Whitelist'] = list(set(sync.get('Whitelist', [])))
|
||||||
sync['SortedViews'] = sync.get('SortedViews', [])
|
sync['SortedViews'] = sync.get('SortedViews', [])
|
||||||
|
|
||||||
|
# Temporary cleanup from #494/#511, remove in a future version
|
||||||
|
sync['Libraries'] = [lib_id for lib_id in sync['Libraries'] if ',' not in lib_id]
|
||||||
|
|
||||||
return sync
|
return sync
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,34 @@ 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
|
# Verify we're only trying to sync boxsets once
|
||||||
libraries = self.get_libraries()
|
if boxsets and boxsets[0] not in self.sync['Libraries']:
|
||||||
boxsets = [row.view_id for row in libraries if row.media_type == 'boxsets']
|
self.sync['Libraries'].append('Boxsets:%s' % boxsets[0])
|
||||||
if boxsets:
|
else:
|
||||||
self.sync['Libraries'].append('Boxsets:%s' % boxsets[0])
|
# Only called if the library isn't already known about
|
||||||
|
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()
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ class Music(KodiDb):
|
||||||
if obj['Media'] == 'song':
|
if obj['Media'] == 'song':
|
||||||
|
|
||||||
self.remove_song(obj['KodiId'], obj['Id'])
|
self.remove_song(obj['KodiId'], obj['Id'])
|
||||||
self.jellyfin_db.remove_wild_item(obj['id'])
|
self.jellyfin_db.remove_wild_item(obj['Id'])
|
||||||
|
|
||||||
for item in self.jellyfin_db.get_item_by_wild_id(*values(obj, QUEM.get_item_by_wild_obj)):
|
for item in self.jellyfin_db.get_item_by_wild_id(*values(obj, QUEM.get_item_by_wild_obj)):
|
||||||
if item[1] == 'album':
|
if item[1] == 'album':
|
||||||
|
|
Loading…
Reference in a new issue