Example #1
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")
Example #2
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")	   
Example #3
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
Example #4
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()
Example #5
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")
Example #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 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")       
Example #7
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")
Example #8
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")
Example #9
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")
Example #10
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")
Example #11
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")
Example #12
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")
Example #13
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")
Example #14
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")	
Example #15
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")	
Example #16
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")
Example #17
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")
Example #18
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")
Example #19
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")
Example #20
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")
Example #21
0
	def startThemePlayback(self):
		'''
		'''
		printl("", self, "S")
		
		printl("start pĺaying theme", self, "I")
		accessToken = Singleton().getPlexInstance().g_myplex_accessToken
		theme = self.extraData["theme"]
		server = self.details["server"]
		printl("theme: " + str(theme), self, "D")
		url = "http://" + str(server) + str(theme) + "?X-Plex-Token=" + str(accessToken)
		sref = "4097:0:0:0:0:0:0:0:0:0:%s" % quote_plus(url)
		printl("sref: " + str(sref), self, "D")
		self.session.nav.stopService()
		self.session.nav.playService(eServiceReference(sref))
		
		printl("", self, "C")
Example #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)

        # get needed config parameters
        self.mediaPath = config.plugins.dreamplex.mediafolderpath.value
        self.playTheme = config.plugins.dreamplex.playTheme.value
        self.fastScroll = config.plugins.dreamplex.fastScroll.value

        # get data from plex library
        self.image_prefix = Singleton().getPlexInstance().getServerName(
        ).lower()

        # init skin elements
        self["functionsContainer"] = Label()

        self["btn_red"] = Pixmap()
        self["btn_blue"] = Pixmap()
        self["btn_yellow"] = Pixmap()
        self["btn_zero"] = Pixmap()
        self["btn_nine"] = Pixmap()
        self["btn_pvr"] = Pixmap()
        self["btn_menu"] = Pixmap()

        self["txt_red"] = Label()
        self["txt_filter"] = Label()
        self["txt_blue"] = Label()
        self["txt_blue"].setText(_("toogle View ") + _("(current 'Default')"))
        self["txt_yellow"] = Label()

        if self.fastScroll == True:
            self["txt_yellow"].setText("fastScroll = On")
        else:
            self["txt_yellow"].setText("fastScroll = Off")

        self["txt_pvr"] = Label()
        self["txt_pvr"].setText("load additional data")
        self["txt_menu"] = Label()
        self["txt_menu"].setText("show media functions")

        self["poster"] = Pixmap()
        self["mybackdrop"] = Pixmap()

        self["audio"] = MultiPixmap()
        self["resolution"] = MultiPixmap()
        self["aspect"] = MultiPixmap()
        self["codec"] = MultiPixmap()
        self["rated"] = MultiPixmap()

        self["title"] = Label()
        self["tag"] = Label()
        self["shortDescription"] = ScrollLabel()
        self["genre"] = Label()
        self["year"] = Label()
        self["runtime"] = Label()
        self["total"] = Label()
        self["current"] = Label()
        self["backdroptext"] = Label()
        self["postertext"] = Label()

        self["rating_stars"] = ProgressBar()

        self.skinName = self.viewName[2]

        self.EXscale = (AVSwitch().getFramebufferScale())
        self.EXpicloadPoster = ePicLoad()
        self.EXpicloadBackdrop = ePicLoad()
        self.onLayoutFinish.append(self.setPara)

        printl("", self, "C")
Example #23
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")
Example #24
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")
Example #25
0
def getViewsFromSkinParams(myType):
	printl("", __name__, "S")
	
	tree = Singleton().getSkinParamsInstance()
	#tree = getXmlContent("/usr/lib/enigma2/python/Plugins/Extensions/DreamPlex/skins/" + config.plugins.dreamplex.skins.value +"/params")
	
	availableViewList = []
	
	if myType == "movieView":
		myFile = "DP_ViewMovies"
		myClass = "DPS_ViewMovies"
		defaultParams = getMovieViewDefaults()

	elif myType == "showView":
		myFile = "DP_ViewShows"
		myClass = "DPS_ViewShows"
		defaultParams = getShowViewDefaults()

	elif myType == "musicView":
		myFile = "DP_ViewMusic"
		myClass = "DPS_ViewMusic"
		defaultParams = getMusicViewDefaults()
		
	else:
		# TODO add errorhandler here
		pass
	
	for view in tree.findall(myType):
		name = str(view.get('name'))
		currentParams = {}
		
		for param in defaultParams:
			#check if there are params that we have to override
			value = view.get(param, None)
			printl("value: " + str(value), __name__, "D")
			# check if this value is mandatory
			# if we are mandatory we stop here
			if defaultParams[param] == "mandatory" and value is None:
				assert()
				
			# if there is one we overwrite the default value
			if value is not None:
				
				# translate xml value to real true or false
				if value == "true" or value == "True":
					value = True
				
				if value == "false" or value == "False":
					value = False
				
			else:
				# fill not existing params with default values
				value = defaultParams[param]
				
			currentParams[param] = value
		
		printl("currentParams: " + str(currentParams),__name__, "D")
		view = (_(name), myFile, myClass, currentParams)
		
		availableViewList.append(view)
	
	printl("availableViewList: " + str(availableViewList), __name__, "D")
	printl("", __name__, "C")
	return availableViewList
Example #26
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")
Example #27
0
    def okbuttonClick(self, selectionOverride=None):
        printl("", self, "S")

        # this is used to step in directly into a server when there is only one entry in the serverlist
        if selectionOverride is not None:
            selection = selectionOverride
        else:
            selection = self["menu"].getCurrent()

        printl("selection = " + str(selection), self, "D")
        self.nextExitIsQuit = False
        if selection is not None:

            self.selectedEntry = selection[1]
            printl("selected entry " + str(self.selectedEntry), self, "D")

            if type(self.selectedEntry) is int:
                printl("selected entry is int", self, "D")

                if self.selectedEntry == Plugin.MENU_MAIN:
                    printl("found Plugin.MENU_MAIN", self, "D")
                    self["menu"].setList(self.menu_main_list)

                elif self.selectedEntry == Plugin.MENU_SERVER:
                    printl("found Plugin.MENU_SERVER", self, "D")
                    self.g_serverConfig = selection[2]

                    # now that we know the server we establish global plexInstance
                    self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))

                    self.checkServerState()

                elif self.selectedEntry == Plugin.MENU_MOVIES:
                    printl("found Plugin.MENU_MOVIES", self, "D")
                    self.getServerData("movies")

                elif self.selectedEntry == Plugin.MENU_TVSHOWS:
                    printl("found Plugin.MENU_TVSHOWS", self, "D")
                    self.getServerData("tvshow")

                elif self.selectedEntry == Plugin.MENU_MUSIC:
                    printl("found Plugin.MENU_MUSIC", self, "D")
                    self.getServerData("music")

                elif self.selectedEntry == Plugin.MENU_FILTER:
                    printl("found Plugin.MENU_FILTER", self, "D")
                    params = selection[2]
                    printl("params: " + str(params), self, "D")

                    self.s_url = params.get("t_url", "notSet")
                    self.s_mode = params.get("t_mode", "notSet")
                    self.s_final = params.get("t_final", "notSet")

                    self.getFilterData()

                elif self.selectedEntry == Plugin.MENU_SYSTEM:
                    printl("found Plugin.MENU_SYSTEM", self, "D")
                    self["menu"].setList(self.getSettingsMenu())
                    self.refreshMenu(0)

            elif type(self.selectedEntry) is str:
                printl("selected entry is string", self, "D")

                if selection[1] == "DPS_Settings":
                    self.session.open(DPS_Settings)

                elif selection[1] == "DPS_ServerEntriesListConfigScreen":
                    self.session.open(DPS_ServerEntriesListConfigScreen)

                elif selection[1] == "DPS_SystemCheck":
                    self.session.open(DPS_SystemCheck)

                elif selection[1] == "DPS_About":
                    self.session.open(DPS_About)
                    # self.info()

                elif selection[1] == "DPS_Help":
                    self.session.open(DPS_Help)

                elif selection[1] == "DPS_Exit":
                    self.exit()

                elif selection[1] == "getMusicSections":
                    self.getMusicSections(selection)

            else:
                printl("selected entry is executable", self, "D")
                params = selection[2]
                printl("params: " + str(params), self, "D")
                self.s_url = params.get("t_url", "notSet")
                self.showEpisodesDirectly = params.get("t_showEpisodesDirectly", "notSet")
                self.uuid = params.get("t_uuid", "notSet")
                self.source = params.get("t_source", "notSet")

                isSearchFilter = params.get("isSearchFilter", "notSet")

                if isSearchFilter == "True" or isSearchFilter:
                    self.session.openWithCallback(
                        self.addSearchString,
                        InputBox,
                        title=_("Please enter your search string!"),
                        text="",
                        maxSize=55,
                        type=Input.TEXT,
                    )
                else:
                    self.executeSelectedEntry()

            printl("", self, "C")
Example #28
0
class DPS_MainMenu(Screen):
    """
	"""

    g_wolon = False
    g_wakeserver = "00-11-32-12-C5-F9"
    g_woldelay = 10

    selectedEntry = None
    s_url = None
    s_mode = None
    s_final = False

    g_serverDataMenu = None
    g_filterDataMenu = None
    nextExitIsQuit = True
    currentService = None
    plexInstance = None
    selectionOverride = None
    secondRun = False

    # ===========================================================================
    #
    # ===========================================================================
    def __init__(self, session):
        printl("", self, "S")
        Screen.__init__(self, session)

        self["title"] = StaticText()
        self["welcomemessage"] = StaticText()

        # get all our servers as list
        self.getServerList()

        self["menu"] = List(self.mainMenuList, True)

        self.menu_main_list = self["menu"].list

        self["actions"] = HelpableActionMap(
            self,
            "DP_MainMenuActions",
            {
                "ok": (self.okbuttonClick, ""),
                "left": (self.left, ""),
                "right": (self.right, ""),
                "up": (self.up, ""),
                "down": (self.down, ""),
                "cancel": (self.cancel, ""),
            },
            -2,
        )

        self.onFirstExecBegin.append(self.onExec)
        self.onFirstExecBegin.append(self.onExecRunDev)

        if config.plugins.dreamplex.stopLiveTvOnStartup.value:
            self.currentService = self.session.nav.getCurrentlyPlayingServiceReference()
            self.session.nav.stopService()

        self.onLayoutFinish.append(self.setCustomTitle)
        self.onShown.append(self.checkSelectionOverride)
        printl("", self, "C")

    # ===============================================================================
    # SCREEN FUNCTIONS
    # ===============================================================================

    # ===============================================================================
    #
    # ===============================================================================
    def setCustomTitle(self):
        printl("", self, "S")

        self.setTitle(_("DreamPlex"))

        printl("", self, "C")

        # ===============================================================================
        #
        # ===============================================================================

    def checkSelectionOverride(self):
        printl("", self, "S")
        printl("self.selectionOverride: " + str(self.selectionOverride), self, "D")
        if self.selectionOverride is not None:
            self.okbuttonClick(self.selectionOverride)

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def showWakeMessage(self):
        printl("", self, "S")

        self.session.openWithCallback(
            self.executeWakeOnLan,
            MessageBox,
            _(
                "Plexserver seems to be offline. Start with Wake on Lan settings? \n\nPlease note: \nIf you press yes the spinner will run for "
                + str(self.g_woldelay)
                + " seconds. \nAccording to your settings."
            ),
            MessageBox.TYPE_YESNO,
        )

        if not self.secondRun:
            self.selectionOverride = None
            self.secondRun = (
                True
            )  # now that the screen is shown the onShown will not trigger our message so we use this param to force it
            self.onShown.remove(self.showOfflineMessage)

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def showOfflineMessage(self):
        printl("", self, "S")

        self.session.openWithCallback(
            self.setMainMenu,
            MessageBox,
            _("Plexserver seems to be offline. Please check your your settings or connection!"),
            MessageBox.TYPE_INFO,
        )

        if not self.secondRun:
            self.selectionOverride = None
            self.secondRun = (
                True
            )  # now that the screen is shown the onShown will not trigger our message so we use this param to force it
            self.onShown.remove(self.showOfflineMessage)

        printl("", self, "C")

    def setMainMenu(self, answer):
        self["menu"].setList(self.menu_main_list)

    # ===============================================================================
    # KEYSTROKES
    # ===============================================================================

    # ===============================================================
    #
    # ===============================================================
    def okbuttonClick(self, selectionOverride=None):
        printl("", self, "S")

        # this is used to step in directly into a server when there is only one entry in the serverlist
        if selectionOverride is not None:
            selection = selectionOverride
        else:
            selection = self["menu"].getCurrent()

        printl("selection = " + str(selection), self, "D")
        self.nextExitIsQuit = False
        if selection is not None:

            self.selectedEntry = selection[1]
            printl("selected entry " + str(self.selectedEntry), self, "D")

            if type(self.selectedEntry) is int:
                printl("selected entry is int", self, "D")

                if self.selectedEntry == Plugin.MENU_MAIN:
                    printl("found Plugin.MENU_MAIN", self, "D")
                    self["menu"].setList(self.menu_main_list)

                elif self.selectedEntry == Plugin.MENU_SERVER:
                    printl("found Plugin.MENU_SERVER", self, "D")
                    self.g_serverConfig = selection[2]

                    # now that we know the server we establish global plexInstance
                    self.plexInstance = Singleton().getPlexInstance(PlexLibrary(self.session, self.g_serverConfig))

                    self.checkServerState()

                elif self.selectedEntry == Plugin.MENU_MOVIES:
                    printl("found Plugin.MENU_MOVIES", self, "D")
                    self.getServerData("movies")

                elif self.selectedEntry == Plugin.MENU_TVSHOWS:
                    printl("found Plugin.MENU_TVSHOWS", self, "D")
                    self.getServerData("tvshow")

                elif self.selectedEntry == Plugin.MENU_MUSIC:
                    printl("found Plugin.MENU_MUSIC", self, "D")
                    self.getServerData("music")

                elif self.selectedEntry == Plugin.MENU_FILTER:
                    printl("found Plugin.MENU_FILTER", self, "D")
                    params = selection[2]
                    printl("params: " + str(params), self, "D")

                    self.s_url = params.get("t_url", "notSet")
                    self.s_mode = params.get("t_mode", "notSet")
                    self.s_final = params.get("t_final", "notSet")

                    self.getFilterData()

                elif self.selectedEntry == Plugin.MENU_SYSTEM:
                    printl("found Plugin.MENU_SYSTEM", self, "D")
                    self["menu"].setList(self.getSettingsMenu())
                    self.refreshMenu(0)

            elif type(self.selectedEntry) is str:
                printl("selected entry is string", self, "D")

                if selection[1] == "DPS_Settings":
                    self.session.open(DPS_Settings)

                elif selection[1] == "DPS_ServerEntriesListConfigScreen":
                    self.session.open(DPS_ServerEntriesListConfigScreen)

                elif selection[1] == "DPS_SystemCheck":
                    self.session.open(DPS_SystemCheck)

                elif selection[1] == "DPS_About":
                    self.session.open(DPS_About)
                    # self.info()

                elif selection[1] == "DPS_Help":
                    self.session.open(DPS_Help)

                elif selection[1] == "DPS_Exit":
                    self.exit()

                elif selection[1] == "getMusicSections":
                    self.getMusicSections(selection)

            else:
                printl("selected entry is executable", self, "D")
                params = selection[2]
                printl("params: " + str(params), self, "D")
                self.s_url = params.get("t_url", "notSet")
                self.showEpisodesDirectly = params.get("t_showEpisodesDirectly", "notSet")
                self.uuid = params.get("t_uuid", "notSet")
                self.source = params.get("t_source", "notSet")

                isSearchFilter = params.get("isSearchFilter", "notSet")

                if isSearchFilter == "True" or isSearchFilter:
                    self.session.openWithCallback(
                        self.addSearchString,
                        InputBox,
                        title=_("Please enter your search string!"),
                        text="",
                        maxSize=55,
                        type=Input.TEXT,
                    )
                else:
                    self.executeSelectedEntry()

            printl("", self, "C")

            # ===========================================================================
            #
            # ===========================================================================

    def getMusicSections(self, selection):
        printl("", self, "S")

        mainMenuList = []
        plugin = selection[2]  # e.g. Plugin.MENU_MOVIES

        # ARTISTS
        params = copy.deepcopy(selection[3])
        url = params["t_url"]
        params["t_url"] = url + "?type=8"
        mainMenuList.append((_("by Artists"), plugin, params))
        printl("mainMenuList 1: " + str(mainMenuList), self, "D")

        # ALBUMS
        params = copy.deepcopy(selection[3])
        params["t_url"] = url + "?type=9"
        mainMenuList.append((_("by Albums"), plugin, params))
        printl("mainMenuList 2: " + str(mainMenuList), self, "D")

        self["menu"].setList(mainMenuList)
        self.refreshMenu(0)

        printl("mainMenuList: " + str(mainMenuList), self, "D")

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def getSettingsMenuList(self):
        printl("", self, "S")

        self.nextExitIsQuit = False
        self["menu"].setList(self.getSettingsMenu())
        self.refreshMenu(0)

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def addSearchString(self, searchString):
        printl("", self, "S")
        # sample: http://192.168.45.190:32400/search?type=1&query=fringe
        serverUrl = self.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")

        # ===========================================================================
        #
        # ===========================================================================

    def executeSelectedEntry(self):
        printl("", self, "S")
        printl("self.s_url: " + str(self.s_url), self, "D")

        if self.selectedEntry.start is not None:
            kwargs = {"url": self.s_url, "uuid": self.uuid, "source": self.source}

            if self.showEpisodesDirectly != "notSet":
                kwargs["showEpisodesDirectly"] = self.showEpisodesDirectly

            self.session.open(self.selectedEntry.start, **kwargs)

        elif self.selectedEntry.fnc is not None:
            self.selectedEntry.fnc(self.session)

        self.selectedEntry = (
            Plugin.MENU_FILTER
        )  # we overwrite this now to handle correct menu jumps with exit/cancel button

        printl("", self, "C")

        # ==========================================================================
        #
        # ==========================================================================

    def up(self):
        printl("", self, "S")

        self["menu"].selectPrevious()

        printl("", self, "C")

        # ===========================================================================
        #
        # ===========================================================================

    def down(self):
        printl("", self, "S")

        self["menu"].selectNext()

        printl("", self, "C")

        # ===============================================================================
        #
        # ===============================================================================

    def right(self):
        printl("", self, "S")

        try:
            self["menu"].pageDown()
        except Exception, ex:
            printl("Exception(" + str(type(ex)) + "): " + str(ex), self, "W")
            self["menu"].selectNext()

        printl("", self, "C")
Example #29
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")
Example #30
0
    def loadLibrary(self, params):
        '''
		'''
        printl("", self, "S")
        printl("params: " + str(params), self, "D")

        if self.showEpisodesDirectly == True:
            printl("show episodes in OnDeck ...", self, "I")

            url = self.g_url

            library = Singleton().getPlexInstance().getEpisodesOfSeason(url)

            sort = [
                ("by title", None, False),
            ]

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

            #filter.append(("Seen", ("Seen", False, 1), ("Seen", "Unseen", )))

            printl("", self, "C")
            return (library, (
                "viewMode",
                "ratingKey",
            ), None, "None", sort, filter)
        else:
            # Diplay all TVShows
            if params is None:
                printl("show TV shows ...", self, "I")

                url = self.g_url

                library = Singleton().getPlexInstance().albums(url)

                # sort
                sort = [
                    ("by title", None, False),
                    ("by year", "year", True),
                    ("by rating", "rating", True),
                ]

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

                #if len(tmpGenres) > 0:
                #tmpGenres.sort()
                #filter.append(("Genre", ("Genres", True), tmpGenres))

                printl("", self, "C")
                return (library, (
                    "viewMode",
                    "ratingKey",
                ), None, None, sort, filter)
                # (libraryArray, onEnterPrimaryKeys, onLeavePrimaryKeys, onLeaveSelectEntry

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

                url = params["url"]
                printl("URL: " + str(url), self, "D")

                library = Singleton().getPlexInstance().tracks(url)

                sort = (("by season", "season", False), )

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

                printl("", self, "C")
                return (library, (
                    "viewMode",
                    "ratingKey",
                ), None, "backToShows", sort, filter)
                # (libraryArray, onEnterPrimaryKeys, onLeavePrimaryKeys, onLeaveSelectEntry

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

                url = params["url"]

                library = Singleton().getPlexInstance().tracks(url)

                sort = [
                    ("by title", None, False),
                ]

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

                #filter.append(("Seen", ("Seen", False, 1), ("Seen", "Unseen", )))

                printl("", self, "C")
                return (library, (
                    "viewMode",
                    "ratingKey",
                ), None, "backToSeasons", sort, filter)
                # (libraryArray, onEnterPrimaryKeys, onLeavePrimaryKeys, onLeaveSelectEntry

        printl("", self, "C")
Example #31
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")