Fix PKC not starting by importing playlist module only when sync enabled
- Fixes #521
This commit is contained in:
parent
04da98bcc6
commit
53c10b0847
5 changed files with 14 additions and 15 deletions
|
@ -110,7 +110,7 @@ msgstr ""
|
|||
|
||||
# PKC settings sync options
|
||||
msgctxt "#30020"
|
||||
msgid "Sync Plex playlists"
|
||||
msgid "Sync Plex playlists (reboot Kodi!)"
|
||||
msgstr ""
|
||||
|
||||
# PKC settings sync options
|
||||
|
|
|
@ -51,7 +51,6 @@ STATE_SETTINGS = {
|
|||
'forceReloadSkinOnPlaybackStop': 'FORCE_RELOAD_SKIN',
|
||||
'fetch_pms_item_number': 'FETCH_PMS_ITEM_NUMBER',
|
||||
'imageSyncNotifications': 'IMAGE_SYNC_NOTIFICATIONS',
|
||||
'enablePlaylistSync': 'SYNC_PLAYLISTS',
|
||||
'syncSpecificPlexPlaylists': 'SYNC_SPECIFIC_PLEX_PLAYLISTS',
|
||||
'syncSpecificKodiPlaylists': 'SYNC_SPECIFIC_KODI_PLAYLISTS'
|
||||
}
|
||||
|
|
|
@ -20,10 +20,16 @@ from . import plex_functions as PF
|
|||
from .plex_api import API
|
||||
from .library_sync import get_metadata, process_metadata, fanart, sync_info
|
||||
from . import music
|
||||
from . import playlists
|
||||
from . import variables as v
|
||||
from . import state
|
||||
|
||||
if utils.settings('enablePlaylistSync') == 'true':
|
||||
# Xbox cannot use watchdog, a dependency for PKC playlist features
|
||||
from . import playlists
|
||||
PLAYLIST_SYNC_ENABLED = True
|
||||
else:
|
||||
PLAYLIST_SYNC_ENABLED = False
|
||||
|
||||
###############################################################################
|
||||
|
||||
LOG = getLogger('PLEX.librarysync')
|
||||
|
@ -265,7 +271,7 @@ class LibrarySync(Thread):
|
|||
repair)
|
||||
if not self._full_sync():
|
||||
return False
|
||||
if not playlists.full_sync():
|
||||
if PLAYLIST_SYNC_ENABLED and not playlists.full_sync():
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -1186,7 +1192,7 @@ class LibrarySync(Thread):
|
|||
continue
|
||||
status = int(item['state'])
|
||||
if typus == 'playlist':
|
||||
if not state.SYNC_PLAYLISTS:
|
||||
if not PLAYLIST_SYNC_ENABLED:
|
||||
continue
|
||||
playlists.websocket(plex_id=unicode(item['itemID']),
|
||||
status=status)
|
||||
|
@ -1560,6 +1566,7 @@ class LibrarySync(Thread):
|
|||
initial_sync_done = True
|
||||
kodi_db_version_checked = True
|
||||
last_sync = utils.unix_timestamp()
|
||||
if PLAYLIST_SYNC_ENABLED:
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
self.sync_fanart()
|
||||
self.fanartthread.start()
|
||||
|
@ -1612,6 +1619,7 @@ class LibrarySync(Thread):
|
|||
initial_sync_done = True
|
||||
last_sync = utils.unix_timestamp()
|
||||
LOG.info('Done initial sync on Kodi startup')
|
||||
if PLAYLIST_SYNC_ENABLED:
|
||||
playlist_monitor = playlists.kodi_playlist_monitor()
|
||||
artwork.Artwork().cache_major_artwork()
|
||||
self.sync_fanart()
|
||||
|
|
|
@ -113,9 +113,6 @@ def full_sync():
|
|||
Full sync of playlists between Kodi and Plex. Returns True is successful,
|
||||
False otherwise
|
||||
"""
|
||||
if not state.SYNC_PLAYLISTS:
|
||||
LOG.debug('Not syncing playlists')
|
||||
return True
|
||||
LOG.info('Starting playlist full sync')
|
||||
with state.LOCK_PLAYLISTS:
|
||||
return _full_sync()
|
||||
|
@ -282,9 +279,6 @@ class PlaylistEventhandler(events.FileSystemEventHandler):
|
|||
:type event:
|
||||
:class:`FileSystemEvent`
|
||||
"""
|
||||
if not state.SYNC_PLAYLISTS:
|
||||
# Sync is deactivated
|
||||
return
|
||||
path = event.dest_path if event.event_type == events.EVENT_TYPE_MOVED \
|
||||
else event.src_path
|
||||
if not sync_kodi_playlist(path):
|
||||
|
|
|
@ -57,8 +57,6 @@ FORCE_RELOAD_SKIN = True
|
|||
SYNC_DIALOG = True
|
||||
# Shall Kodi show dialogs for syncing/caching images? (e.g. images left to sync)
|
||||
IMAGE_SYNC_NOTIFICATIONS = True
|
||||
# Sync playlists from Plex to Kodi and vice-versa?
|
||||
SYNC_PLAYLISTS = True
|
||||
# Only sync specific Plex playlists to Kodi?
|
||||
SYNC_SPECIFIC_PLEX_PLAYLISTS = False
|
||||
# Only sync specific Kodi playlists to Plex?
|
||||
|
|
Loading…
Reference in a new issue