本文整理汇总了Python中helpers.push_helper.PushHelper.get_users_subscribed_to_match方法的典型用法代码示例。如果您正苦于以下问题:Python PushHelper.get_users_subscribed_to_match方法的具体用法?Python PushHelper.get_users_subscribed_to_match怎么用?Python PushHelper.get_users_subscribed_to_match使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.push_helper.PushHelper
的用法示例。
在下文中一共展示了PushHelper.get_users_subscribed_to_match方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: send_upcoming_match_notification
# 需要导入模块: from helpers.push_helper import PushHelper [as 别名]
# 或者: from helpers.push_helper.PushHelper import get_users_subscribed_to_match [as 别名]
def send_upcoming_match_notification(cls, match, event):
users = PushHelper.get_users_subscribed_to_match(match, NotificationType.UPCOMING_MATCH)
keys = PushHelper.get_client_ids_for_users(users)
if match.set_number == 1 and match.match_number == 1:
# First match of a new type, send level starting notifications
start_users = PushHelper.get_users_subscribed_to_match(match, NotificationType.LEVEL_STARTING)
start_keys = PushHelper.get_client_ids_for_users(start_users)
level_start = CompLevelStartingNotification(match, event)
level_start.send(start_keys)
# Send upcoming match notification
notification = UpcomingMatchNotification(match, event)
notification.send(keys)
match.push_sent = True # Make sure we don't send updates for this match again
match.put()
示例2: send_match_score_update
# 需要导入模块: from helpers.push_helper import PushHelper [as 别名]
# 或者: from helpers.push_helper.PushHelper import get_users_subscribed_to_match [as 别名]
def send_match_score_update(cls, match):
users = PushHelper.get_users_subscribed_to_match(match, NotificationType.MATCH_SCORE)
gcm_keys = PushHelper.get_client_ids_for_users(ClientType.names[ClientType.OS_ANDROID], users)
if len(gcm_keys) == 0:
return
notification = MatchScoreNotification(match)
message = notification.build(ClientType.OS_ANDROID, {ClientType.OS_ANDROID: gcm_keys})
gcm_connection = GCMConnection()
gcm_connection.notify_device(message)
示例3: send_match_video
# 需要导入模块: from helpers.push_helper import PushHelper [as 别名]
# 或者: from helpers.push_helper.PushHelper import get_users_subscribed_to_match [as 别名]
def send_match_video(cls, match):
"""
Sends match_video and event_match_video notifications
If the match is current, MatchVideoNotification is sent.
Otherwise, EventMatchVideoNotification is sent
"""
match_users = set(PushHelper.get_users_subscribed_to_match(match, NotificationType.MATCH_VIDEO))
event_users = set(PushHelper.get_users_subscribed_to_event(match.event.get(), NotificationType.MATCH_VIDEO))
users = match_users.union(event_users)
if match.within_seconds(60*10):
user_keys = PushHelper.get_client_ids_for_users(users)
MatchVideoNotification(match).send(user_keys)
else:
user_keys = PushHelper.get_client_ids_for_users(users)
EventMatchVideoNotification(match).send(user_keys)
示例4: send_match_score_update
# 需要导入模块: from helpers.push_helper import PushHelper [as 别名]
# 或者: from helpers.push_helper.PushHelper import get_users_subscribed_to_match [as 别名]
def send_match_score_update(cls, match):
users = PushHelper.get_users_subscribed_to_match(match, NotificationType.MATCH_SCORE)
keys = PushHelper.get_client_ids_for_users(users)
notification = MatchScoreNotification(match)
notification.send(keys)