gpt4 book ai didi

ruby-on-rails - 在后台转换视频 ROR 3

转载 作者:行者123 更新时间:2023-12-04 23:04:32 27 4
gpt4 key购买 nike

我在谷歌上搜索了一下,只找到了一个网站来解释如何做到这一点:http://railsonedge.blogspot.com/2009/01/flash-video-tutorial-with-rails-ffmpeg.html?m=0我已经在使用回形针并且已经用它设置了所有东西并且喜欢使用它比这个网站的方式更好。有没有办法在使用回形针跟踪视频状态的同时在后台转换视频?我的 Video.rb 目前:

class Video < ActiveRecord::Base
belongs_to :user
has_many :comments, dependent: :destroy
attr_accessible :video, :user_id, :video_file_name, :title, :public, :description, :views

has_attached_file :video, :styles => {
:video => { geometry: "800x480>", format: 'webm' },
:thumb => { geometry: "200x200>", format: 'png', time: 3 },
}, processors: [:ffmpeg], url: "/users/:user_id/videos/:id/:basename_:style.:extension"

#process_in_background :video #causes death

validates :video, presence: true
validates :description, presence: true, length: { minimum: 5, maximum: 100}
validates :title, presence: true, length: { minimum: 1, maximum: 15 }

validates_attachment_size :video, less_than: 1.gigabytes
validates_attachment :video, presence: true

default_scope order: 'created_at DESC'

Paperclip.interpolates :user_id do |attachment, style|attachment.instance.user_id
end

def self.search(search)
if search
find(:all, conditions: ["public = 't' AND title LIKE ?", "%#{search}%"], order: "created_at DESC")
else
find(:all, conditions: ["public = 't'"], order: "created_at DESC")
end
end

def self.admin_search(search)
if search
find(:all, conditions: ['title LIKE ?', "%#{search}%"], order: "created_at DESC")
else
find(:all, order: "created_at DESC")
end
end

end

最佳答案

首先check this answer .对于您要使用的后台作业sidekiq .您将需要处理转换的方法。您将在 sidekiq 的#perform 中调用该方法。在此方法中,您还可以更改状态(只需更改字符串字段值)。

关于ruby-on-rails - 在后台转换视频 ROR 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12683795/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com