Move sync indication setting to state.py
This commit is contained in:
parent
e5a77a1839
commit
743d8dbb2f
3 changed files with 40 additions and 20 deletions
|
@ -20,6 +20,26 @@ import state
|
||||||
|
|
||||||
log = logging.getLogger("PLEX."+__name__)
|
log = logging.getLogger("PLEX."+__name__)
|
||||||
|
|
||||||
|
# settings: window-variable
|
||||||
|
WINDOW_SETTINGS = {
|
||||||
|
'logLevel': 'plex_logLevel',
|
||||||
|
'enableContext': 'plex_context',
|
||||||
|
'plex_restricteduser': 'plex_restricteduser',
|
||||||
|
'remapSMB': 'remapSMB',
|
||||||
|
'replaceSMB': 'replaceSMB',
|
||||||
|
'force_transcode_pix': 'plex_force_transcode_pix',
|
||||||
|
'fetch_pms_item_number': 'fetch_pms_item_number'
|
||||||
|
}
|
||||||
|
# Path replacement
|
||||||
|
for typus in REMAP_TYPE_FROM_PLEXTYPE.values():
|
||||||
|
for arg in ('Org', 'New'):
|
||||||
|
key = 'remapSMB%s%s' % (typus, arg)
|
||||||
|
WINDOW_SETTINGS[key] = key
|
||||||
|
|
||||||
|
# settings: state-variable (state.py)
|
||||||
|
STATE_SETTINGS = {
|
||||||
|
'dbSyncIndicator': state.SYNC_DIALOG
|
||||||
|
}
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
||||||
|
@ -52,24 +72,8 @@ class KodiMonitor(Monitor):
|
||||||
# path to all media files
|
# path to all media files
|
||||||
state.STOP_SYNC = False
|
state.STOP_SYNC = False
|
||||||
state.PATH_VERIFIED = False
|
state.PATH_VERIFIED = False
|
||||||
# settings: window-variable
|
|
||||||
items = {
|
|
||||||
'logLevel': 'plex_logLevel',
|
|
||||||
'enableContext': 'plex_context',
|
|
||||||
'plex_restricteduser': 'plex_restricteduser',
|
|
||||||
'dbSyncIndicator': 'dbSyncIndicator',
|
|
||||||
'remapSMB': 'remapSMB',
|
|
||||||
'replaceSMB': 'replaceSMB',
|
|
||||||
'force_transcode_pix': 'plex_force_transcode_pix',
|
|
||||||
'fetch_pms_item_number': 'fetch_pms_item_number'
|
|
||||||
}
|
|
||||||
# Path replacement
|
|
||||||
for typus in REMAP_TYPE_FROM_PLEXTYPE.values():
|
|
||||||
for arg in ('Org', 'New'):
|
|
||||||
key = 'remapSMB%s%s' % (typus, arg)
|
|
||||||
items[key] = key
|
|
||||||
# Reset the window variables from the settings variables
|
# Reset the window variables from the settings variables
|
||||||
for settings_value, window_value in items.iteritems():
|
for settings_value, window_value in WINDOW_SETTINGS.iteritems():
|
||||||
if window(window_value) != settings(settings_value):
|
if window(window_value) != settings(settings_value):
|
||||||
log.debug('PKC settings changed: %s is now %s'
|
log.debug('PKC settings changed: %s is now %s'
|
||||||
% (settings_value, settings(settings_value)))
|
% (settings_value, settings(settings_value)))
|
||||||
|
@ -77,6 +81,17 @@ class KodiMonitor(Monitor):
|
||||||
if settings_value == 'fetch_pms_item_number':
|
if settings_value == 'fetch_pms_item_number':
|
||||||
log.info('Requesting playlist/nodes refresh')
|
log.info('Requesting playlist/nodes refresh')
|
||||||
window('plex_runLibScan', value="views")
|
window('plex_runLibScan', value="views")
|
||||||
|
# Reset the state variables in state.py
|
||||||
|
for settings_value, state_value in STATE_SETTINGS.iteritems():
|
||||||
|
new = settings(settings_value)
|
||||||
|
if new == 'true':
|
||||||
|
new = True
|
||||||
|
elif new == 'false':
|
||||||
|
new = False
|
||||||
|
if state_value != new:
|
||||||
|
log.debug('PKC settings changed: %s is now %s'
|
||||||
|
% (settings_value, new))
|
||||||
|
state_value = new
|
||||||
|
|
||||||
@CatchExceptions(warnuser=False)
|
@CatchExceptions(warnuser=False)
|
||||||
def onNotification(self, sender, method, data):
|
def onNotification(self, sender, method, data):
|
||||||
|
|
|
@ -65,7 +65,7 @@ class LibrarySync(Thread):
|
||||||
|
|
||||||
self.syncThreadNumber = int(settings('syncThreadNumber'))
|
self.syncThreadNumber = int(settings('syncThreadNumber'))
|
||||||
self.installSyncDone = settings('SyncInstallRunDone') == 'true'
|
self.installSyncDone = settings('SyncInstallRunDone') == 'true'
|
||||||
window('dbSyncIndicator', value=settings('dbSyncIndicator'))
|
state.SYNC_DIALOG = settings('dbSyncIndicator') == 'true'
|
||||||
self.enableMusic = settings('enableMusic') == "true"
|
self.enableMusic = settings('enableMusic') == "true"
|
||||||
self.enableBackgroundSync = settings(
|
self.enableBackgroundSync = settings(
|
||||||
'enableBackgroundSync') == "true"
|
'enableBackgroundSync') == "true"
|
||||||
|
@ -95,7 +95,7 @@ class LibrarySync(Thread):
|
||||||
if self.xbmcplayer.isPlaying():
|
if self.xbmcplayer.isPlaying():
|
||||||
# Don't show any dialog if media is playing
|
# Don't show any dialog if media is playing
|
||||||
return
|
return
|
||||||
if window('dbSyncIndicator') != 'true':
|
if state.SYNC_DIALOG is not True:
|
||||||
if not forced:
|
if not forced:
|
||||||
return
|
return
|
||||||
if icon == "plex":
|
if icon == "plex":
|
||||||
|
@ -735,7 +735,7 @@ class LibrarySync(Thread):
|
||||||
thread.start()
|
thread.start()
|
||||||
threads.append(thread)
|
threads.append(thread)
|
||||||
# Start one thread to show sync progress ONLY for new PMS items
|
# Start one thread to show sync progress ONLY for new PMS items
|
||||||
if self.new_items_only is True and window('dbSyncIndicator') == 'true':
|
if self.new_items_only is True and state.SYNC_DIALOG is True:
|
||||||
thread = sync_info.Threaded_Show_Sync_Info(itemNumber, itemType)
|
thread = sync_info.Threaded_Show_Sync_Info(itemNumber, itemType)
|
||||||
thread.setDaemon(True)
|
thread.setDaemon(True)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
|
@ -27,6 +27,11 @@ DIRECT_PATHS = False
|
||||||
# Shall we replace custom user ratings with the number of versions available?
|
# Shall we replace custom user ratings with the number of versions available?
|
||||||
INDICATE_MEDIA_VERSIONS = False
|
INDICATE_MEDIA_VERSIONS = False
|
||||||
|
|
||||||
|
# Stemming from the PKC settings.xml
|
||||||
|
# Shall we show Kodi dialogs when synching?
|
||||||
|
SYNC_DIALOG = True
|
||||||
|
|
||||||
|
|
||||||
# Along with window('plex_authenticated')
|
# Along with window('plex_authenticated')
|
||||||
AUTHENTICATED = False
|
AUTHENTICATED = False
|
||||||
# plex.tv username
|
# plex.tv username
|
||||||
|
|
Loading…
Reference in a new issue