diff --git a/resources/lib/PlexAPI.py b/resources/lib/PlexAPI.py index 83098360..53375015 100644 --- a/resources/lib/PlexAPI.py +++ b/resources/lib/PlexAPI.py @@ -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 diff --git a/resources/lib/kodimonitor.py b/resources/lib/kodimonitor.py index a46c509a..26f585b0 100644 --- a/resources/lib/kodimonitor.py +++ b/resources/lib/kodimonitor.py @@ -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 } ############################################################################### diff --git a/resources/lib/librarysync.py b/resources/lib/librarysync.py index 9b2f0ad2..de661200 100644 --- a/resources/lib/librarysync.py +++ b/resources/lib/librarysync.py @@ -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)) diff --git a/resources/lib/state.py b/resources/lib/state.py index f744fa0e..8434b86b 100644 --- a/resources/lib/state.py +++ b/resources/lib/state.py @@ -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