本文整理汇总了Python中models.match.Match.youtube_videos方法的典型用法代码示例。如果您正苦于以下问题:Python Match.youtube_videos方法的具体用法?Python Match.youtube_videos怎么用?Python Match.youtube_videos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.match.Match
的用法示例。
在下文中一共展示了Match.youtube_videos方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models.match import Match [as 别名]
# 或者: from models.match.Match import youtube_videos [as 别名]
def post(self, match_key):
self._require_admin()
alliances_json = self.request.get("alliances_json")
alliances = json.loads(alliances_json)
youtube_videos = json.loads(self.request.get("youtube_videos"))
team_key_names = list()
for alliance in alliances:
team_key_names.extend(alliances[alliance].get('teams', None))
match = Match(
id=match_key,
event=Event.get_by_id(self.request.get("event_key_name")).key,
set_number=int(self.request.get("set_number")),
match_number=int(self.request.get("match_number")),
comp_level=self.request.get("comp_level"),
team_key_names=team_key_names,
alliances_json=alliances_json,
# no_auto_update = str(self.request.get("no_auto_update")).lower() == "true", #TODO
)
match = MatchManipulator.createOrUpdate(match)
match.youtube_videos = youtube_videos
match.dirty = True # hacky
MatchManipulator.createOrUpdate(match)
self.redirect("/admin/match/" + match.key_name)
示例2: store_match
# 需要导入模块: from models.match import Match [as 别名]
# 或者: from models.match.Match import youtube_videos [as 别名]
def store_match(data):
match = Match(id=data['key'])
match.event = ndb.Key(Event, data['event_key'])
match.year = int(data['key'][:4])
match.comp_level = data['comp_level']
match.set_number = data['set_number']
match.match_number = data['match_number']
if data.get('time'):
match.time = datetime.datetime.fromtimestamp(int(data['time']))
if data.get('actual_time'):
match.actual_time = datetime.datetime.fromtimestamp(int(data['actual_time']))
if data.get('predicted_time'):
match.predicted_time = datetime.datetime.fromtimestamp(int(data['predicted_time']))
if data.get('post_result_time'):
match.post_result_time = datetime.datetime.fromtimestamp(int(data['post_result_time']))
match.score_breakdown_json = json.dumps(data['score_breakdown'])
team_key_names = []
for alliance in ['red', 'blue']:
team_key_names += data['alliances'][alliance]['team_keys']
data['alliances'][alliance]['teams'] = data['alliances'][alliance].pop('team_keys')
data['alliances'][alliance]['surrogates'] = data['alliances'][alliance].pop('surrogate_team_keys')
match.alliances_json = json.dumps(data['alliances'])
match.team_key_names = team_key_names
youtube_videos = []
for video in data['videos']:
if video['type'] == 'youtube':
youtube_videos.append(video['key'])
match.youtube_videos = youtube_videos
return MatchManipulator.createOrUpdate(match)