Fixed transcode via context menu

This commit is contained in:
Sebastian S 2019-01-14 18:21:08 +01:00
parent d0c5cf5864
commit f6ffd31e2d
3 changed files with 25 additions and 26 deletions

View file

@ -171,6 +171,6 @@ class Context(object):
TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']}) TheVoid('DeleteItem', {'ServerId': self.server, 'Id': self.item['Id']})
def transcode(self): def transcode(self):
filename = xbmc.getInfoLabel("ListItem.Filenameandpath")
item = TheVoid('GetItem', {'Id': self.item['Id'], 'ServerId': self.server}).get() filename += "&transcode=True"
Actions(self.server).play(item, self.kodi_id, True) xbmc.executebuiltin("PlayMedia(%s)" % filename)

View file

@ -69,7 +69,7 @@ class Events(object):
elif mode =='play': elif mode =='play':
item = TheVoid('GetItem', {'Id': params['id'], 'ServerId': server}).get() 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': elif mode == 'playlist':
event('PlayPlaylist', {'Id': params['id'], 'ServerId': server}) event('PlayPlaylist', {'Id': params['id'], 'ServerId': server})

View file

@ -159,9 +159,8 @@ class StoppableHttpRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
try: try:
params = self.get_params() params = self.get_params()
LOG.info("Webservice called with params: %s", params) LOG.info("Webservice called with params: %s", params)
path = ("plugin://plugin.video.emby?mode=play&id=%s&dbid=%s&filename=%s&transcode=%s"
path = ("plugin://plugin.video.emby?mode=play&id=%s&dbid=%s&filename=%s" % (params.get('Id'), params.get('KodiId'), params.get('Name'), params.get('transcode') or False))
% (params.get('Id'), params.get('KodiId'), params.get('Name')))
self.send_response(200) self.send_response(200)
self.send_header('Content-type', 'text/html') self.send_header('Content-type', 'text/html')
self.send_header('Content-Length', len(path)) self.send_header('Content-Length', len(path))