本文整理汇总了Python中models.Video.status方法的典型用法代码示例。如果您正苦于以下问题:Python Video.status方法的具体用法?Python Video.status怎么用?Python Video.status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Video
的用法示例。
在下文中一共展示了Video.status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import status [as 别名]
def post(self):
parse_args = video_parser.parse_args()
new_video = Video()
new_video.title = parse_args['title']
new_video.type = 'LIVE'
new_video.status = 'EMPTY'
new_video.created_at = datetime.now()
new_video.segment_count = -1
new_video.segment_duration = 3000
new_video.repr_1 = Reprs.HIGH
new_video.repr_2 = Reprs.MEDIUM
new_video.repr_3 = Reprs.LOW
new_video.uri_mpd = None
new_video.uri_m3u8 = None
try:
session.add(new_video)
session.commit()
except:
session.rollback()
raise
return new_video, 201
示例2: _process_fullcopy
# 需要导入模块: from models import Video [as 别名]
# 或者: from models.Video import status [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)