本文整理汇总了Python中models.Video.update方法的典型用法代码示例。如果您正苦于以下问题:Python Video.update方法的具体用法?Python Video.update怎么用?Python Video.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Video
的用法示例。
在下文中一共展示了Video.update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _process_fullcopy
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import update [as 别名]
def _process_fullcopy(key):
# Set the content-type correctly
bucket = helper.get_bucket()
k = bucket.lookup(key)
k.copy(k.bucket, k.name, preserve_acl=True, metadata={'Content-Type': helper.get_mimetype(k.name)})
orig_video = Video(key=key, status='downloading')
db.add(orig_video)
db.commit()
url = helper.get_s3url(key)
orig_path = download_url(url)
orig_video.update(get_video_attrs(orig_path))
orig_video.status = 'done'
for preset in FFMPEG_PRESETS.iterkeys():
# Transcode/Upload based on ffmpeg preset
iphone_path = os.path.splitext(orig_path)[0] + preset
iphone_video = Video(key=os.path.basename(iphone_path), status='transcoding')
db.add(iphone_video)
db.commit()
try:
make_iphone(orig_path, iphone_path, preset)
iphone_video.update(get_video_attrs(iphone_path))
except:
iphone_video.status = 'transcoding error'
else:
iphone_video.status = 'uploading'
db.commit()
if iphone_video.status == 'uploading':
upload_to_s3(iphone_path)
iphone_video.status = 'done'
db.commit()
os.remove(iphone_path)
os.remove(orig_path)