Allow replace path settings changes without reboot

This commit is contained in:
croneter 2017-08-22 07:18:19 +02:00
parent ce508257a3
commit 261a0aad4c
4 changed files with 32 additions and 9 deletions

View file

@ -2580,13 +2580,13 @@ class API():
if path is None:
return None
typus = v.REMAP_TYPE_FROM_PLEXTYPE[typus]
if window('remapSMB') == 'true':
path = path.replace(window('remapSMB%sOrg' % typus),
window('remapSMB%sNew' % typus),
if state.REMAP_PATH is True:
path = path.replace(getattr(state, 'remapSMB%sOrg' % typus),
getattr(state, 'remapSMB%sNew' % typus),
1)
# There might be backslashes left over:
path = path.replace('\\', '/')
elif window('replaceSMB') == 'true':
elif state.REPLACE_SMB_PATH is True:
if path.startswith('\\\\'):
path = 'smb:' + path.replace('\\', '/')
if ((state.PATH_VERIFIED and forceCheck is False) or

View file

@ -26,7 +26,6 @@ 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'
@ -39,7 +38,16 @@ for typus in REMAP_TYPE_FROM_PLEXTYPE.values():
# settings: state-variable (state.py)
STATE_SETTINGS = {
'dbSyncIndicator': state.SYNC_DIALOG
'dbSyncIndicator': state.SYNC_DIALOG,
'remapSMB': state.REMAP_PATH,
'remapSMBmovieOrg': state.remapSMBmovieOrg,
'remapSMBmovieNew': state.remapSMBmovieNew,
'remapSMBtvOrg': state.remapSMBtvOrg,
'remapSMBtvNew': state.remapSMBtvNew,
'remapSMBmusicOrg': state.remapSMBmusicOrg,
'remapSMBmusicNew': state.remapSMBmusicNew,
'remapSMBphotoOrg': state.remapSMBphotoOrg,
'remapSMBphotoNew': state.remapSMBphotoNew
}
###############################################################################

View file

@ -73,12 +73,13 @@ class LibrarySync(Thread):
# Show sync dialog even if user deactivated?
self.force_dialog = True
# Init for replacing paths
window('remapSMB', value=settings('remapSMB'))
window('replaceSMB', value=settings('replaceSMB'))
state.REPLACE_SMB_PATH = True if settings('replaceSMB') == 'true' \
else False
state.REMAP_PATH = True if settings('remapSMB') == 'true' else False
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
for arg in ('Org', 'New'):
key = 'remapSMB%s%s' % (typus, arg)
window(key, value=settings(key))
setattr(state, key, settings(key))
# Just in case a time sync goes wrong
self.timeoffset = int(settings('kodiplextimeoffset'))
window('kodiplextimeoffset', value=str(self.timeoffset))

View file

@ -35,6 +35,20 @@ SYNC_DIALOG = True
# Have we already checked the Kodi DB on consistency?
KODI_DB_CHECKED = False
# Path remapping mechanism (e.g. smb paths)
# Do we replace \\myserver\path to smb://myserver/path?
REPLACE_SMB_PATH = False
# Do we generally remap?
REMAP_PATH = False
# Mappings for REMAP_PATH:
remapSMBmovieOrg = None
remapSMBmovieNew = None
remapSMBtvOrg = None
remapSMBtvNew = None
remapSMBmusicOrg = None
remapSMBmusicNew = None
remapSMBphotoOrg = None
remapSMBphotoNew = None
# Along with window('plex_authenticated')
AUTHENTICATED = False