当前位置: 首页>>代码示例>>Python>>正文


Python Video.house_id方法代码示例

本文整理汇总了Python中models.Video.house_id方法的典型用法代码示例。如果您正苦于以下问题:Python Video.house_id方法的具体用法?Python Video.house_id怎么用?Python Video.house_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Video的用法示例。


在下文中一共展示了Video.house_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: save_manifest_in_model

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import house_id [as 别名]
def save_manifest_in_model(house_id, m3u8_manifest):
    
    # 
    # Search de Video, if exist return Error
    try:
	video = Video.objects.get(house_id=house_id)
	return False
    except:
	video = Video()
	video.house_id = house_id
	video.format   = 'hls'
	video.save()

    for rendition in m3u8_manifest.files:
	profile = Profile()
	profile.video = video
	profile.bandwidth  	= rendition['bandwidth']
        profile.average    	= rendition['average']
        profile.codecs     	= rendition['codecs']
        profile.resolution 	= rendition['resolution']
        profile.filename   	= rendition['filename']
	profile.version	   	= rendition['rendition'].header['version']
	profile.media_seq  	= rendition['rendition'].header['media_seq']
	profile.allow_cache	= rendition['rendition'].header['allow_cache']
	profile.target_duration = rendition['rendition'].header['target_duration']
	profile.save()
	for tsfile in rendition['rendition'].files:
	    profile_file = ProfileFile()
	    profile_file.profile  = profile
	    profile_file.number   = tsfile['number']
	    profile_file.extinf   = tsfile['extinf']
	    profile_file.filename = tsfile['filename']
	    profile_file.save()

    return True
开发者ID:emilianobilli,项目名称:content-manager,代码行数:37,代码来源:Utils.py

示例2: cm_PostCuePoint

# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import house_id [as 别名]
def cm_PostCuePoint(request):
    if request.method == 'GET':
        return TemplateResponse(request, 'cue_manager.html')

    if request.method != 'POST':
        status = http_METHOD_NOT_ALLOWED
        return HttpResponse('', status=status)

    if 'house_id' in request.POST.keys():
        house_id = request.POST['house_id']
    else:
       status = http_BAD_REQUEST
       return HttpResponse('', status=status)

    if house_id == '':
        status = http_BAD_REQUEST
        return HttpResponse('', status=status)

    languages = Language.objects.all()

    for key, value  in request.POST.iteritems():
        if key.endswith('_tc') and value != '':
            i, t = key.split('_')
            for lang in languages:
                lang_key = '%s_%s' % (i, lang.code)
                if lang_key in request.POST.keys() and request.POST[lang_key] != '':
                    try:
                        video = Video.objects.get(house_id = house_id)
                    except:
                        video = Video()
                        video.house_id = house_id
                        video.save()
                    cuepoint          = CuePoint()
                    cuepoint.video    = video
                    cuepoint.timecode = value
                    cuepoint.language = lang
                    cuepoint.name     = request.POST[lang_key]
                    cuepoint.save()

    status = http_POST_OK
    return TemplateResponse(request, 'cue_manager.html')
开发者ID:emilianobilli,项目名称:content-manager,代码行数:43,代码来源:views.py


注:本文中的models.Video.house_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。