本文整理汇总了Python中models.Event.volume方法的典型用法代码示例。如果您正苦于以下问题:Python Event.volume方法的具体用法?Python Event.volume怎么用?Python Event.volume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Event
的用法示例。
在下文中一共展示了Event.volume方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gatraPlayer_PostEvent
# 需要导入模块: from models import Event [as 别名]
# 或者: from models.Event import volume [as 别名]
def gatraPlayer_PostEvent(request, id):
allowed_methods = ['POST', 'OPTIONS']
if request.method == 'OPTIONS':
response = HttpResponse('', status=http_REQUEST_OK)
response['Allow'] = ', '.join(allowed_methods)
return response
if request.method != 'POST':
return HttpResponse('', status=http_NOT_ALLOWED)
if 'HTTP_GATRA_HASH' in request.META.keys():
_hash = request.META['HTTP_GATRA_HASH']
try:
h = Hash.objects.get(valid_hash = _hash)
except:
return HttpResponse(_hash, status=http_UNAUTHORIZED)
else:
return HttpResponse('', status=http_UNAUTHORIZED)
if id is None:
return HttpResponse('', status=http_BAD_REQUEST)
try:
jsonData = json.loads(request.body)
except:
return HttpResponse('Could not load json', status=http_BAD_REQUEST)
if ('type' in jsonData.keys() and
'trigger' in jsonData.keys() and
'width' in jsonData.keys() and
'container_height' in jsonData.keys() and
'container_width' in jsonData.keys() and
'state' in jsonData.keys() and
'position' in jsonData.keys() and
'fullscreen' in jsonData.keys() and
'volume' in jsonData.keys()):
try:
play_id = Play.objects.get(id = id)
except:
return HttpResponse('Play ID not found', status=http_BAD_REQUEST)
event = Event()
event.play = play_id
event.type = jsonData['type']
event.trigger = jsonData['trigger']
event.width = jsonData['width']
event.container_height = jsonData['container_height']
event.container_width = jsonData['container_width']
event.state = jsonData['state']
event.position = jsonData['position']
event.fullscreen = jsonData['fullscreen']
event.volume = jsonData['volume']
if 'bitrate' in jsonData.keys():
event.bitrate = jsonData['bitrate']
if 'bandwidth' in jsonData.keys():
event.bandwidth = jsonData['bandwidth']
if 'media_seq' in jsonData.keys():
event.media_seq = jsonData['media_seq']
if 'load_time' in jsonData.keys():
event.load_time = jsonData['load_time']
if 'quality_label' in jsonData.keys():
event.quality_label = jsonData['quality_label']
event.save()
status = http_POST_OK
return HttpResponse('', status=status, content_type='application/json')
return HttpResponse('Mandatory json value not found', status=http_BAD_REQUEST)