Fix dbid not found if playQueue sent

This commit is contained in:
tomkat83 2016-02-11 10:30:29 +01:00
parent 99129e5a78
commit 39f1d0c367
3 changed files with 15 additions and 13 deletions

View file

@ -784,7 +784,7 @@ class PlexAPI():
# Get addon infos # Get addon infos
xargs = { xargs = {
'Accept': '*/*', 'Accept': '*/*',
'Connection': 'close', 'Connection': 'keep-alive',
"Content-Type": "application/x-www-form-urlencoded", "Content-Type": "application/x-www-form-urlencoded",
# "Access-Control-Allow-Origin": "*", # "Access-Control-Allow-Origin": "*",
'X-Plex-Language': 'en', 'X-Plex-Language': 'en',

View file

@ -113,7 +113,7 @@ class Player(xbmc.Player):
# Start at, when using custom playlist (play to Kodi from webclient) # Start at, when using custom playlist (play to Kodi from webclient)
seektime = utils.window('emby_customPlaylist.seektime') seektime = utils.window('emby_customPlaylist.seektime')
self.logMsg("Seeking to: %s" % seektime, 1) self.logMsg("Seeking to: %s" % seektime, 1)
xbmcplayer.seekTime(int(seektime)*1000.0) xbmcplayer.seekTime(int(seektime))
utils.window('emby_customPlaylist.seektime', clear=True) utils.window('emby_customPlaylist.seektime', clear=True)
seekTime = xbmcplayer.getTime() seekTime = xbmcplayer.getTime()

View file

@ -3,15 +3,17 @@
################################################################################################# #################################################################################################
import json import json
from urllib import urlencode
import xbmc import xbmc
import xbmcgui import xbmcgui
import playutils
import playbackutils import playbackutils
import embydb_functions as embydb import embydb_functions as embydb
import read_embyserver as embyserver import read_embyserver as embyserver
import utils import utils
import PlexFunctions
import PlexAPI
################################################################################################# #################################################################################################
@ -49,7 +51,7 @@ class Playlist():
except TypeError: except TypeError:
# Item is not found in our database, add item manually # Item is not found in our database, add item manually
self.logMsg("Item was not found in the database, manually adding item.", 1) self.logMsg("Item was not found in the database, manually adding item.", 1)
item = self.emby.getItem(itemid) item = PlexFunctions.GetPlexMetadata(itemid)
self.addtoPlaylist_xbmc(playlist, item) self.addtoPlaylist_xbmc(playlist, item)
else: else:
# Add to playlist # Add to playlist
@ -115,17 +117,17 @@ class Playlist():
self.logMsg(result, 2) self.logMsg(result, 2)
def addtoPlaylist_xbmc(self, playlist, item): def addtoPlaylist_xbmc(self, playlist, item):
path = "plugin://plugin.video.plexkodiconnect.movies/"
params = {
'mode': "play",
'dbid': 999999999
}
API = PlexAPI.API(item[0])
params['id'] = API.getRatingKey()
params['filename'] = API.getKey()
playurl = path + '?' + urlencode(params)
itemid = item['Id']
playurl = playutils.PlayUtils(item).getPlayUrl()
if not playurl:
# Playurl failed
self.logMsg("Failed to retrieve playurl.", 1)
return
self.logMsg("Playurl: %s" % playurl)
listitem = xbmcgui.ListItem() listitem = xbmcgui.ListItem()
playbackutils.PlaybackUtils(item).setProperties(playurl, listitem)
playlist.add(playurl, listitem) playlist.add(playurl, listitem)