Add setting to (de)activate playlist sync

This commit is contained in:
Croneter 2018-05-03 08:20:55 +02:00
parent c61fc3241f
commit ca1033801d
5 changed files with 14 additions and 3 deletions

View file

@ -61,6 +61,11 @@ msgctxt "#30009"
msgid "Enable image caching during Kodi playback (restart Kodi!)" msgid "Enable image caching during Kodi playback (restart Kodi!)"
msgstr "" msgstr ""
# PKC settings sync options
msgctxt "#30010"
msgid "Sync Plex playlists"
msgstr ""
# Button text # Button text
msgctxt "#30012" msgctxt "#30012"
msgid "OK" msgid "OK"

View file

@ -51,7 +51,8 @@ STATE_SETTINGS = {
'enableMusic': 'ENABLE_MUSIC', 'enableMusic': 'ENABLE_MUSIC',
'forceReloadSkinOnPlaybackStop': 'FORCE_RELOAD_SKIN', 'forceReloadSkinOnPlaybackStop': 'FORCE_RELOAD_SKIN',
'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER', 'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER',
'imageSyncNotifications': 'IMAGE_SYNC_NOTIFICATIONS' 'imageSyncNotifications': 'IMAGE_SYNC_NOTIFICATIONS',
'enablePlaylistSync': 'SYNC_PLAYLISTS'
} }
############################################################################### ###############################################################################

View file

@ -1201,6 +1201,8 @@ class LibrarySync(Thread):
continue continue
status = int(item['state']) status = int(item['state'])
if typus == 'playlist': if typus == 'playlist':
if not state.SYNC_PLAYLISTS:
continue
playlists.process_websocket(plex_id=str(item['itemID']), playlists.process_websocket(plex_id=str(item['itemID']),
updated_at=str(item['updatedAt']), updated_at=str(item['updatedAt']),
state=status) state=status)
@ -1558,7 +1560,7 @@ class LibrarySync(Thread):
kodi_db_version_checked = True kodi_db_version_checked = True
last_sync = utils.unix_timestamp() last_sync = utils.unix_timestamp()
self.fanartthread.start() self.fanartthread.start()
if playlists.full_sync(): if state.SYNC_PLAYLISTS and playlists.full_sync():
playlist_monitor = playlists.kodi_playlist_monitor() playlist_monitor = playlists.kodi_playlist_monitor()
else: else:
LOG.error('Initial start-up full sync unsuccessful') LOG.error('Initial start-up full sync unsuccessful')
@ -1605,7 +1607,7 @@ class LibrarySync(Thread):
LOG.info('Done initial sync on Kodi startup') LOG.info('Done initial sync on Kodi startup')
artwork.Artwork().cache_major_artwork() artwork.Artwork().cache_major_artwork()
self.fanartthread.start() self.fanartthread.start()
if playlists.full_sync(): if state.SYNC_PLAYLISTS and playlists.full_sync():
playlist_monitor = playlists.kodi_playlist_monitor() playlist_monitor = playlists.kodi_playlist_monitor()
else: else:
LOG.info('Startup sync has not yet been successful') LOG.info('Startup sync has not yet been successful')

View file

@ -41,6 +41,8 @@ FORCE_RELOAD_SKIN = True
SYNC_DIALOG = True SYNC_DIALOG = True
# Shall Kodi show dialogs for syncing/caching images? (e.g. images left to sync) # Shall Kodi show dialogs for syncing/caching images? (e.g. images left to sync)
IMAGE_SYNC_NOTIFICATIONS = True IMAGE_SYNC_NOTIFICATIONS = True
# Sync playlists from Plex to Kodi and vice-versa?
SYNC_PLAYLISTS = True
# Is synching of Plex music enabled? # Is synching of Plex music enabled?
ENABLE_MUSIC = True ENABLE_MUSIC = True
# How often shall we sync? # How often shall we sync?

View file

@ -58,6 +58,7 @@
<category label="30506"><!-- Sync Options --> <category label="30506"><!-- Sync Options -->
<setting type="lsep" label="30537" /><!-- Restart if you make changes --> <setting type="lsep" label="30537" /><!-- Restart if you make changes -->
<setting id="syncEmptyShows" type="bool" label="30508" default="false" visible="false"/> <setting id="syncEmptyShows" type="bool" label="30508" default="false" visible="false"/>
<setting id="enablePlaylistSync" type="bool" label="30010" default="true" visible="true"/><!-- Sync Plex playlists -->
<setting id="dbSyncIndicator" label="30507" type="bool" default="true" /><!-- show syncing progress --> <setting id="dbSyncIndicator" label="30507" type="bool" default="true" /><!-- show syncing progress -->
<setting type="sep" /> <setting type="sep" />
<setting id="syncThreadNumber" type="slider" label="39003" default="10" option="int" range="1,1,20"/><!-- Limit download sync threads (recommended for rpi: 1) --> <setting id="syncThreadNumber" type="slider" label="39003" default="10" option="int" range="1,1,20"/><!-- Limit download sync threads (recommended for rpi: 1) -->