mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Voidless playback. Slightly important
This commit is contained in:
parent
4a437f7a2b
commit
feea23e9da
3 changed files with 11 additions and 12 deletions
|
@ -844,7 +844,7 @@ def get_themes(api_client):
|
||||||
paths = []
|
paths = []
|
||||||
|
|
||||||
for theme in themes['ThemeVideosResult']['Items'] + themes['ThemeSongsResult']['Items']:
|
for theme in themes['ThemeVideosResult']['Items'] + themes['ThemeSongsResult']['Items']:
|
||||||
putils = PlayUtils(theme, False, None, server, token)
|
putils = PlayUtils(theme, False, None, server, api_client)
|
||||||
|
|
||||||
if play:
|
if play:
|
||||||
paths.append(putils.direct_play(theme['MediaSources'][0]))
|
paths.append(putils.direct_play(theme['MediaSources'][0]))
|
||||||
|
|
|
@ -12,7 +12,6 @@ from kodi_six import xbmc, xbmcvfs
|
||||||
import client
|
import client
|
||||||
import requests
|
import requests
|
||||||
from helper import LazyLogger
|
from helper import LazyLogger
|
||||||
from jellyfin import Jellyfin
|
|
||||||
|
|
||||||
from . import translate, settings, window, dialog, api
|
from . import translate, settings, window, dialog, api
|
||||||
|
|
||||||
|
@ -53,26 +52,26 @@ def set_properties(item, method, server_id=None):
|
||||||
|
|
||||||
class PlayUtils(object):
|
class PlayUtils(object):
|
||||||
|
|
||||||
def __init__(self, item, force_transcode=False, server_id=None, server=None, token=None):
|
def __init__(self, item, force_transcode=False, server_id=None, server=None, api_client=None):
|
||||||
|
|
||||||
''' Item will be updated with the property PlaybackInfo, which
|
''' Item will be updated with the property PlaybackInfo, which
|
||||||
holds all the playback information.
|
holds all the playback information.
|
||||||
'''
|
'''
|
||||||
self.item = item
|
self.item = item
|
||||||
self.item['PlaybackInfo'] = {}
|
self.item['PlaybackInfo'] = {}
|
||||||
self.jellyfin_client = Jellyfin(server_id).get_client()
|
self.api_client = api_client
|
||||||
self.info = {
|
self.info = {
|
||||||
'ServerId': server_id,
|
'ServerId': server_id,
|
||||||
'ServerAddress': server,
|
'ServerAddress': server,
|
||||||
'ForceTranscode': force_transcode,
|
'ForceTranscode': force_transcode,
|
||||||
'Token': token or self.jellyfin_client.auth.jellyfin_token()
|
'Token': api_client.config.data['auth.token']
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_sources(self, source_id=None):
|
def get_sources(self, source_id=None):
|
||||||
|
|
||||||
''' Return sources based on the optional source_id or the device profile.
|
''' Return sources based on the optional source_id or the device profile.
|
||||||
'''
|
'''
|
||||||
info = self.jellyfin_client.jellyfin.get_play_info(self.item['Id'], self.get_device_profile())
|
info = self.api_client.get_play_info(self.item['Id'], self.get_device_profile())
|
||||||
LOG.info(info)
|
LOG.info(info)
|
||||||
self.info['PlaySessionId'] = info['PlaySessionId']
|
self.info['PlaySessionId'] = info['PlaySessionId']
|
||||||
sources = []
|
sources = []
|
||||||
|
@ -213,7 +212,7 @@ class PlayUtils(object):
|
||||||
|
|
||||||
''' Get live stream media info.
|
''' Get live stream media info.
|
||||||
'''
|
'''
|
||||||
info = self.jellyfin_client.jellyfin.get_live_stream(self.item['Id'], self.info['PlaySessionId'], source['OpenToken'], self.get_device_profile())
|
info = self.api_client.get_live_stream(self.item['Id'], self.info['PlaySessionId'], source['OpenToken'], self.get_device_profile())
|
||||||
LOG.info(info)
|
LOG.info(info)
|
||||||
|
|
||||||
if info['MediaSource'].get('RequiresClosing'):
|
if info['MediaSource'].get('RequiresClosing'):
|
||||||
|
@ -498,7 +497,7 @@ class PlayUtils(object):
|
||||||
mapping = {}
|
mapping = {}
|
||||||
kodi = 0
|
kodi = 0
|
||||||
|
|
||||||
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
|
server_settings = self.api_client.get_transcode_settings()
|
||||||
|
|
||||||
for stream in source['MediaStreams']:
|
for stream in source['MediaStreams']:
|
||||||
if stream['SupportsExternalStream'] and stream['Type'] == 'Subtitle' and stream['DeliveryMethod'] == 'External':
|
if stream['SupportsExternalStream'] and stream['Type'] == 'Subtitle' and stream['DeliveryMethod'] == 'External':
|
||||||
|
@ -587,7 +586,7 @@ class PlayUtils(object):
|
||||||
subs_streams = collections.OrderedDict()
|
subs_streams = collections.OrderedDict()
|
||||||
streams = source['MediaStreams']
|
streams = source['MediaStreams']
|
||||||
|
|
||||||
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
|
server_settings = self.api_client.get_transcode_settings()
|
||||||
allow_burned_subs = settings('allowBurnedSubs.bool')
|
allow_burned_subs = settings('allowBurnedSubs.bool')
|
||||||
|
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
|
@ -654,7 +653,7 @@ class PlayUtils(object):
|
||||||
if subtitle:
|
if subtitle:
|
||||||
|
|
||||||
index = subtitle
|
index = subtitle
|
||||||
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
|
server_settings = self.api_client.get_transcode_settings()
|
||||||
stream = streams[index]
|
stream = streams[index]
|
||||||
|
|
||||||
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
|
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
|
||||||
|
@ -674,7 +673,7 @@ class PlayUtils(object):
|
||||||
|
|
||||||
if index is not None:
|
if index is not None:
|
||||||
|
|
||||||
server_settings = self.jellyfin_client.jellyfin.get_transcode_settings()
|
server_settings = self.api_client.get_transcode_settings()
|
||||||
stream = streams[index]
|
stream = streams[index]
|
||||||
|
|
||||||
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
|
if server_settings['EnableSubtitleExtraction'] and stream['SupportsExternalStream']:
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Actions(object):
|
||||||
|
|
||||||
transcode = transcode or settings('playFromTranscode.bool')
|
transcode = transcode or settings('playFromTranscode.bool')
|
||||||
kodi_playlist = self.get_playlist(item)
|
kodi_playlist = self.get_playlist(item)
|
||||||
play = playutils.PlayUtils(item, transcode, self.server_id, self.server)
|
play = playutils.PlayUtils(item, transcode, self.server_id, self.server, self.api_client)
|
||||||
source = play.select_source(play.get_sources())
|
source = play.select_source(play.get_sources())
|
||||||
play.set_external_subs(source, listitem)
|
play.set_external_subs(source, listitem)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue