Exemplo n.º 1
0
    def editSchedule(self):
        if self.program.getScheduleId() is None:
            xbmcgui.Dialog().ok(self.t(m.INFO), self.t(m.ERR_NO_RECORDING_SCHEDULE))
            return
    
        schedules = self.db().getRecordingSchedules(scheduleId=self.program.getScheduleId())
        if len(schedules) == 0:
            xbmcgui.Dialog().ok(self.t(m.INFO), self.t(m.ERR_SCHEDULE_NOT_FOUND) % self.program.getScheduleId())
            return 

        editScheduleDialog = ScheduleDialog(
            'mythbox_schedule_dialog.xml', 
            self.platform.getScriptDir(), 
            forceFallback=True,
            schedule=schedules[0],
            **to_kwargs(self, ['translator', 'platform', 'settings', 'mythChannelIconCache'])) 
        editScheduleDialog.doModal()
        if editScheduleDialog.shouldRefresh:
            self.render()
Exemplo n.º 2
0
    def onControlHook(self, control):
        actionConsumed = True
        
        id = control.getId()
        program = None
        for c in self.gridCells:
            if c.control == control:
                program = c.program
                break
        
        if program:
            if program.isShowing():
                log.debug('launching livetv')
                self.watchLiveTv(program)
            else:
                log.debug('launching edit schedule dialog')
                
                # scheduled recording
                if c.scheduleId:
                    schedule = self.db().getRecordingSchedules(scheduleId=c.scheduleId).pop()
                
                # not scheduled but happens to have an existing recording schedule
                schedule = self.scheduleForTitle(program)

                # new recording schedule
                if schedule is None:
                    schedule = RecordingSchedule.fromProgram(program, self.translator)
                
                d = ScheduleDialog(
                    'mythbox_schedule_dialog.xml',
                    self.platform.getScriptDir(),
                    forceFallback=True,
                    schedule=schedule,
                    translator=self.translator,
                    platform=self.platform,
                    settings=self.settings,
                    mythChannelIconCache=self.mythChannelIconCache)
                d.doModal()

        return actionConsumed