Exemple #1
0
	def updateTimeline(self):
		printl("ENTERING: updateTimeline" ,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:
				if self.servermultiuser:
					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 :
					if self.servermultiuser:
						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
Exemple #2
0
    def playEntry(self, selection):
        '''
		'''
        printl("", self, "S")
        media_id = selection[1]['Id']

        server = selection[1]['ArtPoster']
        instance = Singleton()
        plexInstance = instance.getPlexInstance()

        self.playerData = plexInstance.playLibraryMedia(
            media_id, server, False)

        resumeStamp = self.playerData['resumeStamp']
        printl("resumeStamp: " + str(resumeStamp), self, "I")

        if resumeStamp > 0:
            self.session.openWithCallback(
                self.handleResume, MessageBox,
                _(" This file was partially played.\n\n Do you want to resume?"
                  ), MessageBox.TYPE_YESNO)

        else:
            self.session.open(DP_Player, self.playerData)

        printl("", self, "C")
Exemple #3
0
	def getServerData(self):
		'''
		'''
		printl("", self, "S")
		
		instance = Singleton()
		instance.getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))
		
		plexInstance = instance.getPlexInstance()
		serverData = plexInstance.getAllSections()
		
		self["menu"].setList(serverData)
		self.g_serverDataMenu = serverData #lets save the menu to call it when cancel is pressed
		self.refreshMenu(0)
		
		printl("", self, "C")
Exemple #4
0
    def handleProgress(self):
        '''
		'''
        printl("", self, "S")

        currentTime = self.getPlayPosition()[1] / 90000
        totalTime = self.getPlayLength()[1] / 90000
        progress = currentTime / (totalTime / 100)
        #progress = 0
        printl(
            "played time is %s secs of %s @ %s%%" %
            (currentTime, totalTime, progress), self, "I")

        instance = Singleton()
        plexInstance = instance.getPlexInstance()

        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.getURL(
                "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.getURL("http://" + self.server + "/:/scrobble?key=" +
                                self.id +
                                "&identifier=com.plexapp.plugins.library")

        printl("", self, "C")
Exemple #5
0
    def handleProgress(self):
        '''
        '''
        printl("", self, "S")
        
        currentTime = self.getPlayPosition()[1] / 90000
        totalTime = self.getPlayLength()[1] / 90000
        progress = currentTime / (totalTime/100)
        #progress = 0
        printl( "played time is %s secs of %s @ %s%%" % ( currentTime, totalTime, progress),self, "I" )
        
        instance = Singleton()
        plexInstance = instance.getPlexInstance()
        
        
        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.getURL("http://"+self.server+"/:/progress?key="+self.id+"&identifier=com.plexapp.plugins.library&time="+str(currentTime*1000),suppress=True)
 
        #Otherwise, mark as watched
        else:
            printl( "Movie marked as watched. Over 95% complete", self, "I")
            plexInstance.getURL("http://"+self.server+"/:/scrobble?key="+self.id+"&identifier=com.plexapp.plugins.library",suppress=True)
        
        printl("", self, "C")       
Exemple #6
0
	def handleProgress(self):
		printl("", self, "S")
		
		currentTime = self.getPlayPosition()[1] / 90000
		totalTime = self.getPlayLength()[1] / 90000
		progress = currentTime / (totalTime/100)
		#progress = 0
		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")	   
Exemple #7
0
	def bufferEmpty(self):
		'''
		'''
		#printl("", self, "S")
		
		#show infobar to indicate buffer is empty 
		self.show()
		
		if self.useBufferControl and self.playbacktype != "0":
			#show infobar to indicate buffer is empty 
			pass
		if self.seekstate != self.SEEK_STATE_PAUSE :
			pass
			#printl( "Buffer drained pause", self, "I")
			#self.setSeekState(self.SEEK_STATE_PAUSE)
			
		if self.servermultiuser == True:
			instance = Singleton()
			plexInstance = instance.getPlexInstance()
			currentTime = self.getPlayPosition()[1] / 90000
			totalTime = self.getPlayLength()[1] / 90000
			if self.playbackType == "1":
				self.timelinewatcherthread_wait.set()
			plexInstance.getTimelineURL(self.server, "/library/sections/onDeck", self.id, "buffering", 0, str(totalTime*1000))		
			self.show()
Exemple #8
0
    def getServerData(self):
        '''
		'''
        printl("", self, "S")

        instance = Singleton()
        instance.getPlexInstance(PlexLibrary(self.session,
                                             self.g_serverConfig))

        plexInstance = instance.getPlexInstance()
        serverData = plexInstance.getAllSections()

        self["menu"].setList(serverData)
        self.g_serverDataMenu = serverData  #lets save the menu to call it when cancel is pressed
        self.refreshMenu(0)

        printl("", self, "C")
Exemple #9
0
	def addSearchString(self, searchString):
		'''
		'''
		printl("", self, "S")
		# sample: http://192.168.45.190:32400/search?type=1&query=fringe
		instance = Singleton()
		instance.getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))
		
		plexInstance = instance.getPlexInstance()
		serverUrl = plexInstance.getServerFromURL(self.s_url)
		
		if searchString is not "" and searchString is not None:
			self.s_url = serverUrl + "/search?type=1&query=" + searchString

		self.executeSelectedEntry()
		
		printl("", self, "C")	
Exemple #10
0
	def addSearchString(self, searchString):
		'''
		'''
		printl("", self, "S")
		# sample: http://192.168.45.190:32400/search?type=1&query=fringe
		instance = Singleton()
		instance.getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))
		
		plexInstance = instance.getPlexInstance()
		serverUrl = plexInstance.getServerFromURL(self.s_url)
		
		if searchString is not "" and searchString is not None:
			self.s_url = serverUrl + "/search?type=1&query=" + searchString

		self.executeSelectedEntry()
		
		printl("", self, "C")	
Exemple #11
0
 def stopTranscoding(self):
     '''
     '''
     printl("", self, "S")
     
     instance = Singleton()
     plexInstance = instance.getPlexInstance()
     
     #sample from log /video/:/transcode/segmented/stop?session=0EBD197D-389A-4784-8CC5-709BAD5E1137&X-Plex-Client-Capabilities=protocols%3Dhttp-live-streaming%2Chttp-mp4-streaming%2Chttp-streaming-video%2Chttp-streaming-video-720p%2Chttp-mp4-video%2Chttp-mp4-video-720p%3BvideoDecoders%3Dh264%7Bprofile%3Ahigh%26resolution%3A1080%26level%3A41%7D%3BaudioDecoders%3Dmp3%2Caac%7Bbitrate%3A160000%7D&X-Plex-Client-Platform=iOS&X-Plex-Product=Plex%2FiOS&X-Plex-Version=3.0.2&X-Plex-Device-Name=DDiPhone [192.168.45.6:62662] (4 live)
     plexInstance.getURL("http://"+self.server+"/video/:/transcode/segmented/stop?session=" + self.transcodingSession)
     
     printl("", self, "C")
Exemple #12
0
	def getServerData(self, filter=None):
		'''
		'''
		printl("", self, "S")
		
		instance = Singleton()
		instance.getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))
		
		plexInstance = instance.getPlexInstance()
		
		summerize = config.plugins.dreamplex.summerizeSections.value
		
		if summerize == True and filter == None:
			serverData = plexInstance.getSectionTypes()
			self.g_sectionDataMenu = serverData
		else:
			serverData = plexInstance.displaySections(filter)
			self.g_serverDataMenu = serverData #lets save the menu to call it when cancel is pressed
		
		self["menu"].setList(serverData)
		self.refreshMenu(0)
		
		printl("", self, "C")
Exemple #13
0
    def stopTranscoding(self):
        '''
		'''
        printl("", self, "S")

        instance = Singleton()
        plexInstance = instance.getPlexInstance()

        #sample from log /video/:/transcode/segmented/stop?session=0EBD197D-389A-4784-8CC5-709BAD5E1137&X-Plex-Client-Capabilities=protocols%3Dhttp-live-streaming%2Chttp-mp4-streaming%2Chttp-streaming-video%2Chttp-streaming-video-720p%2Chttp-mp4-video%2Chttp-mp4-video-720p%3BvideoDecoders%3Dh264%7Bprofile%3Ahigh%26resolution%3A1080%26level%3A41%7D%3BaudioDecoders%3Dmp3%2Caac%7Bbitrate%3A160000%7D&X-Plex-Client-Platform=iOS&X-Plex-Product=Plex%2FiOS&X-Plex-Version=3.0.2&X-Plex-Device-Name=DDiPhone [192.168.45.6:62662] (4 live)
        plexInstance.getURL("http://" + self.server +
                            "/video/:/transcode/segmented/stop?session=" +
                            self.transcodingSession)

        printl("", self, "C")
Exemple #14
0
	def getServerData(self, filter=None):
		'''
		'''
		printl("", self, "S")
		
		instance = Singleton()
		instance.getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))
		
		plexInstance = instance.getPlexInstance()
		
		summerize = config.plugins.dreamplex.summerizeSections.value
		
		if summerize == True and filter == None:
			serverData = plexInstance.getSectionTypes()
			self.g_sectionDataMenu = serverData
		else:
			serverData = plexInstance.displaySections(filter)
			self.g_serverDataMenu = serverData #lets save the menu to call it when cancel is pressed
		
		self["menu"].setList(serverData)
		self.refreshMenu(0)
		
		printl("", self, "C")
Exemple #15
0
    def getFilterData(self):
        """
		"""
        printl("", self, "S")

        instance = Singleton()
        plexInstance = instance.getPlexInstance()

        menuData = plexInstance.getSectionFilter(self.s_url, self.s_mode, self.s_final, self.s_accessToken)

        self["menu"].setList(menuData)
        self.g_filterDataMenu = menuData  # lets save the menu to call it when cancel is pressed
        self.refreshMenu(0)

        printl("", self, "S")
Exemple #16
0
	def getFilterData(self):
		'''
		'''
		printl("", self, "S")
		
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		
		printl("self.s_url = " + self.s_url, self, "D")
		menuData = plexInstance.getSectionFilter(self.s_url)
		
		self["menu"].setList(menuData)
		self.g_filterDataMenu = menuData #lets save the menu to call it when cancel is pressed
		self.refreshMenu(0)

		printl("", self, "S")
Exemple #17
0
    def getFilterData(self):
        '''
		'''
        printl("", self, "S")

        instance = Singleton()
        plexInstance = instance.getPlexInstance()

        printl("self.s_url = " + self.s_url, self, "D")
        menuData = plexInstance.getSectionFilter(self.s_url)

        self["menu"].setList(menuData)
        self.g_filterDataMenu = menuData  #lets save the menu to call it when cancel is pressed
        self.refreshMenu(0)

        printl("", self, "S")
Exemple #18
0
	def stopTranscoding(self):
		'''
		'''
		printl("", self, "S")
		
		self.timelinewatcherthread_wait.set()
		self.timelinewatcherthread_stop.set()
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		
		currentTime = self.getPlayPosition()[1] / 90000
		totalTime = self.getPlayLength()[1] / 90000
		#sample from log /video/:/transcode/segmented/stop?session=0EBD197D-389A-4784-8CC5-709BAD5E1137&X-Plex-Client-Capabilities=protocols%3Dhttp-live-streaming%2Chttp-mp4-streaming%2Chttp-streaming-video%2Chttp-streaming-video-720p%2Chttp-mp4-video%2Chttp-mp4-video-720p%3BvideoDecoders%3Dh264%7Bprofile%3Ahigh%26resolution%3A1080%26level%3A41%7D%3BaudioDecoders%3Dmp3%2Caac%7Bbitrate%3A160000%7D&X-Plex-Client-Platform=iOS&X-Plex-Product=Plex%2FiOS&X-Plex-Version=3.0.2&X-Plex-Device-Name=DDiPhone [192.168.45.6:62662] (4 live)
		plexInstance.getURL("http://"+self.server+"/video/:/transcode/segmented/stop?session=" + self.transcodingSession)
		if self.servermultiuser == True:
			plexInstance.getTimelineURL(self.server, "/library/sections/onDeck", self.id, "stopped", str(currentTime*1000), str(totalTime*1000))
		
		printl("", self, "C")
Exemple #19
0
	def stopTranscoding(self):
		printl("", self, "S")
		
		if self.multiUser:
			self.timelinewatcherthread_wait.set()
			self.timelinewatcherthread_stop.set()
		
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		
		currentTime = self.getPlayPosition()[1] / 90000
		totalTime = self.getPlayLength()[1] / 90000
		
		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")
Exemple #20
0
	def playEntry(self, selection):
		'''
		'''
		printl("", self, "S")
		media_id = selection[1]['Id']

		server = selection[1]['ArtPoster']
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		
		self.playerData = plexInstance.playLibraryMedia(media_id, server, False)
		
		resumeStamp = self.playerData['resumeStamp']
		printl("resumeStamp: " + str(resumeStamp), self, "I")
		
		if resumeStamp > 0:
			self.session.openWithCallback(self.handleResume, MessageBox, _(" This file was partially played.\n\n Do you want to resume?"), MessageBox.TYPE_YESNO)
		
		else:
			self.session.open(DP_Player, self.playerData)
		
		printl("", self, "C")
Exemple #21
0
	def __init__(self, session, libraryName, loadLibrary, playEntry, viewName, select=None, sort=None, filter=None):
		'''
		'''
		printl("", self, "S")
		
		DP_View.__init__(self, session, libraryName, loadLibrary, playEntry, viewName, select, sort, filter)
		
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		self.image_prefix = plexInstance.getServerName().lower()
		
		self.posters = {}
		
		self.parentSeasonId = None
		self.parentSeasonNr = None
		self.isTvShow = False
		
		self.EXpicloadPoster_P0 = ePicLoad()
		self.EXpicloadPoster_P1 = ePicLoad()
		self.EXpicloadPoster_P2 = ePicLoad()
		self.EXpicloadPoster_P3 = ePicLoad()
		self.EXpicloadPoster_P4 = ePicLoad()
		self.EXpicloadPoster_P5 = ePicLoad()

		self.EXscale = (AVSwitch().getFramebufferScale())
		
		self["poster_0"] = Pixmap()
		self["poster_1"] = Pixmap()
		self["poster_2"] = Pixmap()
		self["poster_3"] = Pixmap()
		self["poster_4"] = Pixmap()
		self["poster_5"] = Pixmap()
		
		self["seen_0"] = Pixmap()
		self["seen_1"] = Pixmap()
		self["seen_2"] = Pixmap()
		self["seen_3"] = Pixmap()
		self["seen_4"] = Pixmap()
		self["seen_5"] = Pixmap()

		
		self["title"] = Label()

		self["shortDescriptionContainer"] = Label()
		self["shortDescription"] = Label()
		
		self["key_red"] = StaticText(_("Sort: ") + _("Default"))
		self["key_green"] = StaticText("")
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(self.viewName[0])
		
		self.skinName = self.viewName[2]

		self.EXpicloadPoster_P0.PictureData.get().append(self.DecodeActionPoster_P0)	
		self.EXpicloadPoster_P1.PictureData.get().append(self.DecodeActionPoster_P1)
		self.EXpicloadPoster_P2.PictureData.get().append(self.DecodeActionPoster_P2)
		self.EXpicloadPoster_P3.PictureData.get().append(self.DecodeActionPoster_P3)
		self.EXpicloadPoster_P4.PictureData.get().append(self.DecodeActionPoster_P4)
		self.EXpicloadPoster_P5.PictureData.get().append(self.DecodeActionPoster_P5)
		
		self.onLayoutFinish.append(self.setPara)
		self.loadNext = True
		
		printl("", self, "C")
Exemple #22
0
	def __init__(self, session, libraryName, loadLibrary, playEntry, viewName, select=None, sort=None, filter=None):
		'''
		'''
		printl("", self , "S")
		self.session = session
		
		DP_View.__init__(self, session, libraryName, loadLibrary, playEntry, viewName, select, sort, filter)
		
		self.mediaPath = config.plugins.dreamplex.mediafolderpath.value
		self.playTheme = config.plugins.dreamplex.playTheme.value
		
		self.EXscale = (AVSwitch().getFramebufferScale())
		
		self.whatPoster = None
		self.whatBackdrop = None
		
		instance = Singleton()
		self.plexInstance = instance.getPlexInstance()
		self.image_prefix = self.plexInstance.getServerName().lower()

		self.parentSeasonId = None
		self.parentSeasonNr = None
		self.isTvShow = False

		self["poster"] = Pixmap()
		self["mybackdrop"] = Pixmap()
		self["title"] = Label()
		self["tag"] = Label()
		self["shortDescription"] = Label()
		self["genre"] = Label()
		self["year"] = Label()
		self["runtime"] = Label()
		self["total"] = Label()
		self["current"] = Label()
		self["quality"] = Label()
		self["sound"] = Label()
		self["backdroptext"]= Label()
		self["postertext"]= Label()
		
		self["key_red"] = StaticText(_("Sort: ") + _("Default"))
		self["key_green"] = StaticText(_("Filter: ") + _("None"))
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(self.viewName[0])
		
		self.EXpicloadPoster = ePicLoad()
		self.EXpicloadBackdrop = ePicLoad()
		
		for i in range(10):
			stars = "star" + str(i)
			self[stars] = Pixmap()
			if self[stars].instance is not None:
				self[stars].instance.hide()
		
		for i in range(10):
			stars = "nostar" + str(i)
			self[stars] = Pixmap()
		
		self.skinName = self.viewName[2]

		self.EXpicloadPoster.PictureData.get().append(self.DecodeActionPoster)
		self.EXpicloadBackdrop.PictureData.get().append(self.DecodeActionBackdrop)
		
		self.onLayoutFinish.append(self.setPara)
	
		printl("", self, "C")
Exemple #23
0
	def loadLibrary(self, params):
		'''
		'''
		printl ("", self, "S")
		printl("params =" + str(params), self, "D")

		# Diplay all TVShows
		if params is None:
			printl("show TV shows ...", self, "I")
			parsedLibrary = []
			
			url = self.g_url
			
			instance = Singleton()
			plexInstance = instance.getPlexInstance()
			library = plexInstance.getShowsFromSection(url)
				
			tmpAbc = []
			tmpGenres = []
			for tvshow in library:

				#===============================================================
				# printl ("-> url = " + str(tvshow[0]), self, "D")
				# printl ("-> properties = " + str(tvshow[1]), self, "D")
				# printl ("-> arguments = " + str(tvshow[2]), self, "D")
				# printl ("-> context = " + str(tvshow[3]), self, "D")
				#===============================================================
				
				url = tvshow[0]
				properties = tvshow[1]
				arguments = tvshow[2]
				context = tvshow[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["Id"]				= arguments.get('ratingKey') #we use this because there is the id as value without any need of manipulating
				d["Tag"]            = arguments.get('tagline', "")
				d["Path"]          	= arguments.get('key', "")
				d["Popularity"]     = arguments.get('rating', 0)
				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["Seen"]        	= arguments.get('playcount', 0)
				d["Creation"]		= arguments.get('addedAt', 0)
				d["Banner"]			= arguments.get('banner', "")
				d["server"]			= arguments.get('server', "")
				
				d["ViewMode"] = "ShowSeasons"
				d["ScreenTitle"] = d["Title"]

				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), )
			
			filter = [("All", (None, False), ("", )), ]
			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))
			
			return (parsedLibrary, ("ViewMode", "Id", ), None, None, sort, filter)	

		
		# Display the Seasons Menu
		elif params["ViewMode"]=="ShowSeasons":
			printl("show seasons of TV show ...", self, "I")
			parsedLibrary = []
			
			url = params["url"]
			
			instance = Singleton()
			plexInstance = instance.getPlexInstance()
			library = plexInstance.getSeasonsOfShow(url)

			seasons = []
			for season in library:

				#===============================================================
				# printl ("-> url = " + str(season[0]), self, "D")
				# printl ("-> properties = " + str(season[1]), self, "D")
				# printl ("-> arguments = " + str(season[2]), self, "D")
				# printl ("-> context = " + str(season[3]), self, "D")
				#===============================================================
				
				url = season[0]
				properties = season[1]
				arguments = season[2]
				context = season[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["Id"]				= arguments.get('ratingKey') #we use this because there is the id as value without any need of manipulating
				d["Tag"]            = arguments.get('tagline', "")
				d["Path"]          	= arguments.get('key', "")
				d["Popularity"]     = arguments.get('rating', 0)
				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["Seen"]        	= arguments.get('playcount', 0)
				d["Creation"]		= arguments.get('addedAt', 0)
				d["Banner"]			= arguments.get('banner', "")
				d["server"]			= arguments.get('server', "")
				
				d["ViewMode"] = "ShowEpisodes"
				d["ScreenTitle"] = d["Title"]

				if (d["Seen"] == 0):
					image = None
				else:
					image = None

				print "appending title " + d["Title"]
				parsedLibrary.append((d["Title"], d, d["Title"].lower(), "50", image))
			
			sort = (("Title", None, False), )
			
			filter = [("All", (None, False), ("", )), ]
			
			return (parsedLibrary, ("ViewMode", "Id", "Season", ), None, None, sort, filter)

	
		# Display the Episodes Menu
		elif params["ViewMode"]=="ShowEpisodes":
			printl("show episodes of season ...", self, "I")
			parsedLibrary = []
			
			url = params["url"]
			instance = Singleton()
			plexInstance = instance.getPlexInstance()
			library = plexInstance.getEpisodesOfSeason(url)

			for episode in library:

				#===============================================================
				# printl ("-> url = " + str(episode[0]), self, "D")
				# printl ("-> properties = " + str(episode[1]), self, "D")
				# printl ("-> arguments = " + str(episode[2]), self, "D")
				# printl ("-> context = " + str(episode[3]), self, "D")
				#===============================================================
				
				url = episode[0]
				properties = episode[1]
				arguments = episode[2]
				context = episode[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["Id"]				= arguments.get('ratingKey') #we use this because there is the id as value without any need of manipulating
				d["Tag"]            = arguments.get('tagline', "")
				d["Path"]          	= arguments.get('key', "")
				d["Popularity"]     = arguments.get('rating', 0)
				d["Resolution"]    	= arguments.get('VideoResolution', "")
				d["Video"]    	   	= arguments.get('VideoCodec', "")
				d["Sound"]         	= arguments.get('AudioCodec', "")
				d["ArtBackdrop"] 	= arguments.get('thumb', "")
				d["ArtPoster"]   	= arguments.get('fanart_image', "")
				d["Seen"]        	= arguments.get('playcount', 0)
				d["Creation"]		= arguments.get('addedAt', 0)
				d["Banner"]			= arguments.get('banner', "")
				d["server"]			= arguments.get('server', "")
				
				d["ViewMode"] = "play"
				d["ScreenTitle"] = d["Title"]

				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), ]
			
			filter = [("All", (None, False), ("", )), ]
			filter.append(("Seen", ("Seen", False, 1), ("Seen", "Unseen", )))
			
			return (parsedLibrary, ("ViewMode", "Id", "Episodes", ), None, None, sort, filter)

		printl ("", self, "C")
Exemple #24
0
	def __init__(self, session, libraryName, loadLibrary, playEntry, viewName, select=None, sort=None, filter=None):
		'''
		'''
		printl("", self, "S")
		
		DP_View.__init__(self, session, libraryName, loadLibrary, playEntry, viewName, select, sort, filter)
		
		instance = Singleton()
		plexInstance = instance.getPlexInstance()
		self.image_prefix = plexInstance.getServerName().lower()
		
		self.postersLeft = {}
		self.whatPoster_0_ = None
		self.postersRight = {}
		
		self.parentSeasonId = None
		self.parentSeasonNr = None
		self.isTvShow = False
		
		self.EXpicloadPoster_m3 = ePicLoad()
		self.EXpicloadPoster_m2 = ePicLoad()
		self.EXpicloadPoster_m1 = ePicLoad()
		self.EXpicloadPoster_0_ = ePicLoad()
		self.EXpicloadPoster_p1 = ePicLoad()
		self.EXpicloadPoster_p2 = ePicLoad()
		self.EXpicloadPoster_p3 = ePicLoad()
		
		
		self.EXscale = (AVSwitch().getFramebufferScale())
		
		self["poster_m3"] = Pixmap()
		self["poster_m2"] = Pixmap()
		self["poster_m1"] = Pixmap()
		self["poster_0_"] = Pixmap()
		self["poster_p1"] = Pixmap()
		self["poster_p2"] = Pixmap()
		self["poster_p3"] = Pixmap()
		
		self["seen_m3"] = Pixmap()
		self["seen_m2"] = Pixmap()
		self["seen_m1"] = Pixmap()
		self["seen_0_"] = Pixmap()
		self["seen_p1"] = Pixmap()
		self["seen_p2"] = Pixmap()
		self["seen_p3"] = Pixmap()
		
		self["title"] = Label()
		

		self["shortDescriptionContainer"] = Label()
		self["shortDescription"] = Label()
		
		self["key_red"] = StaticText(_("Sort: ") + _("Default"))
		self["key_green"] = StaticText("")
		self["key_yellow"] = StaticText("")
		self["key_blue"] = StaticText(self.viewName[0])
		
		self.skinName = self.viewName[2]
		
		self.EXpicloadPoster_m3.PictureData.get().append(self.DecodeActionPoster_m3)
		self.EXpicloadPoster_m2.PictureData.get().append(self.DecodeActionPoster_m2)
		self.EXpicloadPoster_m1.PictureData.get().append(self.DecodeActionPoster_m1)
		self.EXpicloadPoster_0_.PictureData.get().append(self.DecodeActionPoster_0_)
		self.EXpicloadPoster_p1.PictureData.get().append(self.DecodeActionPoster_p1)
		self.EXpicloadPoster_p2.PictureData.get().append(self.DecodeActionPoster_p2)
		self.EXpicloadPoster_p3.PictureData.get().append(self.DecodeActionPoster_p3)
		
		self.onLayoutFinish.append(self.setPara)
		
		printl("", self, "C")
Exemple #25
0
    def loadLibrary(self, params):
        '''
		'''
        printl("", self, "S")
        printl("params =" + str(params), self, "D")

        # Diplay all TVShows
        if params is None:
            printl("show TV shows ...", self, "I")
            parsedLibrary = []

            url = self.g_url

            instance = Singleton()
            plexInstance = instance.getPlexInstance()
            library = plexInstance.getShowsFromSection(url)

            tmpAbc = []
            tmpGenres = []
            for tvshow in library:

                #===============================================================
                # printl ("-> url = " + str(tvshow[0]), self, "D")
                # printl ("-> properties = " + str(tvshow[1]), self, "D")
                # printl ("-> arguments = " + str(tvshow[2]), self, "D")
                # printl ("-> context = " + str(tvshow[3]), self, "D")
                #===============================================================

                url = tvshow[0]
                properties = tvshow[1]
                arguments = tvshow[2]
                context = tvshow[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["Id"] = arguments.get(
                    'ratingKey'
                )  #we use this because there is the id as value without any need of manipulating
                d["Tag"] = arguments.get('tagline', "")
                d["Path"] = arguments.get('key', "")
                d["Popularity"] = arguments.get('rating', 0)
                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["Seen"] = arguments.get('playcount', 0)
                d["Creation"] = arguments.get('addedAt', 0)
                d["Banner"] = arguments.get('banner', "")
                d["server"] = arguments.get('server', "")

                d["ViewMode"] = "ShowSeasons"
                d["ScreenTitle"] = d["Title"]

                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),
            )

            filter = [
                ("All", (None, False), ("", )),
            ]
            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))

            return (parsedLibrary, (
                "ViewMode",
                "Id",
            ), None, None, sort, filter)

        # Display the Seasons Menu
        elif params["ViewMode"] == "ShowSeasons":
            printl("show seasons of TV show ...", self, "I")
            parsedLibrary = []

            url = params["url"]

            instance = Singleton()
            plexInstance = instance.getPlexInstance()
            library = plexInstance.getSeasonsOfShow(url)

            seasons = []
            for season in library:

                #===============================================================
                # printl ("-> url = " + str(season[0]), self, "D")
                # printl ("-> properties = " + str(season[1]), self, "D")
                # printl ("-> arguments = " + str(season[2]), self, "D")
                # printl ("-> context = " + str(season[3]), self, "D")
                #===============================================================

                url = season[0]
                properties = season[1]
                arguments = season[2]
                context = season[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["Id"] = arguments.get(
                    'ratingKey'
                )  #we use this because there is the id as value without any need of manipulating
                d["Tag"] = arguments.get('tagline', "")
                d["Path"] = arguments.get('key', "")
                d["Popularity"] = arguments.get('rating', 0)
                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["Seen"] = arguments.get('playcount', 0)
                d["Creation"] = arguments.get('addedAt', 0)
                d["Banner"] = arguments.get('banner', "")
                d["server"] = arguments.get('server', "")

                d["ViewMode"] = "ShowEpisodes"
                d["ScreenTitle"] = d["Title"]

                if (d["Seen"] == 0):
                    image = None
                else:
                    image = None

                print "appending title " + d["Title"]
                parsedLibrary.append(
                    (d["Title"], d, d["Title"].lower(), "50", image))

            sort = (("Title", None, False), )

            filter = [
                ("All", (None, False), ("", )),
            ]

            return (parsedLibrary, (
                "ViewMode",
                "Id",
                "Season",
            ), None, None, sort, filter)

        # Display the Episodes Menu
        elif params["ViewMode"] == "ShowEpisodes":
            printl("show episodes of season ...", self, "I")
            parsedLibrary = []

            url = params["url"]
            instance = Singleton()
            plexInstance = instance.getPlexInstance()
            library = plexInstance.getEpisodesOfSeason(url)

            for episode in library:

                #===============================================================
                # printl ("-> url = " + str(episode[0]), self, "D")
                # printl ("-> properties = " + str(episode[1]), self, "D")
                # printl ("-> arguments = " + str(episode[2]), self, "D")
                # printl ("-> context = " + str(episode[3]), self, "D")
                #===============================================================

                url = episode[0]
                properties = episode[1]
                arguments = episode[2]
                context = episode[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["Id"] = arguments.get(
                    'ratingKey'
                )  #we use this because there is the id as value without any need of manipulating
                d["Tag"] = arguments.get('tagline', "")
                d["Path"] = arguments.get('key', "")
                d["Popularity"] = arguments.get('rating', 0)
                d["Resolution"] = arguments.get('VideoResolution', "")
                d["Video"] = arguments.get('VideoCodec', "")
                d["Sound"] = arguments.get('AudioCodec', "")
                d["ArtBackdrop"] = arguments.get('thumb', "")
                d["ArtPoster"] = arguments.get('fanart_image', "")
                d["Seen"] = arguments.get('playcount', 0)
                d["Creation"] = arguments.get('addedAt', 0)
                d["Banner"] = arguments.get('banner', "")
                d["server"] = arguments.get('server', "")

                d["ViewMode"] = "play"
                d["ScreenTitle"] = d["Title"]

                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),
            ]

            filter = [
                ("All", (None, False), ("", )),
            ]
            filter.append(("Seen", ("Seen", False, 1), (
                "Seen",
                "Unseen",
            )))

            return (parsedLibrary, (
                "ViewMode",
                "Id",
                "Episodes",
            ), None, None, sort, filter)

        printl("", self, "C")