Skip to content

Commit

Permalink
bugfix for trailer function with plex pass
Browse files Browse the repository at this point in the history
  • Loading branch information
DonDavici committed Oct 22, 2014
1 parent 32534f9 commit 42ea634
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
11 changes: 5 additions & 6 deletions src/DP_Player.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ def __init__(self, session, listViewList, currentIndex, libraryName, autoPlayMod

if not sessionData:
if self.isExtraData:
self.media_id = "125629"
mediaFileUrl = "http://92.60.8.106:34400/services/iva/assets/853333/video.mp4?bitrate=1500"
self.buildPlayerData(mediaFileUrl)
self.media_id = isExtraData[0] #"125629"
mediaFileUrl = isExtraData[1] #"http://92.60.8.106:34400/services/iva/assets/853333/video.mp4?bitrate=1500"
self.buildPlayerData(mediaFileUrl, isExtraData=True)
else:
# from here we go on
self.onFirstExecBegin.append(self.playMedia)
Expand Down Expand Up @@ -330,10 +330,10 @@ def setSelectedMedia(self, choice=None):
#===============================================================================
#
#===============================================================================
def buildPlayerData(self, mediaFileUrl):
def buildPlayerData(self, mediaFileUrl, isExtraData=False):
printl("", self, "S")

self.playerData[self.currentIndex] = Singleton().getPlexInstance().playLibraryMedia(self.media_id, mediaFileUrl)
self.playerData[self.currentIndex] = Singleton().getPlexInstance().playLibraryMedia(self.media_id, mediaFileUrl, isExtraData=isExtraData)

# populate addional data
self.setPlayerData()
Expand Down Expand Up @@ -1091,7 +1091,6 @@ def updateTimeline(self):

self["endingTime"].setText(strftime("%H:%M:%S", endingTime))


if self.multiUserServer:
try:
printl("currentTime: " + str(currentTime), self, "C")
Expand Down
15 changes: 8 additions & 7 deletions src/DP_PlexLibrary.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class PlexLibrary(Screen):
lastHeaderForServer = None
lastResponse = None
lastError = None

fallback = ""

#===========================================================================
#
#===========================================================================
Expand Down Expand Up @@ -1351,7 +1352,6 @@ def mediaType(self, partData, server):

self.currentFile = myFile
self.currentType = myType
self.fallback = ""

# 0 is linux local mount override
if self.g_stream == "0":
Expand Down Expand Up @@ -1983,7 +1983,7 @@ def getMediaOptionsToPlay(self, myId, vids, override=False, myType="Video", load
#========================================================================
#
#========================================================================
def playLibraryMedia(self, myId, url):
def playLibraryMedia(self, myId, url, isExtraData=False):
printl("", self, "S")
subtitleFileTemp = None

Expand Down Expand Up @@ -2078,10 +2078,11 @@ def playLibraryMedia(self, myId, url):
playerData["transcodingSession"] = self.g_sessionID
playerData["videoData"] = self.streams['videoData']
playerData["mediaData"] = self.streams['mediaData']
playerData["fallback"] = self.fallback
playerData["locations"] = self.locations
playerData["currentFile"] = self.currentFile
playerData["subtitleFileTemp"] = subtitleFileTemp
if not isExtraData:
playerData["fallback"] = self.fallback
playerData["locations"] = self.locations
playerData["currentFile"] = self.currentFile
playerData["subtitleFileTemp"] = subtitleFileTemp
playerData["universalTranscoder"] = self.g_serverConfig.universalTranscoder.value

return playerData
Expand Down
20 changes: 9 additions & 11 deletions src/DP_View.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,11 @@ def selectMedia(self, count, options, server ):
printl("item: " + str(items), self, "D")
if items[1] is not None:
name=items[1].split('/')[-1]
else:
size = convertSize(int(items[3]))
duration = strftime('%H:%M:%S', gmtime(int(items[4])))
# this is the case when there is no information of the real file name
name = items[0] + " (" + items[2] + " / " + size + " / " + duration + ")"
url = items[0]
ratingKey = items[5]

printl("name " + str(name), self, "D")
functionList.append((name ,indexCount, ))
functionList.append((name ,indexCount, url, ratingKey))
indexCount+=1

self.session.openWithCallback(self.setSelectedMedia, ChoiceBox, title=_("Select media to play"), list=functionList)
Expand All @@ -628,11 +625,12 @@ def setSelectedMedia(self, choice=None):
printl("choice: " + str(choice), self, "D")

if choice is not None:
result = int(choice[1])

printl("result: " + str(result), self, "D")
url = "http://"+ self.server + choice[2]
ratingKey = choice[3]

ratingKey = self.options[result][5]
printl("url: " + str(url), self, "D")
printl("ratingKey: " + str(ratingKey), self, "D")
isExtraData = ratingKey, url

listViewList, mediaContainer = self.plexInstance.getMoviesFromSection( "http://"+ self.server +"/library/metadata/" + ratingKey)
autoPlayMode = False
Expand All @@ -642,7 +640,7 @@ def setSelectedMedia(self, choice=None):
libraryName = "Mixed"
forceResume = False

self.session.open(DP_Player, listViewList, currentIndex, libraryName, autoPlayMode, resumeMode, playbackMode, forceResume=forceResume, isExtraData=True)
self.session.open(DP_Player, listViewList, currentIndex, libraryName, autoPlayMode, resumeMode, playbackMode, forceResume=forceResume, isExtraData=isExtraData)

printl("", self, "C")

Expand Down

0 comments on commit 42ea634

Please sign in to comment.