本文整理汇总了Python中models.Video.objects方法的典型用法代码示例。如果您正苦于以下问题:Python Video.objects方法的具体用法?Python Video.objects怎么用?Python Video.objects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Video
的用法示例。
在下文中一共展示了Video.objects方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_play_complete
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import objects [as 别名]
def process_play_complete(self, timestamp):
next_video = None
if self.force_play_id:
print "force video lined up"
next_video = Video.objects(id = self.force_play_id)
self.force_play_id = None
if not next_video:
print "get next video based on timestamp"
next_video = Video.objects(created_at__gt=timestamp)
if next_video:
self.play_async(next_video[0]['video_url'], next_video[0]['created_at'])
示例2: process_play
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import objects [as 别名]
def process_play(self, video_id):
print "process play"
item = Video.objects(id = video_id)
if not item:
return
print item.to_json()
if self.sub:
self.force_play_id = video_id
self.process_cmd("EXIT")
else:
self.play_async(item[0]['video_url'], item[0]['created_at'])
print "process play completed"
示例3: process_notification
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import objects [as 别名]
def process_notification(self, data):
print "notification received"
notification = data['notify']
if notification == "video_added":
item = Video.objects(id=data['id'])[0]
item.update(name = self.try_get_video_name(item['video_url']))
if self.sub == None:
self.task.put({'play': data['id']})
return
if notification == "video_clear":
if self.sub != None:
self.process_cmd("EXIT")
return
if notification == "video_played":
print "video_played"
self.task.put({'play': data['id']})