From a9cf7eb2948b7e155a60cc3a753588987c9d3193 Mon Sep 17 00:00:00 2001 From: croneter Date: Thu, 27 Dec 2018 12:08:18 +0100 Subject: [PATCH] New setting to escape paths e.g. for HTTP direct paths - Fixes #555 --- resources/language/resource.language.en_gb/strings.po | 5 +++++ resources/lib/app/libsync.py | 2 ++ resources/lib/plex_api.py | 2 ++ resources/settings.xml | 1 + 4 files changed, 10 insertions(+) diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 2f70ff9f..75c05b36 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -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:" diff --git a/resources/lib/app/libsync.py b/resources/lib/app/libsync.py index 8fad3781..51d83df8 100644 --- a/resources/lib/app/libsync.py +++ b/resources/lib/app/libsync.py @@ -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 diff --git a/resources/lib/plex_api.py b/resources/lib/plex_api.py index e18ad7a1..8399b040 100644 --- a/resources/lib/plex_api.py +++ b/resources/lib/plex_api.py @@ -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 diff --git a/resources/settings.xml b/resources/settings.xml index e7febd0e..1f81d6e7 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -99,6 +99,7 @@ +