From 731b72146e589b837f785f2eccc9eec36d63dfd0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 10 Mar 2020 23:40:53 +0800 Subject: [PATCH 01/17] =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 19f611b3b..cad8cfbd9 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -30,7 +30,8 @@ class Videos::BatchPublishService < ApplicationService end # 标清转码为h264 - if AliyunVod::Service.get_meta_code_info(video.uuid).start_with?('h264', 'h265') + code_info = AliyunVod::Service.get_meta_code_info(video.uuid) + if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true #Rails.logger.info("####video.uuid:#{video.uuid}") #result = AliyunVod::Service.get_play_info(video.uuid) From 2a7b4896a7cd07c7afe3e3247046142eae672a2f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:04:19 +0800 Subject: [PATCH 02/17] =?UTF-8?q?=E6=92=AD=E6=94=BE=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E7=9A=84=E6=AF=8F=E5=A4=A9=E8=BD=AE=E8=AE=AD?= =?UTF-8?q?=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/get_video_data.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/get_video_data.rake b/lib/tasks/get_video_data.rake index 2a009790e..f6f85c7d5 100644 --- a/lib/tasks/get_video_data.rake +++ b/lib/tasks/get_video_data.rake @@ -62,7 +62,7 @@ namespace :video do end task :get_play_url => :environment do - Video.all.each do |video| + Video.where(play_url: nil).each do |video| result = AliyunVod::Service.get_play_info(video.uuid) rescue nil if result.present? && result["PlayInfoList"]["PlayInfo"].present? puts result From 9d24a593cb6d23bc1c7736c88f716f965fb2d8b9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:32:31 +0800 Subject: [PATCH 03/17] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 2 +- app/models/shixun.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 54eb19474..3f202c994 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -154,7 +154,7 @@ class ShixunsController < ApplicationController @can_fork = {can_fork: "已经职业认证的教师才能fork实训", certi_url: "/account/certification"} end - @current_myshixun = @shixun.current_myshixun(current_user) + @current_myshixun = @shixun.current_myshixun(current_user.id) if @shixun.fork_from fork_shixun = Shixun.select(:id, :user_id, :name, :identifier).where(id: @shixun.fork_from).first @fork_from = {name: fork_shixun.name, username: fork_shixun.owner.try(:full_name), diff --git a/app/models/shixun.rb b/app/models/shixun.rb index b9bd372b0..5caacebce 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -210,9 +210,8 @@ class Shixun < ApplicationRecord end # 当前用户开启的实训 - def current_myshixun(user) - return nil unless user.logged? - myshixuns.find_by(user_id: user.id) + def current_myshixun(user_id) + myshixuns.find_by(user_id: user_id) end # 实训技术平台 From 6285b9767a9ed9820e75de7c41aea0a43ce477f4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:33:56 +0800 Subject: [PATCH 04/17] =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index a2d34b6ef..01d19a433 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -22,8 +22,8 @@ module AliyunVod::Service::Base result rescue => ex - ::Util.logger_error(ex) raise AliyunVod::Error, ex.message + ::Util.logger_error(ex) end def base_params From df2b49948492834a7d7fa94337490b7fa73da6bf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:34:51 +0800 Subject: [PATCH 05/17] 1 --- app/libs/aliyun_vod/service/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 01d19a433..1233c65af 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -22,8 +22,9 @@ module AliyunVod::Service::Base result rescue => ex - raise AliyunVod::Error, ex.message ::Util.logger_error(ex) + raise AliyunVod::Error, ex.message + "" end def base_params From b1e006abc748aaebbd64d43ae03bcd0bee5e44a0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:36:16 +0800 Subject: [PATCH 06/17] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index 1233c65af..ebbcce694 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -23,8 +23,7 @@ module AliyunVod::Service::Base result rescue => ex ::Util.logger_error(ex) - raise AliyunVod::Error, ex.message - "" + #raise AliyunVod::Error, ex.message end def base_params From 221e7ed1f023f047a3ac1b1c5ac89a6f579bbc48 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 00:41:46 +0800 Subject: [PATCH 07/17] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/video_manage.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index 535f76546..ef8e707b3 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -40,6 +40,7 @@ module AliyunVod::Service::VideoManage rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" + "" end # 删除视频信息 From 2a258ac9fb293260993066880fdca8169a6bfa2c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:40:04 +0800 Subject: [PATCH 08/17] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 7 +++---- app/services/videos/dispatch_callback_service.rb | 4 +--- lib/gitlab-cli/.rakeTasks | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index cad8cfbd9..c47906192 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,10 +33,9 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true - #Rails.logger.info("####video.uuid:#{video.uuid}") - #result = AliyunVod::Service.get_play_info(video.uuid) - # Rails.logger.info("####video.result:#{result}") - #video.play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result + video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 2e3d85987..4ff94a1c4 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,9 +18,7 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.update!(cover_url: params['CoverUrl'], play_url: play_url) + video.update!(cover_url: params['CoverUrl']) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) diff --git a/lib/gitlab-cli/.rakeTasks b/lib/gitlab-cli/.rakeTasks index ea716fd52..f349995e9 100644 --- a/lib/gitlab-cli/.rakeTasks +++ b/lib/gitlab-cli/.rakeTasks @@ -4,4 +4,4 @@ You are allowed to: 1. Remove rake task 2. Add existing rake tasks To add existing rake tasks automatically delete this file and reload the project. ---><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to Rubygems" fullCmd="release" taksId="release" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /></RakeGroup></Settings> +--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build gitlab-3.2.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install gitlab-3.2.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install gitlab-3.2.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v3.2.0 and build and push gitlab-3.2.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings> From a1521276ed166cc834e113372641e62b4e51f5c9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:45:07 +0800 Subject: [PATCH 09/17] 1 --- app/services/videos/batch_publish_service.rb | 3 --- app/services/videos/dispatch_callback_service.rb | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index c47906192..18fa442d8 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,9 +33,6 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 4ff94a1c4..7d5f239c6 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,7 +18,9 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - video.update!(cover_url: params['CoverUrl']) + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result + video.update!(cover_url: params['CoverUrl'],play_url: play_url) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) From df6496556b495ea831830dedbec9cd3af100120d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 09:46:54 +0800 Subject: [PATCH 10/17] =?UTF-8?q?=E8=A7=86=E9=A2=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/aliyun_vod/service/base.rb | 1 + app/services/videos/batch_publish_service.rb | 3 +++ app/services/videos/dispatch_callback_service.rb | 4 +--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/libs/aliyun_vod/service/base.rb b/app/libs/aliyun_vod/service/base.rb index ebbcce694..f10f079b4 100644 --- a/app/libs/aliyun_vod/service/base.rb +++ b/app/libs/aliyun_vod/service/base.rb @@ -23,6 +23,7 @@ module AliyunVod::Service::Base result rescue => ex ::Util.logger_error(ex) + "" #raise AliyunVod::Error, ex.message end diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 18fa442d8..022098fd4 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -33,6 +33,9 @@ class Videos::BatchPublishService < ApplicationService code_info = AliyunVod::Service.get_meta_code_info(video.uuid) if code_info.present? && code_info.start_with?('h264', 'h265') video.transcoded = true + result = AliyunVod::Service.get_play_info(video.uuid) rescue nil + play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result.present? + video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) end diff --git a/app/services/videos/dispatch_callback_service.rb b/app/services/videos/dispatch_callback_service.rb index 7d5f239c6..4ff94a1c4 100644 --- a/app/services/videos/dispatch_callback_service.rb +++ b/app/services/videos/dispatch_callback_service.rb @@ -18,9 +18,7 @@ class Videos::DispatchCallbackService < ApplicationService video.save! when 'SnapshotComplete' then # 封面截图完成 return if video.cover_url.present? - result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result - video.update!(cover_url: params['CoverUrl'],play_url: play_url) + video.update!(cover_url: params['CoverUrl']) when 'StreamTranscodeComplete' then # 转码完成 #return if video.play_url.present? video.update!(play_url: params['FileUrl'], transcoded: true) From f340b54c614b3fbabeb8e8f7e5152a38900f5aa1 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Mar 2020 10:45:15 +0800 Subject: [PATCH 11/17] =?UTF-8?q?=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/user/usersInfo/video/VideoUploadList.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js index 3c053166a..2558e75fe 100644 --- a/public/react/src/modules/user/usersInfo/video/VideoUploadList.js +++ b/public/react/src/modules/user/usersInfo/video/VideoUploadList.js @@ -443,7 +443,7 @@ function VideoUploadList (props) { <div class="description "> <div>上传说明:目前不支持断点续传,单个视频文件最大限制500M,单次最多支持3个视频文件上传 </div> <div>视频规格:avi、flv、f4v、m4v、mov、mp4、rmvb、swf、webm </div> - <div>温馨提示:<span class="color-orange-tip">为了更好播放的体验,建议您优先上传MP4格式。如果您是自己录制视频,建议您保存的时候将视频编码设置为AVC(H264)</span></div></div> + <div>温馨提示:<span class="color-orange-tip">为了更好的播放体验,建议您优先上传MP4格式。如果您是自己录制视频,建议您保存的时候将视频编码设置为AVC(H264)</span></div></div> </div> {!noUploads && <React.Fragment> From 2caaf8c3469a564e8dce6dabef3eb8c9bacc84b7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:51:37 +0800 Subject: [PATCH 12/17] 1 --- app/libs/aliyun_vod/service/video_manage.rb | 9 ++++++--- app/services/videos/batch_publish_service.rb | 7 ++++--- lib/tasks/video_transcode.rake | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index ef8e707b3..d93a0f5ef 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -26,7 +26,7 @@ module AliyunVod::Service::VideoManage result end - # 读取视频编码格式 + # 读取视频编码格式与视频格式 def get_meta_code_info(video_id) params = { Action: 'GetMezzanineInfo', @@ -36,11 +36,14 @@ module AliyunVod::Service::VideoManage result = request(:post, params) Rails.logger.info("#######:#{result['Mezzanine']['VideoStreamList'][0]['CodecName']}") - result['Mezzanine']['VideoStreamList'][0]['CodecName'] + codecnamne = result['Mezzanine']['VideoStreamList'].first['CodecName'] + file_url = result['Mezzanine']['FileURL'] + format = file_url&.split(".")&.last + {codecnamne: codecnamne, format: format} rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" - "" + [codecnamne: "", format: ""] end # 删除视频信息 diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 022098fd4..20ce4ac32 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -29,12 +29,13 @@ class Videos::BatchPublishService < ApplicationService video.status = "published" end - # 标清转码为h264 + # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - if code_info.present? && code_info.start_with?('h264', 'h265') + Rails.logger.info("code_info: #{ode_info['format']}, #{code_info['codecnamne']}") + if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil - play_url = result['PlayInfoList']['PlayInfo'][0]['PlayURL'] if result.present? + play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present? video.play_url = play_url else AliyunVod::Service.submit_transcode_job(video.uuid, Video::NORMAL_TRANSCODE_GROUP_ID) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index 955905632..a14b5bf8b 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid).start_with?("h264", "h265") + if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)['codecnamne'].start_with?("h264", "h265") p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else From a587961744d6a812c8975e7cb44403c5466a95e7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:54:19 +0800 Subject: [PATCH 13/17] 1 --- app/services/videos/batch_publish_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 20ce4ac32..d0b5e8cef 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,7 +31,7 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - Rails.logger.info("code_info: #{ode_info['format']}, #{code_info['codecnamne']}") + Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil From 828dbae5d883a46c0a8b904df8f0c1573d58131a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:57:21 +0800 Subject: [PATCH 14/17] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index d0b5e8cef..697d9df7e 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,7 +31,10 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) + Rails.logger.info("code_info: #{code_info}") Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") + Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") + return if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil From ace5effc7832c77e3d48803cedd567a3f45f6ea7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:58:33 +0800 Subject: [PATCH 15/17] =?UTF-8?q?=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/videos/batch_publish_service.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/app/services/videos/batch_publish_service.rb b/app/services/videos/batch_publish_service.rb index 697d9df7e..553ffe4f2 100644 --- a/app/services/videos/batch_publish_service.rb +++ b/app/services/videos/batch_publish_service.rb @@ -31,11 +31,8 @@ class Videos::BatchPublishService < ApplicationService # 非MP4 H264编码的都转码 code_info = AliyunVod::Service.get_meta_code_info(video.uuid) - Rails.logger.info("code_info: #{code_info}") - Rails.logger.info("code_info: #{code_info['format']}, #{code_info['codecnamne']}") Rails.logger.info("code_info: #{code_info[:format]}, #{code_info[:codecnamne]}") - return - if code_info['format'] == "mp4" && code_info['codecnamne'].present? && code_info['codecnamne'].start_with?('h264') + if code_info[:format] == "mp4" && code_info[:codecnamne].present? && code_info[:codecnamne].start_with?('h264') video.transcoded = true result = AliyunVod::Service.get_play_info(video.uuid) rescue nil play_url = result['PlayInfoList']['PlayInfo'].first['PlayURL'] if result.present? From b751a79b06157a961535ea77994ef50905cbb645 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 11:58:58 +0800 Subject: [PATCH 16/17] =?UTF-8?q?=E6=94=B9=E5=8F=98=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/video_transcode.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/video_transcode.rake b/lib/tasks/video_transcode.rake index a14b5bf8b..995f9a82f 100644 --- a/lib/tasks/video_transcode.rake +++ b/lib/tasks/video_transcode.rake @@ -3,7 +3,7 @@ namespace :video_transcode do desc "视频转码成h264" task :submit => :environment do Video.find_each do |v| - if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)['codecnamne'].start_with?("h264", "h265") + if v.uuid && !v.transcoded && !v.file_url.include?('.mp4') && !AliyunVod::Service.get_meta_code_info(v.uuid)[:codecnamne].start_with?("h264", "h265") p "--- Start submit video trans code #{v.uuid}" AliyunVod::Service.submit_transcode_job(v.uuid, 'a0277c5c0c7458458e171b0cee6ebf5e') else From e466aafa95939c2f726089bc7dfb0de975a658ce Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 11 Mar 2020 12:12:08 +0800 Subject: [PATCH 17/17] 1 --- app/libs/aliyun_vod/service/video_manage.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/libs/aliyun_vod/service/video_manage.rb b/app/libs/aliyun_vod/service/video_manage.rb index d93a0f5ef..f80f31788 100644 --- a/app/libs/aliyun_vod/service/video_manage.rb +++ b/app/libs/aliyun_vod/service/video_manage.rb @@ -43,7 +43,7 @@ module AliyunVod::Service::VideoManage {codecnamne: codecnamne, format: format} rescue => e Rails.logger.info "读取视频编码信息失败: #{video_id}, #{e.message}" - [codecnamne: "", format: ""] + {codecnamne: "", format: ""} end # 删除视频信息