Esempio n. 1
0
 def __init__(self, *args, **kwargs):
     # Need to get: oid and xnewa....
     self.settings = kwargs['settings']
     self.xnewa = kwargs['xnewa']
     
     self.oid = kwargs['oid']
     self.oid_type = kwargs['type']
     if kwargs.has_key('epg') == True:
         self.epg = True
     else:
         self.epg = False
     self.returnvalue = None        
     self.fanart = fanart()
     
     self.win = None        
     self.shouldRefresh = False
     print repr(self)
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        debug("--> xnewa()__init__")
        #            xbmcgui.WindowXML.__init__(self, *args, **kwargs)

        # Need to get: oid and xnewa....
        self.settings = kwargs["settings"]
        self.xnewa = kwargs["xnewa"]

        self.currentTime = datetime.now()

        self.epgTimerBars = []

        # Channel stuff
        self.epgChNames = []
        self.epgChNums = []
        self.epgChLogos = []
        self.ChLogos = []
        self.epgButtons = []
        self.epgTagData = {}
        self.channelTop = -999
        self.channelCount = 0
        self.MaxDisplayChannels = 0
        self.initDate = self.getStartTime()
        self.EPGEndTime = datetime.now()
        self.ready = False
        self.epgData = []
        self.isStartup = True
        self.fanart = fanart()
        self.lcid = 0

        ret = self.loadNextPVR()
        # ret = True
        if not ret:
            self.cleanup()
            self.close()
        else:
            self.ready = True

        debug("<-- xnewa()__init__")
Esempio n. 3
0
    def _updateView(self):  
        
        self.win.setProperty('busy', 'true')
        self.title.setLabel(self.detailData['title'])        
        self.channel.setLabel(self.detailData['channel'][0])

        #self.win.setProperty('title', self.detailData['title'])
        #self.win.setProperty('channel', self.detailData['channel'][0])        
        #if self.heading is not None:
        #    self.channel.setLabel(self.detailData['channel'][0])

        if self.oid_type!="R" and self.oid_type !="E":        
            self.win.setProperty('genre', str(self.detailData['genres']))
        
        
        self.channelIcon = self.fanart.getChannelIcon(self.detailData['channel'][0])
        if self.channelIcon is not None:
            self.channelImage.setImage(self.channelIcon)
        
        if self.epg == True:
            from datetime import datetime
            if datetime.now() >= self.detailData['start'] and datetime.now() < self.detailData['end']:
                self.playButton.setVisible(True)
                if self.detailData['status'] != "In-Progress":
                    self.playButton.setLabel("Watch")
        elif self.detailData.has_key('filename') == False:
            self.playButton.setVisible(False)
        elif self.detailData['filename'] !=  '':
            self.playButton.setVisible(True)
        else:
            self.playButton.setVisible(False)


        self.fanart = fanart()

        self.showIcon = self.fanart.getCachedIcon(self.detailData['title'])
        if self.showIcon is not None:
            self.showImage.setImage(self.showIcon)
            
        if self.oid_type=="NOT USED":
            if len(self.detailData['genres']) > 0:
                self.genreIcon = self.fanart.getGenreIcon(self.detailData['genres'][0])
                if self.genreIcon is not None:
                    self.genre1Image.setImage(self.genreIcon)
            
            if len(self.detailData['genres']) > 1:
                self.genreIcon = self.fanart.getGenreIcon(self.detailData['genres'][1])
                if self.genreIcon is not None:
                    self.genre2Image.setImage(self.genreIcon)
            
            if len(self.detailData['genres']) > 2:
                self.genreIcon = self.fanart.getGenreIcon(self.detailData['genres'][2])
                if self.genreIcon is not None:
                    self.genre3Image.setImage(self.genreIcon)
            
        if self.statusLabel is not None:
            self.statusLabel.setVisible(True)
            self.statusLabel.setLabel(self.detailData['status'])
        
        print self.detailData['status']
        print self.detailData['rectype']
        
        if self.detailData['rectype'] !="" and self.detailData['rectype'] != 'Record Once' and self.detailData['rectype'] != "Single"  and self.detailData['status'] != "Completed" and self.detailData['status'] != "In-Progress":
            self.win.setProperty('heading', 'Recurring Recording Properties')
            self.subtitleLabel.setVisible(True)
            self.subtitleLabel.setLabel(self.detailData['subtitle'])
            self.timeLabel.setVisible(True)
            ctmp = self.detailData['start'].strftime('%a, %b %d %H:%M') + " - " + self.detailData['end'].strftime('%H:%M')
            ctmp = ctmp + " (" + str(int((self.detailData['end'] - self.detailData['start']).seconds / 60)) + " min.)"
            self.timeLabel.setLabel(ctmp)
            self.descLabel.setHeight(220)
            self.descLabel.setVisible(True)
            self.descLabel.setText(self.detailData['desc'])

            if self.oid_type!="R"  and self.oid_type !="E":
                self.subtitleLabel.setVisible(False)
                self.timeLabel.setVisible(False)
                self.descLabel.setVisible(False)

                self.showSeperator.setVisible(False)
                self.extendTime.setVisible(False)
            
                self.qualityControl.setLabel( "Quality:", label2=self.detailData['recquality'] )
                self.qualityControl.setVisible(True)
                self.prePadding.setLabel( "Pre-Padding (min.):", label2=self.detailData['prepadding'] )
                self.prePadding.setVisible(True)
                self.postPadding.setLabel( "Post-Padding (min.):", label2=self.detailData['postpadding'] )
                self.postPadding.setVisible(True)
                self.scheduleType.setLabel( "Schedule Type:", label2=self.detailData['rectype'] )
                self.scheduleType.setVisible(True)
                #self.timeSlot.setLabel( "Timeslot:", label2=str(self.detailData['recdate']) )
                self.timeSlot.setVisible(False)
                self.keepRecs.setLabel( "Recordings to Keep:", label2=str(self.detailData['maxrecs']) )
                self.keepRecs.setVisible(True)
                self.recDirId.setLabel( "Directory:", label2=str(self.detailData['directory']) )
                self.recDirId.setVisible(True)
                
                self.placeFiller.setVisible(False)
                self.saveButton.setVisible(True)

            else:                
                #self.placeFiller.setVisible(True)
                self.quickrecordButton.setVisible(False)
            
                print self.detailData['resume']
                if self.oid_type !="E" and self.detailData['resume'] > 0:
                    if (self.detailData['duration'] - self.detailData['resume']) < 10:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(True)
                    else:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(Truee)
                else:
                    self.unwatchButton.setVisible(False)
                    self.resumeButton.setVisible(False)
            
            self.recordButton.setVisible(False)
            self.deleteButton.setVisible(True)

            self.closeButton.setVisible(True)      
            xbmcgui.WindowXML.setFocus(self, self.closeButton)
        
        elif (self.detailData['rectype'] == 'Record Once' or self.detailData['rectype'] == 'Single')  and self.detailData['status'] != "Completed" and self.detailData['status'] != "In-Progress" and self.detailData['status'] != "Failed":
            self.win.setProperty('heading', 'Recording Properties')
            
            self.subtitleLabel.setVisible(True)
            self.subtitleLabel.setLabel(self.detailData['subtitle'])
            self.timeLabel.setVisible(True)
            ctmp = self.detailData['start'].strftime('%a, %b %d %H:%M') + " - " + self.detailData['end'].strftime('%H:%M')
            ctmp = ctmp + " (" + str(int((self.detailData['end'] - self.detailData['start']).seconds / 60)) + " min.)"
            self.timeLabel.setLabel(ctmp)
            self.descLabel.setVisible(True)
            self.descLabel.setText(self.detailData['desc'])

            if self.oid_type!="R"  and self.oid_type !="E":
                self.showSeperator.setVisible(True)
                if (self.detailData['status'] == "Pending"):
                    if self.detailData['status'] == "In-Progress":
                        self.extendTime.setLabel( "Extend End-Time:", label2='Unknown' )
                        self.extendTime.setVisible(True)
                    else:
                        self.extendTime.setVisible(False)
                        self.scheduleType.setLabel( "Schedule Type:", label2=self.detailData['rectype'] )
                        self.scheduleType.setVisible(True)
                        self.prePadding.setLabel( "Pre-Padding (min.):", label2=self.detailData['prepadding'] )
                        self.prePadding.setVisible(True)
                        self.postPadding.setLabel( "Post-Padding (min.):", label2=self.detailData['postpadding'] )
                        self.postPadding.setVisible(True)
                        self.recDirId.setLabel( "Directory:", label2=str(self.detailData['directory']) )
                        self.recDirId.setVisible(True)
                        self.qualityControl.setLabel( "Quality:", label2=self.detailData['recquality'] )
                        self.qualityControl.setVisible(True)
                        self.saveButton.setVisible(True)        
                else:
                    self.extendTime.setVisible(False)
                    self.qualityControl.setVisible(False)
                    self.prePadding.setVisible(False)
                    self.postPadding.setVisible(False)
                    self.saveButton.setVisible(False)
                    self.scheduleType.setVisible(False)
                
                self.timeSlot.setVisible(False)
                self.keepRecs.setVisible(False)
            else:                
                #self.placeFiller.setVisible(True)
                self.quickrecordButton.setVisible(False)
            
                print self.detailData['resume']
                if self.oid_type !="E" and self.detailData['resume'] > 0:
                    if (self.detailData['duration'] - self.detailData['resume']) < 60:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(Truee)
                    else:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(True)
                else:
                    self.unwatchButton.setVisible(False)
                    self.resumeButton.setVisible(False)

            self.recordButton.setVisible(False)
            self.deleteButton.setVisible(True)
            
            self.closeButton.setVisible(True)

            if self.detailData['recording_oid'] > 0:
                xbmcgui.WindowXML.setFocus(self, self.closeButton)
            else:
                xbmcgui.WindowXML.setFocus(self, self.scheduleType)
        else:
            self.win.setProperty('heading', 'Program Details')
            self.subtitleLabel.setVisible(True)
            self.subtitleLabel.setLabel(self.detailData['subtitle'])
            self.timeLabel.setVisible(True)
            ctmp = self.detailData['start'].strftime('%a, %b %d %H:%M') + " - " + self.detailData['end'].strftime('%H:%M')
            ctmp = ctmp + " (" + str(int((self.detailData['end'] - self.detailData['start']).seconds / 60)) + " min.)"
            self.timeLabel.setLabel(ctmp)
            self.descLabel.setHeight(220)
            self.descLabel.setVisible(True)
            detText = self.detailData['desc']  
            if self.detailData['status'] == "Failed":
                detText = detText + '[CR][COLOR red]Failed[/COLOR]'


            self.descLabel.setText(detText)

            if self.oid_type!="R"  and self.oid_type !="E":
                x, y = self.showSeperator.getPosition()
                self.showSeperator.setPosition(x, y+220)
                self.showSeperator.setVisible(True)
                
                self.qualityControl.setVisible(False)
                self.prePadding.setVisible(False)
                self.postPadding.setVisible(False)
                self.extendTime.setVisible(False)
                self.scheduleType.setVisible(False)
                self.timeSlot.setVisible(False)
                self.keepRecs.setVisible(False)
                self.recDirId.setVisible(False)
                self.placeFiller.setVisible(True)
            else:
                print self.detailData['resume']
                if self.oid_type !="E" and self.detailData['resume'] > 0:
                    if (self.detailData['duration'] - self.detailData['resume']) < 60:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(True)
                    else:
                        self.unwatchButton.setVisible(False)
                        self.resumeButton.setVisible(True)
                else:
                    self.unwatchButton.setVisible(False)
                    self.resumeButton.setVisible(False)
            
            if self.detailData['status'] != "Completed" and self.detailData['status'] != "In-Progress"  and self.detailData['status'] != "Failed":
                self.recordButton.setVisible(True)
                self.quickrecordButton.setVisible(True)
                self.deleteButton.setVisible(False)
            else:
                if self.detailData['status'] == "Completed" or self.detailData['status'] == "Failed":
                    self.deleteButton.setLabel('Delete')
                self.deleteButton.setVisible(True)
                self.recordButton.setVisible(False)
                self.quickrecordButton.setVisible(False)
            
            if self.oid_type!="R"  and self.oid_type !="E":
                self.saveButton.setVisible(False)
            self.closeButton.setVisible(True)


            xbmcgui.WindowXML.setFocus(self, self.closeButton)
        self.win.setProperty('busy', 'false')