本文整理汇总了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)