Skip to content

Commit

Permalink
Merge pull request #19 from devsapp/check-object-exist
Browse files Browse the repository at this point in the history
add check object exist
  • Loading branch information
rsonghuster authored Jan 6, 2023
2 parents dae73b7 + 0af6a2f commit 1bf9096
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ffmpeg-app/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Type: Application
Name: ffmpeg-app
Version: 0.0.36
Version: 0.1.0
Provider:
- 阿里云
Description: 基于FFmpeg的音视频处理应用, 包括获取音视频元信息、获取音视频时长、音频转换、雪碧图生成、生成 GIF、打水印等多个模块。
Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/audio_convert/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 3600)
fileDir, shortname, extension = get_fileNameExt(object_key)

Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/get_duration/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

object_url = oss_client.sign_url('GET', object_key, 15 * 60)

cmd = ["ffprobe", "-show_entries", "format=duration",
Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/get_multimedia_meta/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

object_url = oss_client.sign_url('GET', object_key, 15 * 60)

raw_result = subprocess.check_output(["ffprobe", "-v", "quiet", "-show_format", "-show_streams",
Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/get_sprites/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 3600)
fileDir, shortname, extension = get_fileNameExt(object_key)

Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/video_gif/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 3600)
fileDir, shortname, extension = get_fileNameExt(object_key)
gif_path = os.path.join("/tmp", shortname + ".gif")
Expand Down
4 changes: 4 additions & 0 deletions ffmpeg-app/src/functions/video_watermark/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ def handler(event, context):
oss_client = oss2.Bucket(
auth, 'oss-%s-internal.aliyuncs.com' % context.region, oss_bucket_name)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 3600)
fileDir, shortname, extension = get_fileNameExt(object_key)
dst_video_path = os.path.join("/tmp", "watermark_" + shortname + extension)
Expand Down
2 changes: 1 addition & 1 deletion http-transcode/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Application
Name: http-video-transcode
Provider:
- 阿里云
Version: 0.0.9
Version: 0.0.10
Description: 快速部署音视频转码的应用到阿里云函数计算
HomePage: https://github.com/devsapp/start-ffmpeg
Tags:
Expand Down
4 changes: 4 additions & 0 deletions http-transcode/src/code/transcode/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def handler(environ, start_response):
# size = float(simplifiedmeta.headers['Content-Length'])
# M_size = round(size / 1024.0 / 1024.0, 2)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 6 * 3600)
# m3u8 特殊处理
rid = context.request_id
Expand Down
2 changes: 1 addition & 1 deletion transcode/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Type: Application
Name: video-transcode
Provider:
- 阿里云
Version: 0.0.17
Version: 0.0.18
Description: 快速部署音视频转码的应用到阿里云函数计算
HomePage: https://github.com/devsapp/start-ffmpeg/tree/master/transcode
Tags:
Expand Down
4 changes: 4 additions & 0 deletions transcode/src/code/transcode/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ def handler(event, context):
# size = float(simplifiedmeta.headers['Content-Length'])
# M_size = round(size / 1024.0 / 1024.0, 2)

exist = oss_client.object_exists(object_key)
if not exist:
raise Exception("object {} is not exist".format(object_key))

input_path = oss_client.sign_url('GET', object_key, 6 * 3600)
# m3u8 特殊处理
rid = context.request_id
Expand Down
4 changes: 3 additions & 1 deletion update.list
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
./headless-ffmpeg
./transcode
./http-transcode
./ffmpeg-app

0 comments on commit 1bf9096

Please sign in to comment.