mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-19 06:36:12 +00:00
Reimplement native mode to function client side
This commit is contained in:
parent
519fa9d9db
commit
3e3a79c6bb
5 changed files with 102 additions and 1 deletions
|
@ -4,6 +4,8 @@ from __future__ import division, absolute_import, print_function, unicode_litera
|
|||
##################################################################################################
|
||||
|
||||
from . import settings, LazyLogger
|
||||
from .utils import translate_path
|
||||
import json
|
||||
|
||||
##################################################################################################
|
||||
|
||||
|
@ -20,6 +22,17 @@ class API(object):
|
|||
self.item = item
|
||||
self.server = server
|
||||
|
||||
addon_data = translate_path(
|
||||
"special://profile/addon_data/plugin.video.jellyfin/data.json"
|
||||
)
|
||||
try:
|
||||
with open(addon_data, "rb") as infile:
|
||||
data = json.load(infile)
|
||||
self.path_data = data["Servers"][0].get("paths", {})
|
||||
except Exception as e:
|
||||
LOG.warning("Addon appears to not be configured yet: {}".format(e))
|
||||
|
||||
|
||||
def get_playcount(self, played, playcount):
|
||||
"""Convert Jellyfin played/playcount into
|
||||
the Kodi equivalent. The playcount is tied to the watch status.
|
||||
|
@ -229,6 +242,11 @@ class API(object):
|
|||
protocol = path.split("://")[0]
|
||||
path = path.replace(protocol, protocol.lower())
|
||||
|
||||
# Loop through configured path replacements searching for a match
|
||||
for local_path in self.path_data.keys():
|
||||
if local_path in path:
|
||||
path = path.replace(local_path, self.path_data[local_path])
|
||||
|
||||
return path
|
||||
|
||||
def get_user_artwork(self, user_id):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue