Allow replace path settings changes without reboot
This commit is contained in:
parent
ce508257a3
commit
261a0aad4c
4 changed files with 32 additions and 9 deletions
|
@ -2580,13 +2580,13 @@ class API():
|
||||||
if path is None:
|
if path is None:
|
||||||
return None
|
return None
|
||||||
typus = v.REMAP_TYPE_FROM_PLEXTYPE[typus]
|
typus = v.REMAP_TYPE_FROM_PLEXTYPE[typus]
|
||||||
if window('remapSMB') == 'true':
|
if state.REMAP_PATH is True:
|
||||||
path = path.replace(window('remapSMB%sOrg' % typus),
|
path = path.replace(getattr(state, 'remapSMB%sOrg' % typus),
|
||||||
window('remapSMB%sNew' % typus),
|
getattr(state, 'remapSMB%sNew' % typus),
|
||||||
1)
|
1)
|
||||||
# There might be backslashes left over:
|
# There might be backslashes left over:
|
||||||
path = path.replace('\\', '/')
|
path = path.replace('\\', '/')
|
||||||
elif window('replaceSMB') == 'true':
|
elif state.REPLACE_SMB_PATH is True:
|
||||||
if path.startswith('\\\\'):
|
if path.startswith('\\\\'):
|
||||||
path = 'smb:' + path.replace('\\', '/')
|
path = 'smb:' + path.replace('\\', '/')
|
||||||
if ((state.PATH_VERIFIED and forceCheck is False) or
|
if ((state.PATH_VERIFIED and forceCheck is False) or
|
||||||
|
|
|
@ -26,7 +26,6 @@ WINDOW_SETTINGS = {
|
||||||
'logLevel': 'plex_logLevel',
|
'logLevel': 'plex_logLevel',
|
||||||
'enableContext': 'plex_context',
|
'enableContext': 'plex_context',
|
||||||
'plex_restricteduser': 'plex_restricteduser',
|
'plex_restricteduser': 'plex_restricteduser',
|
||||||
'remapSMB': 'remapSMB',
|
|
||||||
'replaceSMB': 'replaceSMB',
|
'replaceSMB': 'replaceSMB',
|
||||||
'force_transcode_pix': 'plex_force_transcode_pix',
|
'force_transcode_pix': 'plex_force_transcode_pix',
|
||||||
'fetch_pms_item_number': 'fetch_pms_item_number'
|
'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)
|
# settings: state-variable (state.py)
|
||||||
STATE_SETTINGS = {
|
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
|
||||||
}
|
}
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
|
@ -73,12 +73,13 @@ class LibrarySync(Thread):
|
||||||
# Show sync dialog even if user deactivated?
|
# Show sync dialog even if user deactivated?
|
||||||
self.force_dialog = True
|
self.force_dialog = True
|
||||||
# Init for replacing paths
|
# Init for replacing paths
|
||||||
window('remapSMB', value=settings('remapSMB'))
|
state.REPLACE_SMB_PATH = True if settings('replaceSMB') == 'true' \
|
||||||
window('replaceSMB', value=settings('replaceSMB'))
|
else False
|
||||||
|
state.REMAP_PATH = True if settings('remapSMB') == 'true' else False
|
||||||
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
for typus in v.REMAP_TYPE_FROM_PLEXTYPE.values():
|
||||||
for arg in ('Org', 'New'):
|
for arg in ('Org', 'New'):
|
||||||
key = 'remapSMB%s%s' % (typus, arg)
|
key = 'remapSMB%s%s' % (typus, arg)
|
||||||
window(key, value=settings(key))
|
setattr(state, key, settings(key))
|
||||||
# Just in case a time sync goes wrong
|
# Just in case a time sync goes wrong
|
||||||
self.timeoffset = int(settings('kodiplextimeoffset'))
|
self.timeoffset = int(settings('kodiplextimeoffset'))
|
||||||
window('kodiplextimeoffset', value=str(self.timeoffset))
|
window('kodiplextimeoffset', value=str(self.timeoffset))
|
||||||
|
|
|
@ -35,6 +35,20 @@ SYNC_DIALOG = True
|
||||||
# Have we already checked the Kodi DB on consistency?
|
# Have we already checked the Kodi DB on consistency?
|
||||||
KODI_DB_CHECKED = False
|
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')
|
# Along with window('plex_authenticated')
|
||||||
AUTHENTICATED = False
|
AUTHENTICATED = False
|
||||||
|
|
Loading…
Reference in a new issue