예제 #1
0
def _channels():

    # Fetch remote data
    log.info('fetch free to air channel info')
    chn_data = cache.get_data('uk_satellite_channels.csv', ttl=86400 * 7)
    reg_data = cache.get_data('uk_satellite_regions.csv', ttl=86400 * 7)

    # Channels list
    log.info('processing channel list')
    regional = []
    chns = []
    for l in chn_data.splitlines()[1:]:
        p = l.strip().split(',')
        if len(p) < 9: continue
        try:
            c = Channel()
            c.extra['stream'] = [(int(p[0]), p[1])]
            c.uri = p[2]
            c.title = p[3]
            c.extra['freesat_number'] = int(p[4])
            c.number = c.extra['sky_number'] = int(p[5])
            c.hd = p[6] == '1'
            c.radio = p[8] == '1'
            if (p[10]):
                c.image = p[10]
            else:
                c.image = p[9]

            # Skip
            if not c.uri: continue

            # Already included
            if c in chns:
                for t in chns:
                    if t == c:
                        t.extra['stream'].extend(c.extra['stream'])
                        break
                continue

            # Regional channel
            if p[7] == '1':
                regional.append(c)

            # Store
            elif c.extra['stream'][0][0]:
                chns.append(c)

        except Exception, e:
            log.error('failed to process [%s] [e=%s]' % (l, str(e)))
예제 #2
0
def _channels ():

  # Fetch remote data
  log.info('fetch free to air channel info')
  chn_data = cache.get_data('uk_satellite_channels.csv', ttl=86400*7)
  reg_data = cache.get_data('uk_satellite_regions.csv', ttl=86400*7)

  # Channels list
  log.info('processing channel list')
  regional = []
  chns     = []
  for l in chn_data.splitlines()[1:]:
    p = l.strip().split(',')
    if len(p) < 9: continue
    try:
      c = Channel()
      c.extra['stream']                = [ (int(p[0]), p[1]) ] 
      c.uri                            = p[2]
      c.title                          = p[3]
      c.extra['freesat_number']        = int(p[4])
      c.number = c.extra['sky_number'] = int(p[5])
      c.hd                             = p[6] == '1'
      c.radio                          = p[8] == '1'
      if (p[10]):
        c.image                        = p[10]
      else:
        c.image                        = p[9]

      # Skip
      if not c.uri: continue

      # Already included
      if c in chns:
        for t in chns:
          if t == c:
            t.extra['stream'].extend(c.extra['stream'])
            break
        continue

      # Regional channel
      if p[7] == '1': 
        regional.append(c)

      # Store
      elif c.extra['stream'][0][0]:
        chns.append(c)

    except Exception, e:
      log.error('failed to process [%s] [e=%s]' % (l, str(e)))
예제 #3
0
파일: atlas.py 프로젝트: adamsutton/PyEPG
def load_channels ():
  ret = set()
  log.info('get atlas channel list')

  # Process
  data = cache.get_data('atlas_channels.csv')
  if data:
    for l in data.splitlines():
      p = map(lambda x: x.strip(), l.split(','))
      if len(p) < 3: continue
      c = Channel()
      c.uri       = p[0]
      c.shortid   = p[1]
      c.publisher = [ p[3] ]
      ret.add(c)
  return ret
예제 #4
0
파일: atlas.py 프로젝트: neopack1/PyEPG
def load_channels():
    ret = set()
    log.info('get atlas channel list')

    # Process
    data = cache.get_data('atlas_channels.csv')
    if data:
        for l in data.splitlines():
            p = map(lambda x: x.strip(), l.split(','))
            if len(p) < 3: continue
            c = Channel()
            c.uri = p[0]
            c.shortid = p[1]
            c.publisher = [p[3]]
            ret.add(c)
    return ret