def get_fixture_channels(self, events, fixture):
chann = []
items = []
for item in events:
evnt = item['event']
comp = fuzz.ratio(fixture.competition.name, evnt['competition'])
home = fuzz.ratio(fixture.home_team.name, evnt['home'])
away = fuzz.ratio(fixture.away_team.name, evnt['away'])
comb = (comp + home + away) / 3
items.append({ 'ratio': comb, 'channels': item['channels'] })
if items:
sort = sorted(items, key=itemgetter('ratio'), reverse=True)[0]
if sort['ratio'] > 70:
chann = self.data.get_multiple('channel', 'name', sort['channels'])
chann = [c.id for c in chann]
return chann
评论列表
文章目录