コード例 #1
0
ファイル: programitem.py プロジェクト: charrea6/freevo1
    def __init__(self, parent, prog, context='menu'):
        Item.__init__(self, parent, skin_type='video')
        logger.log( 9, '__init__(parent=%r, prog=%r, context=%r)', parent, prog, context)
        # prog is a TvProgram object as we get it from the recordserver
        self.prog = prog
        self.context= context

        if hasattr(prog, 'name'): self.name = self.title = prog.name
        if hasattr(prog, 'title'): self.title = self.name = Unicode(prog.title)
        if hasattr(prog, 'sub_title'): self.sub_title = prog.sub_title
        if hasattr(prog, 'desc'): self.description = prog.desc
        if hasattr(prog, 'categories'):self.categories = prog.categories
        if hasattr(prog, 'ratings'): self.ratings = prog.ratings
        if hasattr(prog, 'advisories'): self.advisories = prog.advisories

        self.channel = tv_util.get_chan_displayname(prog.channel_id)
        if hasattr(prog, 'scheduled'):
            self.scheduled = prog.scheduled
        else:
            self.scheduled = False

        self.favorite = False
        self.allowDuplicates = prog.allowDuplicates
        self.onlyNew = prog.onlyNew
        self.overlap = prog.overlap

        self.start = time.strftime(config.TV_DATETIME_FORMAT, time.localtime(prog.start))
        self.stop = time.strftime(config.TV_DATETIME_FORMAT, time.localtime(prog.stop))
        self.recordclient = RecordClient()
コード例 #2
0
def get_friendly_channel(channel_id):
    channel_name = tv_util.get_chan_displayname(channel_id)

    if not channel_name:
        AlertBox(text=_('Could not find TV channel %s') % channel_id).show()

    return channel_name
コード例 #3
0
ファイル: speak.py プロジェクト: adozenlines/freevo1
    def eventhandler(self, event, menuw=None):
        """Catch events to speak corresponding text."""
        logger.debug('eventhandler(self, %s, %s) %s arg=%s', event, menuw, self, event.arg)

        if event.context is not None and event.context.endswith('menu'):
            sel = menuw.menustack[-1].selected
            if isinstance(sel, Item):
                self.speak(sel.name)
            elif isinstance(sel, TvProgram):
                text = _('channel')+(' %s, %s, ' % (get_chan_displayname(sel.channel_id), strftime('%H %M', localtime(sel.start))))+_('program')+(' %s ' % sel.title)
                self.speak(text)
            else:
                logger.debug('Selected by unknown event: ')
コード例 #4
0
ファイル: record_types.py プロジェクト: spartrekus/freevo1
    def __init__(self,
                 name=None,
                 prog=None,
                 exactchan=False,
                 exactdow=False,
                 exacttod=False,
                 priority=0,
                 allowDuplicates=True,
                 onlyNew=False):
        """ Construct a TV favorite recording """
        logger.log(
            9,
            'Favorite.__init__(name=%r, prog=%r, chan=%r, dow=%r, tod=%r, priority=%r, duplicates=%r, new=%r)',
            name, prog, exactchan, exactdow, exacttod, priority,
            allowDuplicates, onlyNew)

        self.TYPES_VERSION = TYPES_VERSION

        self.name = name
        if name:
            self.name = tv_util.progname2favname(name)
        self.priority = priority
        self.allowDuplicates = allowDuplicates
        self.onlyNew = onlyNew

        if prog:
            self.title = prog.title

            if exactchan:
                self.channel = tv_util.get_chan_displayname(prog.channel_id)
            else:
                self.channel = 'ANY'

            if exactdow:
                lt = time.localtime(prog.start)
                self.dow = lt[6]
            else:
                self.dow = 'ANY'

            if exacttod:
                lt = time.localtime(prog.start)
                self.mod = (lt[3] * 60) + lt[4]
            else:
                self.mod = 'ANY'

        else:
            self.title = 'NONE'
            self.channel = 'NONE'
            self.dow = 'NONE'
            self.mod = 'NONE'
コード例 #5
0
    def eventhandler(self, event, menuw=None):
        """Catch events to speak corresponding text."""
        logger.debug('eventhandler(self, %s, %s) %s arg=%s', event, menuw,
                     self, event.arg)

        if event.context is not None and event.context.endswith('menu'):
            sel = menuw.menustack[-1].selected
            if isinstance(sel, Item):
                self.speak(sel.name)
            elif isinstance(sel, TvProgram):
                text = _('channel') + (' %s, %s, ' % (get_chan_displayname(
                    sel.channel_id), strftime('%H %M', localtime(
                        sel.start)))) + _('program') + (' %s ' % sel.title)
                self.speak(text)
            else:
                logger.debug('Selected by unknown event: ')
コード例 #6
0
    def __init__(self, parent, prog, context='guide'):
        Item.__init__(self, parent, skin_type='video')
        self.prog = prog
        self.context = context

        self.name = self.title = prog.title
        if hasattr(prog, 'sub_title'): self.sub_title = prog.sub_title
        if hasattr(prog, 'desc'): self.desc = prog.desc
        self.channel = tv_util.get_chan_displayname(prog.channel_id)

        if hasattr(prog, 'scheduled'):
            self.scheduled = prog.scheduled
        else:
            self.scheduled = False

        self.allowDuplicates = prog.allowDuplicates

        self.onlyNew = prog.onlyNew

        self.overlap = prog.overlap

        self.favorite = False

        self.start = time.strftime(config.TV_DATETIMEFORMAT,
                                   time.localtime(prog.start))
        self.stop = time.strftime(config.TV_DATETIMEFORMAT,
                                  time.localtime(prog.stop))

        self.categories = ''
        try:
            for cat in prog.categories:
                if prog.categories.index(cat) > 0:
                    self.categories += ', %s' % cat
                else:
                    self.categories += '%s' % cat
        except AttributeError:
            pass

        self.ratings = ''
        try:
            for rat in prog.ratings.keys():
                self.ratings += '%s ' % rat
        except:
            pass
コード例 #7
0
    def __init__(self, parent, prog, context='menu'):
        Item.__init__(self, parent, skin_type='video')
        logger.log(9, '__init__(parent=%r, prog=%r, context=%r)', parent, prog,
                   context)
        # prog is a TvProgram object as we get it from the recordserver
        self.prog = prog
        self.context = context

        if hasattr(prog, 'name'): self.name = self.title = prog.name
        if hasattr(prog, 'title'): self.title = self.name = Unicode(prog.title)
        if hasattr(prog, 'sub_title'): self.sub_title = prog.sub_title
        if hasattr(prog, 'desc'): self.description = prog.desc
        if hasattr(prog, 'categories'): self.categories = prog.categories
        if hasattr(prog, 'ratings'): self.ratings = prog.ratings
        if hasattr(prog, 'advisories'): self.advisories = prog.advisories

        self.channel = tv_util.get_chan_displayname(prog.channel_id)
        if hasattr(prog, 'scheduled'):
            self.scheduled = prog.scheduled
        else:
            self.scheduled = False

        self.favorite = False
        if hasattr(prog, 'allowDuplicates'):
            self.allowDuplicates = prog.allowDuplicates
        else:
            self.allowDuplicates = 1

        if hasattr(prog, 'onlyNew'):
            self.onlyNew = prog.onlyNew
        else:
            self.onlyNew = 0

        self.overlap = prog.overlap

        self.start = time.strftime(config.TV_DATETIME_FORMAT,
                                   time.localtime(prog.start))
        self.stop = time.strftime(config.TV_DATETIME_FORMAT,
                                  time.localtime(prog.stop))
        self.recordclient = RecordClient()
コード例 #8
0
ファイル: record_types.py プロジェクト: adozenlines/freevo1
    def __init__(self, name=None, prog=None, exactchan=False, exactdow=False, exacttod=False, priority=0,
        allowDuplicates=True, onlyNew=False):
        """ Construct a TV favorite recording """
        logger.log( 9, 'Favorite.__init__(name=%r, prog=%r, chan=%r, dow=%r, tod=%r, priority=%r, duplicates=%r, new=%r)', name, prog, exactchan, exactdow, exacttod, priority, allowDuplicates, onlyNew)

        self.TYPES_VERSION = TYPES_VERSION

        self.name = name
        if name:
            self.name = tv_util.progname2favname(name)
        self.priority = priority
        self.allowDuplicates = allowDuplicates
        self.onlyNew = onlyNew

        if prog:
            self.title = prog.title

            if exactchan:
                self.channel = tv_util.get_chan_displayname(prog.channel_id)
            else:
                self.channel = 'ANY'

            if exactdow:
                lt = time.localtime(prog.start)
                self.dow = lt[6]
            else:
                self.dow = 'ANY'

            if exacttod:
                lt = time.localtime(prog.start)
                self.mod = (lt[3]*60)+lt[4]
            else:
                self.mod = 'ANY'

        else:
            self.title = 'NONE'
            self.channel = 'NONE'
            self.dow = 'NONE'
            self.mod = 'NONE'
コード例 #9
0
    def __init__(self, name=None, prog=None, exactchan=FALSE, exactdow=FALSE, 
                 exacttod=FALSE, priority=0, allowDuplicates=TRUE, onlyNew=FALSE):
        self.TYPES_VERSION = TYPES_VERSION
        
        self.name = name
        if name:
            self.name = tv_util.progname2favname(name)
        self.priority = priority
        self.allowDuplicates = allowDuplicates
        self.onlyNew = onlyNew

        if prog:
            self.title = prog.title

            if exactchan:
                self.channel = tv_util.get_chan_displayname(prog.channel_id)
            else:
                self.channel = 'ANY'
          
            if exactdow:
                lt = time.localtime(prog.start)
                self.dow = lt[6]
            else:
                self.dow = 'ANY'
          
            if exacttod:
                lt = time.localtime(prog.start)
                self.mod = (lt[3]*60)+lt[4]
            else:
                self.mod = 'ANY'

        else:
            self.title = 'NONE'
            self.channel = 'NONE'
            self.dow = 'NONE'
            self.mod = 'NONE'
コード例 #10
0
    def searchProg(self, find):
        if DEBUG: print String('SEARCHING FOR: %s' % find)
        pop = PopupBox(parent=self, text=_('Searching, please wait...'))
        pop.show()

        (result, matches) = record_client.findMatches(find)

        if result:
            if DEBUG:
                print 'FOUND: %s' % len(matches)

            i = 0
            self.results.items = []

            if len(matches) > self.num_shown_items:
                self.results.show_v_scrollbar = 1
            else:
                self.results.show_v_scrollbar = 0

            f = lambda a, b: cmp(a.start, b.start)
            matches.sort(f)
            for prog in matches:
                i += 1
                self.results.add_item(text='%s %s: %s' % \
                                        (time.strftime('%b %d %I:%M %p',
                                           time.localtime(prog.start)),
                                         tv_util.get_chan_displayname(prog.channel_id),
                                         prog.title),
                                      value=prog)

            space_left = self.num_shown_items - i
            if space_left > 0:
                for i in range(space_left):
                    self.results.add_item(text=' ', value=0)

        pop.destroy()
コード例 #11
0
ファイル: tvmenu.py プロジェクト: adozenlines/freevo1
def get_friendly_channel(channel_id):
    channel_name = tv_util.get_chan_displayname(channel_id)
    if not channel_name:
        dialog.show_alert(_('Could not find TV channel %s') % channel_id)
    return channel_name
コード例 #12
0
ファイル: tvmenu.py プロジェクト: spartrekus/freevo1
def get_friendly_channel(channel_id):
    channel_name = tv_util.get_chan_displayname(channel_id)
    if not channel_name:
        dialog.show_alert(_('Could not find TV channel %s') % channel_id)
    return channel_name