Fix playing trailers directly via Plex Companion
This commit is contained in:
parent
b2663da584
commit
613e033b48
6 changed files with 27 additions and 12 deletions
|
@ -802,7 +802,7 @@ class PlexAPI():
|
|||
'X-Plex-Client-Platform': self.platform,
|
||||
'X-Plex-Device-Name': self.deviceName,
|
||||
'X-Plex-Platform': self.addonName,
|
||||
'X-Plex-Platform-Version': 'no idea',
|
||||
'X-Plex-Platform-Version': 'unknown',
|
||||
'X-Plex-Model': 'unknown',
|
||||
'X-Plex-Product': self.addonName,
|
||||
'X-Plex-Version': self.plexversion,
|
||||
|
|
|
@ -68,7 +68,7 @@ class DownloadUtils():
|
|||
def setToken(self, token):
|
||||
# Reserved for userclient only
|
||||
self.token = token
|
||||
self.logMsg("Set token: %s" % token, 2)
|
||||
self.logMsg("Set token: xxxxxxx", 2)
|
||||
|
||||
def setSSL(self, ssl, sslclient):
|
||||
# Reserved for userclient only
|
||||
|
|
|
@ -40,6 +40,7 @@ def plexCompanion(fullurl, resume=None):
|
|||
except IndexError:
|
||||
# No matches found, url not like:
|
||||
# http://192.168.0.2:32400/library/metadata/243480
|
||||
utils.logMsg("plexCompanion", "Could not parse url: %s" % fullurl, -1)
|
||||
return False
|
||||
# TODO: direct play an URL
|
||||
# Initialize embydb
|
||||
|
@ -47,11 +48,19 @@ def plexCompanion(fullurl, resume=None):
|
|||
embycursor = embyconn.cursor()
|
||||
emby = embydb_functions.Embydb_Functions(embycursor)
|
||||
# Get dbid using itemid
|
||||
dbid = emby.getItem_byId(itemid)[0]
|
||||
# Works only for library items, not e.g. for trailers
|
||||
try:
|
||||
dbid = emby.getItem_byId(itemid)[0]
|
||||
except TypeError:
|
||||
# Trailers and the like
|
||||
dbid = None
|
||||
embyconn.close()
|
||||
# Fix resume timing
|
||||
if resume:
|
||||
resume = round(float(resume) / 1000.0, 6)
|
||||
if resume == '0':
|
||||
resume = None
|
||||
else:
|
||||
resume = round(float(resume) / 1000.0, 6)
|
||||
# Start playing
|
||||
item = PlexAPI.PlexAPI().GetPlexMetadata(itemid)
|
||||
pbutils.PlaybackUtils(item).play(itemid, dbid, seektime=resume)
|
||||
|
@ -77,7 +86,7 @@ def resetAuth():
|
|||
"Plex might lock your account if you fail to log in too many times. "
|
||||
"Proceed anyway?"))
|
||||
if resp == 1:
|
||||
utils.logMsg("EMBY", "Reset login attempts.", 1)
|
||||
utils.logMsg("PLEX", "Reset login attempts.", 1)
|
||||
utils.window('emby_serverStatus', value="Auth")
|
||||
else:
|
||||
xbmc.executebuiltin('Addon.OpenSettings(plugin.video.plexkodiconnect)')
|
||||
|
|
|
@ -178,7 +178,7 @@ class PlaybackUtils():
|
|||
playlist.add(additionalPlayurl, additionalListItem, index=currentPosition)
|
||||
self.pl.verifyPlaylist()
|
||||
currentPosition += 1
|
||||
i = i + 1
|
||||
i += 1
|
||||
API.setPartNumber(0)
|
||||
|
||||
if dummyPlaylist:
|
||||
|
|
|
@ -25,6 +25,14 @@ plexbmc = xbmcaddon.Addon('plugin.video.plexkodiconnect')
|
|||
settings['debug'] = utils.settings('companionDebugging')
|
||||
settings['gdm_debug'] = utils.settings('companionGDMDebugging')
|
||||
|
||||
# Transform 'true' into True because of the way Kodi's file settings work
|
||||
kodiSettingsList = ['debug', 'gdm_debug']
|
||||
for entry in kodiSettingsList:
|
||||
if settings[entry] == 'true':
|
||||
settings[entry] = True
|
||||
else:
|
||||
settings[entry] = False
|
||||
|
||||
settings['client_name'] = plexbmc.getSetting('deviceName')
|
||||
|
||||
# XBMC web server settings
|
||||
|
|
|
@ -151,15 +151,13 @@ class UserClient(threading.Thread):
|
|||
if not s_token:
|
||||
# Save access token if it's missing from settings
|
||||
utils.settings('accessToken', value=w_token)
|
||||
self.logMsg(
|
||||
"Returning accessToken from WINDOW for username: %s accessToken: %s"
|
||||
% (username, w_token), 2)
|
||||
self.logMsg("Returning accessToken from WINDOW for username: %s "
|
||||
"accessToken: xxxxx" % username, 2)
|
||||
return w_token
|
||||
# Verify the settings
|
||||
elif s_token:
|
||||
self.logMsg(
|
||||
"Returning accessToken from SETTINGS for username: %s accessToken: %s"
|
||||
% (username, s_token), 2)
|
||||
self.logMsg("Returning accessToken from SETTINGS for username: %s "
|
||||
"accessToken: xxxxx" % username, 2)
|
||||
utils.window('emby_accessToken%s' % username, value=s_token)
|
||||
return s_token
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue