Byebye TheVoid

This commit is contained in:
cvium 2020-10-29 11:54:10 +01:00 committed by Matt
parent 4b8f510325
commit a009530434
8 changed files with 89 additions and 239 deletions

View file

@ -381,43 +381,3 @@ class GetItemWorker(threading.Thread):
if window('jellyfin_should_stop.bool'):
break
class TheVoid(object):
def __init__(self, method, data):
''' If you call get, this will block until response is received.
This is used to communicate between entrypoints.
'''
if type(data) != dict:
raise Exception("unexpected data format")
data['VoidName'] = str(create_id())
LOG.info("---[ contact MU-TH-UR 6000/%s ]", method)
LOG.debug(data)
event(method, data)
self.method = method
self.data = data
def get(self):
while True:
response = window('jellyfin_%s.json' % self.data['VoidName'])
if response != "":
LOG.debug("--<[ nostromo/jellyfin_%s.json ]", self.data['VoidName'])
window('jellyfin_%s' % self.data['VoidName'], clear=True)
return response
if window('jellyfin_should_stop.bool'):
LOG.info("Abandon mission! A black hole just swallowed [ %s/%s ]", self.method, self.data['VoidName'])
return
xbmc.sleep(100)
LOG.info("--[ void/%s ]", self.data['VoidName'])

View file

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import division, absolute_import, print_function, unicode_literals
from __future__ import division, absolute_import, print_function, unicode_literals, annotations
#################################################################################################
@ -11,8 +11,8 @@ from kodi_six import xbmc, xbmcaddon
import database
from dialogs import context
from helper import translate, settings, dialog
from downloader import TheVoid
from helper import LazyLogger
from jellyfin import Jellyfin
#################################################################################################
@ -39,10 +39,11 @@ class Context(object):
try:
self.kodi_id = sys.listitem.getVideoInfoTag().getDbId() or None
self.media = self.get_media_type()
self.server = sys.listitem.getProperty('jellyfinserver') or None
self.server_id = sys.listitem.getProperty('jellyfinserver') or None
self.api_client = Jellyfin(self.server_id).get_client().jellyfin
item_id = sys.listitem.getProperty('jellyfinid')
except AttributeError:
self.server = None
self.server_id = None
if xbmc.getInfoLabel('ListItem.Property(jellyfinid)'):
item_id = xbmc.getInfoLabel('ListItem.Property(jellyfinid)')
@ -51,8 +52,8 @@ class Context(object):
self.media = xbmc.getInfoLabel('ListItem.DBTYPE')
item_id = None
if self.server or item_id:
self.item = TheVoid('GetItem', {'ServerId': self.server, 'Id': item_id}).get()
if self.server_id or item_id:
self.item = self.api_client.get_item(item_id)
else:
self.item = self.get_item_id()
@ -143,13 +144,13 @@ class Context(object):
selected = self._selected_option
if selected == OPTIONS['Refresh']:
TheVoid('RefreshItem', {'ServerId': self.server, 'Id': self.item['Id']})
self.api_client.refresh_item(self.item['Id'])
elif selected == OPTIONS['AddFav']:
TheVoid('FavoriteItem', {'ServerId': self.server, 'Id': self.item['Id'], 'Favorite': True})
self.api_client.favorite(self.item['Id'], True)
elif selected == OPTIONS['RemoveFav']:
TheVoid('FavoriteItem', {'ServerId': self.server, 'Id': self.item['Id'], 'Favorite': False})
self.api_client.favorite(self.item['Id'], False)
elif selected == OPTIONS['Addon']:
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.jellyfin)')
@ -159,7 +160,7 @@ class Context(object):
def delete_item(self):
if settings('skipContextMenu.bool') and dialog("yesno", "{jellyfin}", translate(33015)):
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
self.api_client.delete_item(self.item['Id'])
def transcode(self):
filename = xbmc.getInfoLabel("ListItem.Filenameandpath")

View file

@ -11,12 +11,13 @@ from six.moves.urllib.parse import parse_qsl, urlencode
from kodi_six import xbmc, xbmcvfs, xbmcgui, xbmcplugin, xbmcaddon
import client
import downloader
from database import reset, get_sync, Database, jellyfin_db, get_credentials
from objects import Objects, Actions
from downloader import TheVoid
from helper import translate, event, settings, window, dialog, api, JSONRPC
from helper.utils import JsonDebugPrinter
from helper import LazyLogger
from jellyfin import Jellyfin
#################################################################################################
@ -49,6 +50,8 @@ class Events(object):
mode = params.get('mode')
server = params.get('server')
jellyfin_client = Jellyfin(server).get_client()
api_client = jellyfin_client.jellyfin
if server == 'None':
server = None
@ -69,12 +72,16 @@ class Events(object):
elif mode == 'play':
item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get()
item = api_client.get_item(params['id'])
item["resumePlayback"] = sys.argv[3].split(":")[1] == "true"
Actions(server).play(item, params.get('dbid'), params.get('transcode') == 'true', playlist=params.get('playlist') == 'true')
elif mode == 'playlist':
event('PlayPlaylist', {'Id': params['id'], 'ServerId': server})
api_client.post_session(jellyfin_client.config.data['app.session'], "Playing", {
'PlayCommand': "PlayNow",
'ItemIds': params['id'],
'StartPositionTicks': 0
})
elif mode == 'deviceid':
client.reset_device_id()
elif mode == 'reset':
@ -253,6 +260,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
return
folder = folder.lower() if folder else None
api_client = Jellyfin(server_id).get_client().jellyfin
if folder is None and media in ('homevideos', 'movies', 'books', 'audiobooks'):
return browse_subfolders(media, view_id, server_id)
@ -262,7 +270,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
if view_id:
view = TheVoid('GetItem', {'ServerId': server_id, 'Id': view_id}).get()
view = api_client.get_item(view_id)
xbmcplugin.setPluginCategory(PROCESS_HANDLE, view['Name'])
content_type = "files"
@ -277,47 +285,45 @@ def browse(media, view_id=None, folder=None, server_id=None):
content_type = "artists"
if folder == 'recentlyadded':
listing = TheVoid('RecentlyAdded', {'Id': view_id, 'ServerId': server_id}).get()
listing = api_client.get_recently_added(None, view_id, None)
elif folder == 'genres':
listing = TheVoid('Genres', {'Id': view_id, 'ServerId': server_id}).get()
listing = api_client.get_genres(view_id)
elif media == 'livetv':
listing = TheVoid('LiveTV', {'Id': view_id, 'ServerId': server_id}).get()
listing = api_client.get_channels()
elif folder == 'unwatched':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Filters': ['IsUnplayed']}).get()
listing = downloader.get_filtered_section(view_id, None, None, None, None, None, ['IsUnplayed'], None, server_id)
elif folder == 'favorite':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Filters': ['IsFavorite']}).get()
listing = downloader.get_filtered_section(view_id, None, None, None, None, None, ['IsFavorite'], None, server_id)
elif folder == 'inprogress':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Filters': ['IsResumable']}).get()
listing = downloader.get_filtered_section(view_id, None, None, None, None, None, ['IsResumable'], None, server_id)
elif folder == 'boxsets':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type('boxsets'), 'Recursive': True}).get()
listing = downloader.get_filtered_section(view_id, get_media_type('boxsets'), None, True, None, None, None, None, server_id)
elif folder == 'random':
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Sort': "Random", 'Limit': 25, 'Recursive': True}).get()
listing = downloader.get_filtered_section(view_id, get_media_type(content_type), 25, True, "Random", None, None, None, server_id)
elif (folder or "").startswith('firstletter-'):
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Params': {'NameStartsWith': folder.split('-')[1]}}).get()
listing = downloader.get_filtered_section(view_id, get_media_type(content_type), None, None, None, None, None, {'NameStartsWith': folder.split('-')[1]}, server_id)
elif (folder or "").startswith('genres-'):
listing = TheVoid('Browse', {'Id': view_id, 'ServerId': server_id, 'Media': get_media_type(content_type), 'Params': {'GenreIds': folder.split('-')[1]}}).get()
listing = downloader.get_filtered_section(view_id, get_media_type(content_type), None, None, None, None, None, {'GenreIds': folder.split('-')[1]}, server_id)
elif folder == 'favepisodes':
listing = TheVoid('Browse', {'Media': get_media_type(content_type), 'ServerId': server_id, 'Limit': 25, 'Filters': ['IsFavorite']}).get()
listing = downloader.get_filtered_section(None, get_media_type(content_type), 25, None, None, None, ['IsFavorite'], None, server_id)
elif folder and media == 'playlists':
listing = TheVoid('Browse', {'Id': folder, 'ServerId': server_id, 'Recursive': False, 'Sort': 'None'}).get()
listing = downloader.get_filtered_section(folder, get_media_type(content_type), None, False, 'None', None, None, None, server_id)
elif media == 'homevideos':
listing = TheVoid('Browse', {'Id': folder or view_id, 'Media': get_media_type(content_type), 'ServerId': server_id, 'Recursive': False}).get()
elif media == 'movies':
listing = TheVoid('Browse', {'Id': folder or view_id, 'Media': get_media_type(content_type), 'ServerId': server_id, 'Recursive': True}).get()
listing = downloader.get_filtered_section(folder or view_id, get_media_type(content_type), None, False, None, None, None, None, server_id)
elif media in ['movies', 'episodes']:
listing = downloader.get_filtered_section(folder or view_id, get_media_type(content_type), None, True, None, None, None, None, server_id)
elif media in ('boxset', 'library'):
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': True}).get()
elif media == 'episodes':
listing = TheVoid('Browse', {'Id': folder or view_id, 'Media': get_media_type(content_type), 'ServerId': server_id, 'Recursive': True}).get()
listing = downloader.get_filtered_section(folder or view_id, None, None, True, None, None, None, None, server_id)
elif media == 'boxsets':
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False, 'Filters': ["Boxsets"]}).get()
listing = downloader.get_filtered_section(folder or view_id, None, None, False, None, None, ['Boxsets'], None, server_id)
elif media == 'tvshows':
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': True, 'Media': get_media_type(content_type)}).get()
listing = downloader.get_filtered_section(folder or view_id, get_media_type(content_type), None, True, None, None, None, None, server_id)
elif media == 'seasons':
listing = TheVoid('BrowseSeason', {'Id': folder, 'ServerId': server_id}).get()
listing = api_client.get_seasons(folder)
elif media != 'files':
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False, 'Media': get_media_type(content_type)}).get()
listing = downloader.get_filtered_section(folder or view_id, get_media_type(content_type), None, False, None, None, None, None, server_id)
else:
listing = TheVoid('Browse', {'Id': folder or view_id, 'ServerId': server_id, 'Recursive': False}).get()
listing = downloader.get_filtered_section(folder or view_id, None, None, False, None, None, None, None, server_id)
if listing:
@ -405,7 +411,7 @@ def browse_subfolders(media, view_id, server_id=None):
'''
from views import DYNNODES
view = TheVoid('GetItem', {'ServerId': server_id, 'Id': view_id}).get()
view = Jellyfin(server_id).get_client().jellyfin.get_item(view_id)
xbmcplugin.setPluginCategory(PROCESS_HANDLE, view['Name'])
nodes = DYNNODES[media]
@ -431,7 +437,7 @@ def browse_letters(media, view_id, server_id=None):
'''
letters = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ"
view = TheVoid('GetItem', {'ServerId': server_id, 'Id': view_id}).get()
view = Jellyfin(server_id).get_client().jellyfin.get_item(view_id)
xbmcplugin.setPluginCategory(PROCESS_HANDLE, view['Name'])
for node in letters:
@ -501,12 +507,13 @@ def get_fanart(item_id, path, server_id=None):
objects = Objects()
list_li = []
directory = xbmc.translatePath("special://thumbnails/jellyfin/%s/" % item_id)
server = TheVoid('GetServerAddress', {'ServerId': server_id}).get()
jellyfin_client = Jellyfin(server_id).get_client()
server = jellyfin_client.auth.get_server_info(self.server_id)['address']
if not xbmcvfs.exists(directory):
xbmcvfs.mkdirs(directory)
item = TheVoid('GetItem', {'ServerId': server_id, 'Id': item_id}).get()
item = jellyfin_client.jellyfin.get_item(item_id)
obj = objects.map(item, 'Artwork')
backdrops = api.API(item, server).get_all_artwork(obj)
tags = obj['BackdropTags']
@ -542,8 +549,8 @@ def get_video_extras(item_id, path, server_id=None):
if not item_id:
return
TheVoid('GetItem', {'ServerId': server_id, 'Id': item_id}).get()
# TODO: Investigate the void (issue #228)
# TODO implement????
# Jellyfin(server_id).get_client().jellyfin.get_item(item_id)
"""
def getVideoFiles(jellyfinId,jellyfinPath):
@ -737,8 +744,9 @@ def add_user():
if not window('jellyfin_online.bool'):
return
session = TheVoid('GetSession', {}).get()
users = TheVoid('GetUsers', {'IsDisabled': False, 'IsHidden': False}).get()
jellyfin_client = Jellyfin().get_client()
session = jellyfin_client.get_device(jellyfin_client.config.app.device_id)
users = jellyfin_client.jellyfin.get_users()
current = session[0]['AdditionalUsers']
result = dialog("select", translate(33061), [translate(33062), translate(33063)] if current else [translate(33062)])
@ -796,18 +804,19 @@ def get_themes():
views = [x[0] for x in all_views if x[2] in ('movies', 'tvshows', 'mixed')]
items = {}
server = TheVoid('GetServerAddress', {'ServerId': None}).get()
token = TheVoid('GetToken', {'ServerId': None}).get()
jellyfin_client = Jellyfin().get_client()
server = jellyfin_client.auth.get_server_address()
token = jellyfin_client.auth.jellyfin_token()
for view in views:
result = TheVoid('GetThemes', {'Type': "Video", 'Id': view}).get()
result = jellyfin_client.jellyfin.get_items_theme_video(view)
for item in result['Items']:
folder = normalize_string(item['Name'])
items[item['Id']] = folder
result = TheVoid('GetThemes', {'Type': "Song", 'Id': view}).get()
result = jellyfin_client.jellyfin.get_items_theme_song(view)
for item in result['Items']:
@ -822,7 +831,7 @@ def get_themes():
if not xbmcvfs.exists(nfo_path):
xbmcvfs.mkdir(nfo_path)
themes = TheVoid('GetTheme', {'Id': item}).get()
themes = jellyfin_client.jellyfin.get_themes(item)
paths = []
for theme in themes['ThemeVideosResult']['Items'] + themes['ThemeSongsResult']['Items']:

View file

@ -11,8 +11,8 @@ from kodi_six import xbmc, xbmcvfs
import client
import requests
from downloader import TheVoid
from helper import LazyLogger
from jellyfin import Jellyfin
from . import translate, settings, window, dialog, api
@ -60,23 +60,19 @@ class PlayUtils(object):
'''
self.item = item
self.item['PlaybackInfo'] = {}
self.jellyfin_client = Jellyfin(server_id).get_client()
self.info = {
'ServerId': server_id,
'ServerAddress': server,
'ForceTranscode': force_transcode,
'Token': token or TheVoid('GetToken', {'ServerId': server_id}).get()
'Token': token or self.jellyfin_client.auth.jellyfin_token()
}
def get_sources(self, source_id=None):
''' Return sources based on the optional source_id or the device profile.
'''
params = {
'ServerId': self.info['ServerId'],
'Id': self.item['Id'],
'Profile': self.get_device_profile()
}
info = TheVoid('GetPlaybackInfo', params).get()
info = self.jellyfin_client.jellyfin.get_play_info(self.item['Id'], self.get_device_profile())
LOG.info(info)
self.info['PlaySessionId'] = info['PlaySessionId']
sources = []
@ -217,14 +213,7 @@ class PlayUtils(object):
''' Get live stream media info.
'''
params = {
'ServerId': self.info['ServerId'],
'Id': self.item['Id'],
'Profile': self.get_device_profile(),
'PlaySessionId': self.info['PlaySessionId'],
'Token': source['OpenToken']
}
info = TheVoid('GetLiveStream', params).get()
info = self.jellyfin_client.jellyfin.get_live_stream(self.item['Id'], self.info['PlaySessionId'], source['OpenToken'], self.get_device_profile())
LOG.info(info)
if info['MediaSource'].get('RequiresClosing'):
@ -509,7 +498,7 @@ class PlayUtils(object):
mapping = {}
kodi = 0
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
for stream in source['MediaStreams']:
if stream['SupportsExternalStream'] and stream['Type'] == 'Subtitle' and stream['DeliveryMethod'] == 'External':
@ -598,7 +587,7 @@ class PlayUtils(object):
subs_streams = collections.OrderedDict()
streams = source['MediaStreams']
server_settings = TheVoid('GetTranscodeOptions', {'ServerId': self.info['ServerId']}).get()
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
allow_burned_subs = settings('allowBurnedSubs.bool')
for stream in streams:
@ -665,6 +654,7 @@ class PlayUtils(object):
if subtitle:
index = subtitle
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
stream = streams[index]
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
@ -683,6 +673,8 @@ class PlayUtils(object):
index = subs_streams[selection[resp]] if resp > -1 else source.get('DefaultSubtitleStreamIndex')
if index is not None:
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
stream = streams[index]
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:

View file

@ -54,6 +54,7 @@ class Jellyfin(object):
self.server_id = server_id or "default"
def get_client(self):
# type: () -> JellyfinClient
return self.client[self.server_id]
def close(self):

View file

@ -204,6 +204,9 @@ class ConnectionManager(object):
if server['Id'] == server_id:
return server
def get_server_address(self, server_id):
return self.get_server_info(server_id or self.server_id).get('address')
def get_public_users(self):
return self.client.jellyfin.get_public_users()

View file

@ -53,12 +53,7 @@ class Monitor(xbmc.Monitor):
if sender == 'plugin.video.jellyfin':
method = method.split('.')[1]
if method not in ('GetItem', 'ReportProgressRequested', 'LoadServer', 'RandomItems', 'Recommended',
'GetServerAddress', 'GetPlaybackInfo', 'Browse', 'GetImages', 'GetToken',
'PlayPlaylist', 'Play', 'GetIntros', 'GetAdditionalParts', 'RefreshItem', 'Genres',
'FavoriteItem', 'DeleteItem', 'AddUser', 'GetSession', 'GetUsers', 'GetThemes',
'GetTheme', 'Playstate', 'GeneralCommand', 'GetTranscodeOptions', 'RecentlyAdded',
'BrowseSeason', 'LiveTV', 'GetLiveStream'):
if method not in ('ReportProgressRequested', 'LoadServer', 'AddUser', 'PlayPlaylist', 'Play', 'Playstate', 'GeneralCommand'):
return
data = json.loads(data)[0]
@ -122,116 +117,17 @@ class Monitor(xbmc.Monitor):
LOG.exception(error)
server = Jellyfin()
if method == 'GetItem':
server = server.get_client()
item = server.jellyfin.get_item(data['Id'])
self.void_responder(data, item)
if method == 'Play':
elif method == 'GetAdditionalParts':
items = server.jellyfin.get_items(data['ItemIds'])
item = server.jellyfin.get_additional_parts(data['Id'])
self.void_responder(data, item)
elif method == 'GetIntros':
item = server.jellyfin.get_intros(data['Id'])
self.void_responder(data, item)
elif method == 'GetImages':
item = server.jellyfin.get_images(data['Id'])
self.void_responder(data, item)
elif method == 'GetServerAddress':
server_address = server.auth.get_server_info(server.auth.server_id)['address']
self.void_responder(data, server_address)
elif method == 'GetPlaybackInfo':
sources = server.jellyfin.get_play_info(data['Id'], data['Profile'])
self.void_responder(data, sources)
elif method == 'GetLiveStream':
sources = server.jellyfin.get_live_stream(data['Id'], data['PlaySessionId'], data['Token'], data['Profile'])
self.void_responder(data, sources)
elif method == 'GetToken':
token = server.auth.jellyfin_token()
self.void_responder(data, token)
elif method == 'GetSession':
session = server.jellyfin.get_device(self.device_id)
self.void_responder(data, session)
elif method == 'GetUsers':
users = server.jellyfin.get_users()
self.void_responder(data, users)
elif method == 'GetTranscodeOptions':
result = server.jellyfin.get_transcode_settings()
self.void_responder(data, result)
elif method == 'GetThemes':
if data['Type'] == 'Video':
theme = server.jellyfin.get_items_theme_video(data['Id'])
else:
theme = server.jellyfin.get_items_theme_song(data['Id'])
self.void_responder(data, theme)
elif method == 'GetTheme':
theme = server.jellyfin.get_themes(data['Id'])
self.void_responder(data, theme)
elif method == 'Browse':
result = downloader.get_filtered_section(data.get('Id'), data.get('Media'), data.get('Limit'),
data.get('Recursive'), data.get('Sort'), data.get('SortOrder'),
data.get('Filters'), data.get('Params'), data.get('ServerId'))
self.void_responder(data, result)
elif method == 'BrowseSeason':
result = server.jellyfin.get_seasons(data['Id'])
self.void_responder(data, result)
elif method == 'LiveTV':
result = server.jellyfin.get_channels()
self.void_responder(data, result)
elif method == 'RecentlyAdded':
result = server.jellyfin.get_recently_added(data.get('Media'), data.get('Id'), data.get('Limit'))
self.void_responder(data, result)
elif method == 'Genres':
result = server.jellyfin.get_genres(data.get('Id'))
self.void_responder(data, result)
elif method == 'Recommended':
result = server.jellyfin.get_recommendation(data.get('Id'), data.get('Limit'))
self.void_responder(data, result)
elif method == 'RefreshItem':
server.jellyfin.refresh_item(data['Id'])
elif method == 'FavoriteItem':
server.jellyfin.favorite(data['Id'], data['Favorite'])
elif method == 'DeleteItem':
server.jellyfin.delete_item(data['Id'])
PlaylistWorker(data.get('ServerId'), items, data['PlayCommand'] == 'PlayNow',
data.get('StartPositionTicks', 0), data.get('AudioStreamIndex'),
data.get('SubtitleStreamIndex')).start()
# TODO no clue if this is called by anything
elif method == 'PlayPlaylist':
server.jellyfin.post_session(server.config.data['app.session'], "Playing", {
@ -240,14 +136,6 @@ class Monitor(xbmc.Monitor):
'StartPositionTicks': 0
})
elif method == 'Play':
items = server.jellyfin.get_items(data['ItemIds'])
PlaylistWorker(data.get('ServerId'), items, data['PlayCommand'] == 'PlayNow',
data.get('StartPositionTicks', 0), data.get('AudioStreamIndex'),
data.get('SubtitleStreamIndex')).start()
elif method in ('ReportProgressRequested', 'Player.OnAVChange'):
self.player.report_playback(data.get('Report', True))
@ -270,14 +158,9 @@ class Monitor(xbmc.Monitor):
elif method == 'VideoLibrary.OnUpdate':
on_update(data, server)
def void_responder(self, data, result):
window('jellyfin_%s.json' % data['VoidName'], result)
LOG.debug("--->[ nostromo/jellyfin_%s.json ] sent", data['VoidName'])
def server_instance(self, server_id=None):
server = Jellyfin(server_id)
server = Jellyfin(server_id).get_client()
self.post_capabilities(server)
if server_id is not None:

View file

@ -10,10 +10,10 @@ from datetime import timedelta
from kodi_six import xbmc, xbmcgui, xbmcplugin, xbmcaddon
import database
from downloader import TheVoid
from helper import translate, playutils, api, window, settings, dialog
from dialogs import resume
from helper import LazyLogger
from jellyfin import Jellyfin
from .obj import Objects
@ -29,7 +29,9 @@ class Actions(object):
def __init__(self, server_id=None):
self.server_id = server_id or None
self.server = TheVoid('GetServerAddress', {'ServerId': self.server_id}).get()
client = Jellyfin(self.server_id).get_client()
self.api_client = client.jellyfin
self.server = client.auth.get_server_address(self.server_id)
self.stack = []
def get_playlist(self, item):
@ -112,7 +114,7 @@ class Actions(object):
''' if we have any play them when the movie/show is not being resumed.
'''
intros = TheVoid('GetIntros', {'ServerId': self.server_id, 'Id': item['Id']}).get()
intros = self.api_client.get_intros(item['Id'])
if intros['Items']:
enabled = True
@ -145,8 +147,7 @@ class Actions(object):
''' Create listitems and add them to the stack of playlist.
'''
parts = TheVoid('GetAdditionalParts', {'ServerId': self.server_id, 'Id': item_id}).get()
parts = self.api_client.get_additional_parts(item_id)
for part in parts['Items']:
listitem = xbmcgui.ListItem()