Use some file settings instead of window settings

- In case the user changes something while PKC is running
This commit is contained in:
tomkat83 2016-09-16 17:42:39 +02:00
parent a2a53cddf6
commit a3d643c643
4 changed files with 7 additions and 30 deletions

View file

@ -2515,16 +2515,16 @@ class API():
'photo': 'photo' 'photo': 'photo'
} }
typus = types[typus] typus = types[typus]
if window('remapSMB') == 'true': if settings('remapSMB') == 'true':
path = path.replace(window('remapSMB%sOrg' % typus), path = path.replace(settings('remapSMB%sOrg' % typus),
window('remapSMB%sNew' % typus), settings('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 settings('replaceSMB') == 'true':
if path.startswith('\\\\'): if path.startswith('\\\\'):
path = 'smb:' + path.replace('\\', '/') path = 'smb:' + path.replace('\\', '/')
if window('plex_pathverified') == 'true' and forceCheck is False: if settings('plex_pathverified') == 'true' and forceCheck is False:
return path return path
# exist() needs a / or \ at the end to work for directories # exist() needs a / or \ at the end to work for directories
@ -2545,13 +2545,12 @@ class API():
if self.askToValidate(path): if self.askToValidate(path):
window('plex_shouldStop', value="true") window('plex_shouldStop', value="true")
path = None path = None
window('plex_pathverified', value='true') settings('plex_pathverified', value='true')
settings('plex_pathverified', value='true') settings('plex_pathverified', value='true')
else: else:
path = None path = None
elif forceCheck is False: elif forceCheck is False:
if window('plex_pathverified') != 'true': if settings('plex_pathverified') != 'true':
window('plex_pathverified', value='true')
settings('plex_pathverified', value='true') settings('plex_pathverified', value='true')
return path return path

View file

@ -399,9 +399,6 @@ class LibrarySync(Thread):
'enableBackgroundSync') == "true" 'enableBackgroundSync') == "true"
self.limitindex = int(settings('limitindex')) self.limitindex = int(settings('limitindex'))
if settings('plex_pathverified') == 'true':
window('plex_pathverified', value='true')
# 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))

View file

@ -178,22 +178,6 @@ class UserClient(threading.Thread):
window('useDirectPaths', value='true' window('useDirectPaths', value='true'
if settings('useDirectPaths') == "1" else 'false') if settings('useDirectPaths') == "1" else 'false')
window('replaceSMB', value='true'
if settings('replaceSMB') == "true" else 'false')
window('remapSMB', value='true'
if settings('remapSMB') == "true" else 'false')
if window('remapSMB') == 'true':
items = ('movie', 'tv', 'music')
for item in items:
# Normalize! Get rid of potential (back)slashes at the end
org = settings('remapSMB%sOrg' % item)
new = settings('remapSMB%sNew' % item)
if org.endswith('\\') or org.endswith('/'):
org = org[:-1]
if new.endswith('\\') or new.endswith('/'):
new = new[:-1]
window('remapSMB%sOrg' % item, value=org)
window('remapSMB%sNew' % item, value=new)
# Start DownloadUtils session # Start DownloadUtils session
doUtils.startSession(reset=True) doUtils.startSession(reset=True)

View file

@ -97,9 +97,6 @@ class Service():
"plex_runLibScan", "plex_username", "pms_token", "plex_token", "plex_runLibScan", "plex_username", "pms_token", "plex_token",
"pms_server", "plex_machineIdentifier", "plex_servername", "pms_server", "plex_machineIdentifier", "plex_servername",
"plex_authenticated", "PlexUserImage", "useDirectPaths", "plex_authenticated", "PlexUserImage", "useDirectPaths",
"replaceSMB", "remapSMB", "remapSMBmovieOrg", "remapSMBtvOrg",
"remapSMBmusicOrg", "remapSMBmovieNew", "remapSMBtvNew",
"remapSMBmusicNew", "remapSMBphotoOrg", "remapSMBphotoNew",
"suspend_LibraryThread", "plex_terminateNow", "suspend_LibraryThread", "plex_terminateNow",
"kodiplextimeoffset", "countError", "countUnauthorized" "kodiplextimeoffset", "countError", "countUnauthorized"
] ]