mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Fixed transcode via context menu
This commit is contained in:
parent
d0c5cf5864
commit
f6ffd31e2d
3 changed files with 25 additions and 26 deletions
|
@ -36,7 +36,7 @@ class Context(object):
|
|||
_selected_option = None
|
||||
|
||||
def __init__(self, transcode=False, delete=False):
|
||||
|
||||
|
||||
try:
|
||||
self.kodi_id = sys.listitem.getVideoInfoTag().getDbId() or None
|
||||
self.media = self.get_media_type()
|
||||
|
@ -51,7 +51,7 @@ class Context(object):
|
|||
self.kodi_id = xbmc.getInfoLabel('ListItem.DBID')
|
||||
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()
|
||||
else:
|
||||
|
@ -171,6 +171,6 @@ class Context(object):
|
|||
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
|
||||
|
||||
def transcode(self):
|
||||
|
||||
item = TheVoid('GetItem', {'Id': self.item['Id'], 'ServerId': self.server}).get()
|
||||
Actions(self.server).play(item, self.kodi_id, True)
|
||||
filename = xbmc.getInfoLabel("ListItem.Filenameandpath")
|
||||
filename += "&transcode=True"
|
||||
xbmc.executebuiltin("PlayMedia(%s)" % filename)
|
||||
|
|
|
@ -69,7 +69,7 @@ class Events(object):
|
|||
elif mode =='play':
|
||||
|
||||
item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get()
|
||||
Actions(server).play(item, params.get('dbid'), playlist=params.get('playlist') == 'true')
|
||||
Actions(server).play(item, params.get('dbid'), True if params.get('transcode') == 'True' else False, playlist=params.get('playlist') == 'true')
|
||||
|
||||
elif mode == 'playlist':
|
||||
event('PlayPlaylist', {'Id': params['id'], 'ServerId': server})
|
||||
|
@ -163,7 +163,7 @@ def listing():
|
|||
context.append((_(33133), "RunPlugin(plugin://plugin.video.emby/?mode=removelib&id=%s)" % view_id))
|
||||
|
||||
LOG.debug("--[ listing/%s/%s ] %s", node, label, path)
|
||||
|
||||
|
||||
if path:
|
||||
if xbmc.getCondVisibility('Window.IsActive(Pictures)') and node in ('photos', 'homevideos'):
|
||||
directory(label, path, artwork=artwork)
|
||||
|
@ -259,7 +259,7 @@ def browse(media, view_id=None, folder=None, server_id=None):
|
|||
|
||||
if folder is None and media in ('homevideos', 'movies', 'books', 'audiobooks'):
|
||||
return browse_subfolders(media, view_id, server_id)
|
||||
|
||||
|
||||
if folder and folder == 'firstletter':
|
||||
return browse_letters(media, view_id, server_id)
|
||||
|
||||
|
@ -486,7 +486,7 @@ def get_media_type(media):
|
|||
return "MusicArtist,MusicAlbum,Audio"
|
||||
|
||||
def get_fanart(item_id, path, server_id=None):
|
||||
|
||||
|
||||
''' Get extra fanart for listitems. This is called by skinhelper.
|
||||
Images are stored locally, due to the Kodi caching system.
|
||||
'''
|
||||
|
@ -571,7 +571,7 @@ def get_video_extras(item_id, path, server_id=None):
|
|||
"""
|
||||
|
||||
def get_next_episodes(item_id, limit):
|
||||
|
||||
|
||||
''' Only for synced content.
|
||||
'''
|
||||
with Database('emby') as embydb:
|
||||
|
@ -658,7 +658,7 @@ def create_listitem(item):
|
|||
label2 = ""
|
||||
li = xbmcgui.ListItem(title)
|
||||
li.setProperty('IsPlayable', "true")
|
||||
|
||||
|
||||
metadata = {
|
||||
'Title': title,
|
||||
'duration': str(item['runtime']/60),
|
||||
|
@ -712,7 +712,7 @@ def create_listitem(item):
|
|||
metadata['CastAndRole'] = castandrole
|
||||
|
||||
li.setLabel2(label2)
|
||||
li.setInfo(type="Video", infoLabels=metadata)
|
||||
li.setInfo(type="Video", infoLabels=metadata)
|
||||
li.setProperty('resumetime', str(item['resume']['position']))
|
||||
li.setProperty('totaltime', str(item['resume']['total']))
|
||||
li.setArt(item['art'])
|
||||
|
@ -794,7 +794,7 @@ def get_themes():
|
|||
|
||||
items = {}
|
||||
server = TheVoid('GetServerAddress', {'ServerId': None}).get()
|
||||
token = TheVoid('GetToken', {'ServerId': None}).get()
|
||||
token = TheVoid('GetToken', {'ServerId': None}).get()
|
||||
|
||||
for view in views:
|
||||
result = TheVoid('GetThemes', {'Type': "Video", 'Id': view}).get()
|
||||
|
|
|
@ -84,11 +84,11 @@ class Request(object):
|
|||
|
||||
|
||||
class StoppableHttpServer(BaseHTTPServer.HTTPServer):
|
||||
|
||||
|
||||
''' Http server that reacts to self.stop flag.
|
||||
'''
|
||||
def serve_forever(self):
|
||||
|
||||
|
||||
''' Handle one request at a time until stopped.
|
||||
'''
|
||||
self.stop = False
|
||||
|
@ -100,7 +100,7 @@ class StoppableHttpServer(BaseHTTPServer.HTTPServer):
|
|||
|
||||
|
||||
class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
||||
|
||||
|
||||
''' http request handler with QUIT stopping the server
|
||||
'''
|
||||
raw_requestline = ""
|
||||
|
@ -120,16 +120,16 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
self.server.stop = True
|
||||
|
||||
def parse_request(self):
|
||||
|
||||
|
||||
''' Modify here to workaround unencoded requests.
|
||||
'''
|
||||
'''
|
||||
retval = SimpleHTTPServer.SimpleHTTPRequestHandler.parse_request(self)
|
||||
self.request = Request(self.path, self.headers, self.rfile)
|
||||
|
||||
|
||||
return retval
|
||||
|
||||
def do_HEAD(self):
|
||||
|
||||
|
||||
''' Called on HEAD requests
|
||||
'''
|
||||
self.handle_request(True)
|
||||
|
@ -137,7 +137,7 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
return
|
||||
|
||||
def get_params(self):
|
||||
|
||||
|
||||
''' Get the params
|
||||
'''
|
||||
try:
|
||||
|
@ -153,15 +153,14 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
return params
|
||||
|
||||
def handle_request(self, headers_only=False):
|
||||
|
||||
|
||||
''' Send headers and reponse
|
||||
'''
|
||||
try:
|
||||
params = self.get_params()
|
||||
LOG.info("Webservice called with params: %s", params)
|
||||
|
||||
path = ("plugin://plugin.video.emby?mode=play&id=%s&dbid=%s&filename=%s"
|
||||
% (params.get('Id'), params.get('KodiId'), params.get('Name')))
|
||||
path = ("plugin://plugin.video.emby?mode=play&id=%s&dbid=%s&filename=%s&transcode=%s"
|
||||
% (params.get('Id'), params.get('KodiId'), params.get('Name'), params.get('transcode') or False))
|
||||
self.send_response(200)
|
||||
self.send_header('Content-type', 'text/html')
|
||||
self.send_header('Content-Length', len(path))
|
||||
|
@ -176,7 +175,7 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
|
|||
return
|
||||
|
||||
def do_GET(self):
|
||||
|
||||
|
||||
''' Called on GET requests
|
||||
'''
|
||||
self.handle_request()
|
||||
|
|
Loading…
Reference in a new issue