本文整理匯總了Python中channel.Channel.checkIsMy方法的典型用法代碼示例。如果您正苦於以下問題:Python Channel.checkIsMy方法的具體用法?Python Channel.checkIsMy怎麽用?Python Channel.checkIsMy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類channel.Channel
的用法示例。
在下文中一共展示了Channel.checkIsMy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: importChannels
# 需要導入模塊: from channel import Channel [as 別名]
# 或者: from channel.Channel import checkIsMy [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)