Merge pull request #953 from croneter/optimize-sync

Sync playlists immediately after synching new/changed items and show an info dialog
This commit is contained in:
croneter 2019-08-02 10:51:28 +02:00 committed by GitHub
commit 064e573af9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -334,15 +334,27 @@ class FullSync(common.fullsync_mixin):
plexdb.update_section_last_sync(section.section_id, plexdb.update_section_last_sync(section.section_id,
self.current_sync) self.current_sync)
common.update_kodi_library(video=True, music=True) common.update_kodi_library(video=True, music=True)
# Sync Plex playlists to Kodi and vice-versa
if common.PLAYLIST_SYNC_ENABLED:
if self.show_dialog:
if self.dialog:
self.dialog.close()
self.dialog = xbmcgui.DialogProgressBG()
# "Synching playlists"
self.dialog.create(utils.lang(39715))
if not playlists.full_sync():
return False
# SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that
# were set to unwatched). Also mark all items on the PMS to be able
# to delete the ones still in Kodi
LOG.info('Start synching playstate and userdata for every item')
# In order to not delete all your songs again # In order to not delete all your songs again
if app.SYNC.enable_music: if app.SYNC.enable_music:
kinds.extend([ kinds.extend([
(v.PLEX_TYPE_SONG, v.PLEX_TYPE_ARTIST, itemtypes.Song, True), (v.PLEX_TYPE_SONG, v.PLEX_TYPE_ARTIST, itemtypes.Song, True),
]) ])
# SYNC PLAYSTATE of ALL items (otherwise we won't pick up on items that
# were set to unwatched). Also mark all items on the PMS to be able
# to delete the ones still in Kodi
LOG.info('Start synching playstate and userdata for every item')
# Make sure we're not showing an item's title in the sync dialog # Make sure we're not showing an item's title in the sync dialog
self.title = '' self.title = ''
self.threader.shutdown() self.threader.shutdown()
@ -428,13 +440,6 @@ class FullSync(common.fullsync_mixin):
if self.isCanceled() or not self.full_library_sync(): if self.isCanceled() or not self.full_library_sync():
self.successful = False self.successful = False
return return
if common.PLAYLIST_SYNC_ENABLED:
if self.dialog:
self.dialog.close()
self.dialog = xbmcgui.DialogProgressBG()
self.dialog.create(utils.lang(39715))
if not playlists.full_sync():
self.successful = False
finally: finally:
common.update_kodi_library(video=True, music=True) common.update_kodi_library(video=True, music=True)
if self.dialog: if self.dialog: