本文整理汇总了Python中DPH_Singleton.Singleton.getPlexInstance方法的典型用法代码示例。如果您正苦于以下问题:Python Singleton.getPlexInstance方法的具体用法?Python Singleton.getPlexInstance怎么用?Python Singleton.getPlexInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DPH_Singleton.Singleton
的用法示例。
在下文中一共展示了Singleton.getPlexInstance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: updateTimeline
# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getPlexInstance [as 别名]
def updateTimeline(self):
printl("" ,self,"S")
try:
currentTime = self.getPlayPosition()[1] / 90000
totalTime = self.getPlayLength()[1] / 90000
progress = int(( float(currentTime) / float(totalTime) ) * 100)
if totalTime > 100000:
return True
printl("currentTime: " + str(currentTime), self, "C")
printl("totalTime: " + str(totalTime), self, "C")
instance = Singleton()
plexInstance = instance.getPlexInstance()
seekState = self.seekstate
if seekState == self.SEEK_STATE_PAUSE:
printl( "Movies PAUSED time: %s secs of %s @ %s%%" % ( currentTime, totalTime, progress), self,"D" )
plexInstance.getTimelineURL(self.server, "/library/sections/onDeck", self.id, "paused", str(currentTime*1000), str(totalTime*1000))
if seekState == self.SEEK_STATE_PLAY :
printl( "Movies PLAYING time: %s secs of %s @ %s%%" % ( currentTime, totalTime, progress),self,"D" )
plexInstance.getTimelineURL(self.server, "/library/sections/onDeck", self.id, "playing", str(currentTime*1000), str(totalTime*1000))
except Exception, e:
printl("exception: " + str(e), self, "E")
return False
示例2: handleProgress
# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getPlexInstance [as 别名]
def handleProgress(self):
printl("", self, "S")
currentTime = self.getPlayPosition()[1] / 90000
totalTime = self.getPlayLength()[1] / 90000
progress = currentTime / (totalTime/100)
printl( "played time is %s secs of %s @ %s%%" % ( currentTime, totalTime, progress),self, "I" )
instance = Singleton()
plexInstance = instance.getPlexInstance()
if self.multiUser:
plexInstance.getTimelineURL(self.server, "/library/sections/onDeck", self.id, "stopped", str(currentTime*1000), str(totalTime*1000))
#Legacy PMS Server server support before MultiUser version v0.9.8.0 and if we are not connected via myPlex
else:
if currentTime < 30:
printl("Less that 30 seconds, will not set resume", self, "I")
#If we are less than 95% complete, store resume time
elif progress < 95:
printl("Less than 95% progress, will store resume time", self, "I" )
plexInstance.doRequest("http://"+self.server+"/:/progress?key="+self.id+"&identifier=com.plexapp.plugins.library&time="+str(currentTime*1000))
#Otherwise, mark as watched
else:
printl( "Movie marked as watched. Over 95% complete", self, "I")
plexInstance.doRequest("http://"+self.server+"/:/scrobble?key="+self.id+"&identifier=com.plexapp.plugins.library")
printl("", self, "C")
示例3: playEntry
# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getPlexInstance [as 别名]
def playEntry(self, selection):
printl("-> in DP_ListMain", self, "S")
media_id = selection[1]['Id']
server = selection[1]['ArtPoster']
instance = Singleton()
plexInstance = instance.getPlexInstance()
print "server =>" + server
url = plexInstance.playStream(media_id, server, False)
sref = eServiceReference(0x1001, 0, str(url))
sref.setName("DreamPlex")
self.sref = sref
self.session.open(DP_Player, sref, self)
示例4: stopTranscoding
# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getPlexInstance [as 别名]
def stopTranscoding(self):
printl("", self, "S")
if self.multiUser:
self.timelinewatcherthread_wait.set()
self.timelinewatcherthread_stop.set()
instance = Singleton()
plexInstance = instance.getPlexInstance()
if self.universalTranscoder:
plexInstance.doRequest("http://"+self.server+"/video/:/transcode/universal/stop?session=" + self.transcodingSession)
else:
plexInstance.doRequest("http://"+self.server+"/video/:/transcode/segmented/stop?session=" + self.transcodingSession)
printl("", self, "C")
示例5: loadLibrary
# 需要导入模块: from DPH_Singleton import Singleton [as 别名]
# 或者: from DPH_Singleton.Singleton import getPlexInstance [as 别名]
def loadLibrary(self, params):
printl ("", self, "S")
printl("params =" + str(params), self, "D")
url = self.g_url
instance = Singleton()
plexInstance = instance.getPlexInstance()
library = plexInstance.getMoviesFromSection(url)
parsedLibrary = []
tmpAbc = []
tmpGenres = []
for movie in library:
#===============================================================
# printl ("-> url = " + str(movie[0]), self, "D")
# printl ("-> properties = " + str(movie[1]), self, "D")
# printl ("-> arguments = " + str(movie[2]), self, "D")
# printl ("-> context = " + str(movie[3]), self, "D")
#===============================================================
url = movie[0]
properties = movie[1]
arguments = movie[2]
context = movie[3]
d = {}
d["Title"] = properties.get('title', "")#
d["Year"] = properties.get('year', "")#
d["Plot"] = properties.get('plot', "") #
d["Runtime"] = properties.get('duration', "")#
d["Genres"] = properties.get('genre', "")
d["Seen"] = properties.get('playcount', "")#
d["Popularity"] = properties.get('rating', 0)#
d["Studio"] = properties.get('studio', 0)#
d["MPAA"] = properties.get('mpaa', 0)#
d["Tag"] = properties.get('tagline', "")#
d["server"] = properties.get('server', "")
d["Id"] = arguments.get('ratingKey') #we use this because there is the id as value without any need of manipulating
d["Path"] = arguments.get('key', "")
d["Resolution"] = arguments.get('VideoResolution', "")
d["Video"] = arguments.get('VideoCodec', "")
d["Sound"] = arguments.get('AudioCodec', "")
d["ArtBackdrop"] = arguments.get('fanart_image', "")
d["ArtPoster"] = arguments.get('thumb', "")
d["Creation"] = arguments.get('addedAt', 0)
d["Key"] = arguments.get('key', "")
d["ViewMode"] = "play"
d["ScreenTitle"] = d["Title"]
if d["Title"].upper() not in tmpAbc:
tmpAbc.append(d["Title"].upper())
for genre in d["Genres"]:
if genre not in tmpGenres:
tmpGenres.append(genre)
if (d["Seen"] == 0):
image = None
else:
image = None
parsedLibrary.append((d["Title"], d, d["Title"].lower(), "50", image))
sort = [("Title", None, False), ("Popularity", "Popularity", True), ]
if self.checkFileCreationDate:
sort.append(("File Creation", "Creation", True))
sort.append(("Filename", "Filename", False))
filter = [("All", (None, False), ("", )), ]
filter.append(("Seen", ("Seen", False, 1), ("Seen", "Unseen", )))
if len(tmpGenres) > 0:
tmpGenres.sort()
filter.append(("Genre", ("Genres", True), tmpGenres))
if len(tmpAbc) > 0:
tmpAbc.sort()
filter.append(("Abc", ("Title", False, 1), tmpAbc))
printl ("", self, "C")
return (parsedLibrary, ("ViewMode", "Id", ), None, None, sort, filter)