Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client native mode path replacement #926

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions jellyfin_kodi/helper/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ def get_mpaa(self, rating=None):

return mpaa

def get_native_path_mappings(self):
return {
replace: replace_with
for i in range(1, 6)
if (replace := settings(f"directPathReplace{i}"))
and (replace_with := settings(f"directPathReplaceWith{i}"))
}

def get_file_path(self, path=None):

if path is None:
Expand All @@ -206,6 +214,11 @@ def get_file_path(self, path=None):
if not path:
return ""
oddstr13 marked this conversation as resolved.
Show resolved Hide resolved

native_mappings = self.get_native_path_mappings()
for replace, replace_with in native_mappings.items():
if path.startswith(replace):
path = path.replace(replace, replace_with, 1)

if path.startswith("\\\\"):
path = (
path.replace("\\\\", "smb://", 1)
Expand Down
40 changes: 40 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -996,3 +996,43 @@ msgstr "Max artwork resolution"
msgctxt "#33202"
msgid "Transcode H265/HEVC RExt"
msgstr "Transcode H265/HEVC RExt"

msgctxt "#33203"
msgid "Native path replace 1"
msgstr "Native path replace 1"

msgctxt "#33204"
msgid "Native path replace with 1"
msgstr "Native path replace with 1"

msgctxt "#33205"
msgid "Native path replace 2"
msgstr "Native path replace 2"

msgctxt "#33206"
msgid "Native path replace with 2"
msgstr "Native path replace with 2"

msgctxt "#33207"
msgid "Native path replace 3"
msgstr "Native path replace 3"

msgctxt "#33208"
msgid "Native path replace with 3"
msgstr "Native path replace with 3"

msgctxt "#33209"
msgid "Native path replace 4"
msgstr "Native path replace 4"

msgctxt "#33210"
msgid "Native path replace with 4"
msgstr "Native path replace with 4"

msgctxt "#33211"
msgid "Native path replace 5"
msgstr "Native path replace 5"

msgctxt "#33212"
msgid "Native path replace with 5"
msgstr "Native path replace with 5"
10 changes: 10 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@
<setting label="30536" id="dbSyncScreensaver" type="bool" default="true" />
<setting label="33111" type="lsep" />
<setting label="30511" id="useDirectPaths" type="enum" lvalues="33036|33037" default="1" />
<setting label="33203" id="directPathReplace1" type="text" default="" />
<setting label="33204" id="directPathReplaceWith1" type="folder" source="" default="" />
<setting label="33205" id="directPathReplace2" type="text" default="" />
<setting label="33206" id="directPathReplaceWith2" type="folder" source="" default="" />
<setting label="33207" id="directPathReplace3" type="text" default="" />
<setting label="33208" id="directPathReplaceWith3" type="folder" source="" default="" />
<setting label="33209" id="directPathReplace4" type="text" default="" />
<setting label="33210" id="directPathReplaceWith4" type="folder" source="" default="" />
<setting label="33211" id="directPathReplace5" type="text" default="" />
<setting label="33212" id="directPathReplaceWith5" type="folder" source="" default="" />

<setting label="33175" type="lsep" />
<setting label="30515" id="limitIndex" type="slider" default="15" range="1, 1, 100" option="int" />
Expand Down