当前位置: 首页>>代码示例>>Python>>正文


Python Channel.checkAddrExist方法代码示例

本文整理汇总了Python中channel.Channel.checkAddrExist方法的典型用法代码示例。如果您正苦于以下问题:Python Channel.checkAddrExist方法的具体用法?Python Channel.checkAddrExist怎么用?Python Channel.checkAddrExist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在channel.Channel的用法示例。


在下文中一共展示了Channel.checkAddrExist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: importChannels

# 需要导入模块: from channel import Channel [as 别名]
# 或者: from channel.Channel import checkAddrExist [as 别名]
  def importChannels(self):
    # self.createDb()
    # self.migrateDb()
    
    with open(SETTINGS.CHAN_LIST) as json_file:
      data = json.loads(json_file.read())
      json_file.close()

      self.cleanCategories()

      parsedIds = []

      for group in data['groups']:
        addon_log(str(group['id']) + " " + group['name'])
        cat = Category(id = group['id'], name=group['name'])
        cat.insert()
        
        for channel in group['channels']:
          #addon_log(str(channel['id'])+" "+unicode(channel['name'])+" "+ str(channel['language'])+" "+str(channel['status']))
          if ((not channel['unverified']) or (SETTINGS.SHOW_UNVERIFIED=='true')):

            #addon_log(channel['name'].encode('utf8'))

            # schedule_id = 0
            # thumbnail = ""
            # video_resolution = ""
            # video_aspect = 0
            # audio_codec = ""
            # video_codec = ""

            # stream_type = channel['stream_type']
            # if 'schedule' in channel:
            #   schedule = channel['schedule']
            #   schedule_id = schedule['ch_id']
            # if 'thumbnail' in channel:
            #   thumbnail = channel['thumbnail']
            # if 'video_resolution' in stream_type:
            #   video_resolution = stream_type['video_resolution']
            # if 'video_aspect' in stream_type:
            #   video_aspect = stream_type['video_aspect']
            # if 'audio_codec' in stream_type:
            #   audio_codec = stream_type['audio_codec']
            # if 'video_codec' in stream_type:
            #   video_codec = stream_type['video_codec']
            if(channel['status'] == 2): 
              status = Channel.STATUS_ONLINE 
            else: 
              status = Channel.STATUS_OFFLINE

            ch = Channel(id = str(channel['id']),
                         id_cat = group['id'],
                         name = channel['name'],
                         address = channel['address'], 
                         protocol = channel['protocol'],
                         language = channel['language'],
                         status = status,
                         unverified = channel['unverified']
                        )
            if((ch.checkExist() == False) and (ch.checkAddrExist() == False)):
              ch.insert()
            else:
              if(ch.checkIsMy() == False):
                ch.update(id_cat = group['id'],
                          name = channel['name'],
                          address = channel['address'], 
                          protocol = channel['protocol'],
                          language = channel['language'],
                          status = status,
                          unverified = channel['unverified'])
            
            if(ch.checkIsMy() == False):
              parsedIds.append(ch.id)
      
      addon_log('parsed %d channels' % len(parsedIds))
      self.cleanChannels(parsedIds)
开发者ID:moromete,项目名称:plugin.video.streams,代码行数:77,代码来源:channels.py


注:本文中的channel.Channel.checkAddrExist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。