New setting to escape paths e.g. for HTTP direct paths

- Fixes #555
This commit is contained in:
croneter 2018-12-27 12:08:18 +01:00
parent 376e66b5f0
commit a9cf7eb294
4 changed files with 10 additions and 0 deletions

View file

@ -820,6 +820,11 @@ msgctxt "#39035"
msgid "Replace Plex paths /volume1/media or \\\\myserver\\media with custom SMB paths smb://NAS/mystuff"
msgstr ""
# PKC Settings - Customize Paths
msgctxt "#39036"
msgid "Escape special characters in path (e.g. space to %20)"
msgstr ""
# PKC Settings - Customize Paths
msgctxt "#39037"
msgid "Original Plex MOVIE path to replace:"

View file

@ -44,6 +44,8 @@ class Sync(object):
self.remapSMBmusicNew = utils.settings('remapSMBmusicNew')
self.remapSMBphotoOrg = utils.settings('remapSMBphotoOrg')
self.remapSMBphotoNew = utils.settings('remapSMBphotoNew')
# Escape path?
self.escape_path = utils.settings('escapePath') == 'true'
# Shall we replace custom user ratings with the number of versions available?
self.indicate_media_versions = utils.settings('indicate_media_versions') == "true"
# Will sync movie trailer differently: either play trailer directly or show

View file

@ -1743,6 +1743,8 @@ class API(object):
elif app.SYNC.replace_smb_path is True:
if path.startswith('\\\\'):
path = 'smb:' + path.replace('\\', '/')
if app.SYNC.escape_path:
path = quote(path)
if ((app.SYNC.path_verified and force_check is False) or
omit_check is True):
return path

View file

@ -99,6 +99,7 @@
<setting id="remapSMBmusicNew" type="text" label="39042" default="smb://" visible="eq(-6,true)" subsetting="true" /> <!-- Replace Plex MUSIC with: -->
<setting id="remapSMBphotoOrg" type="text" label="39045" default="" visible="eq(-7,true)" subsetting="true" /> <!-- Original Plex MUSIC path to replace: -->
<setting id="remapSMBphotoNew" type="text" label="39046" default="smb://" visible="eq(-8,true)" subsetting="true" /> <!-- Replace Plex MUSIC with: -->
<setting id="escapePath" type="bool" label="39036" default="false" /> <!-- Escape special characters in path (e.g. space to %20) -->
</category>
<category label="30516"><!-- Playback -->