Fix bug.
This commit is contained in:
parent
c3cfada5d7
commit
bf6234cdbc
|
@ -1,7 +1,8 @@
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
get 'ad_banners/widget'
|
get 'ad_banners/widget'
|
||||||
Thread.new do
|
if ENV['worker_num']=='0' && File.basename($0) != 'rake' && !Rails.const_defined?('Console')
|
||||||
|
Thread.new do
|
||||||
ad_images = AdImage.where(:video_file.ne=>nil,:video_snapshot=>nil).to_a
|
ad_images = AdImage.where(:video_file.ne=>nil,:video_snapshot=>nil).to_a
|
||||||
ad_images.each do |ad_image|
|
ad_images.each do |ad_image|
|
||||||
ad_image[:video_snapshot] = File.basename(ad_image.video_file.file.path).split(/\.[^.]+$/)[0] + ".jpg"
|
ad_image[:video_snapshot] = File.basename(ad_image.video_file.file.path).split(/\.[^.]+$/)[0] + ".jpg"
|
||||||
|
@ -9,6 +10,7 @@ Thread.new do
|
||||||
system("tmp/ffmpeg/ffmpeg -i #{ad_image.video_file.file.path} -vframes 1 #{ad_image.video_snapshot.file.path}")
|
system("tmp/ffmpeg/ffmpeg -i #{ad_image.video_file.file.path} -vframes 1 #{ad_image.video_snapshot.file.path}")
|
||||||
ad_image.save
|
ad_image.save
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
locales = Site.find_by(site_active: true).in_use_locales rescue I18n.available_locales
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue