courseware
anke1460 5 years ago
parent 1e84cf48af
commit 81de792408

@ -45,7 +45,7 @@ class Videos::BatchPublishService < ApplicationService
end end
if result.present? if result.present?
video.duration = result["VideoBase"]["Duration"] if result["VideoBase"]["Duration"] video.duration = result['PlayInfoList']['PlayInfo'][0]['Duration'] if result['PlayInfoList']['PlayInfo'][0]['Duration'].present?
end end
video.save! video.save!

@ -80,9 +80,9 @@ namespace :video do
videos = Video.published.where("duration = 0") videos = Video.published.where("duration = 0")
videos.find_each do |v| videos.find_each do |v|
result = AliyunVod::Service.get_play_info(v.uuid) result = AliyunVod::Service.get_play_info(v.uuid)
if result.present? && result["VideoBase"]["Duration"].present? if result.present? && result['PlayInfoList']['PlayInfo'][0]['Duration'].present?
p '-----#{v.id} , #{result["VideoBase"]["Duration"]]}' p "-----#{v.id} , #{result['PlayInfoList']['PlayInfo'][0]['Duration']}"
v.update(duration: result["VideoBase"]["Duration"]) v.update(duration: result['PlayInfoList']['PlayInfo'][0]['Duration'])
end end
end end

Loading…
Cancel
Save