Beispiel #1
0
    def parse_channels(self, channels):
        if type(channels) is not ListType:
            log.error('Error parsing channels: not a list')
            return False

        for channel in channels:
            c = channel.split(':', 2)

            # first field: tunerid
            tunerid = c[0]

            if len(c) > 1:
                # second field: name
                name = c[1]
            else:
                name = 'undefined'

            if len(c) > 2:
                # third field: frequency
                frequency = c[2]
            else:
                # no frequency specified, look it up
                frequency = get_frequency(tunerid, self.chanlist)

            if frequency == 0:
                log.error('no frequency for %s, either specify in config or check your chanlist' % tunerid)
                continue

            chan = self._V4LChannel(tunerid, name, frequency) 
            log.info('adding channel: %s' % chan)
            self.channels[chan.tunerid] = chan
Beispiel #2
0
    def setchannel(self, channel):
        freq = get_frequency(channel, self.chanlist)

        log.debug('setting channel to %s (%d)' % (channel, freq))

        freq *= 16

        # The folowing check for TUNER_LOW capabilities was not working for
        # me... needs further investigation. 
        # if not (self.capabilities & V4L2_TUNER_CAP_LOW):
        #     # Tune in MHz.
        #     freq /= 1000
        freq /= 1000

        try:
            self.setfreq(freq)
        except:
            self.setfreq_old(freq)