lib/rest-ftp-daemon/api/jobs.rb in rest-ftp-daemon-0.422.0 vs lib/rest-ftp-daemon/api/jobs.rb in rest-ftp-daemon-0.423.0
- old
+ new
@@ -31,11 +31,11 @@
log_error "Exception: #{exception.message}"
error!({ error: :api_exception, message: exception.message }, 500)
else
status 200
- present job, with: RestFtpDaemon::API::Entities::Job, type: "complete"
+ present job, with: RestFtpDaemon::Entities::Job, type: "complete"
end
end
desc "List all Jobs", http_codes: [
@@ -51,44 +51,59 @@
log_error "Exception: #{exception.message}"
error!({ error: :api_exception, message: exception.message }, 500)
else
status 200
- present jobs, with: RestFtpDaemon::API::Entities::Job
+ present jobs, with: RestFtpDaemon::Entities::Job
end
end
desc "Create a new job"
params do
requires :source, type: String, desc: "Source file pattern"
requires :target, type: String, desc: "Target remote path"
- optional :label, type: String, desc: "Descriptive label for this job"
+ optional :label, type: String, desc: "Descriptive label (info only)"
optional :notify, type: String, desc: "URL to get POST'ed notifications back"
- optional :priority, type: Integer, desc: "Priority level of the job (lower is stronger)"
- optional :pool, type: String, desc: "Pool of worker to be used"
optional :type,
type: String,
desc: "Type of job",
default: JOB_TYPE_TRANSFER,
values: {value: JOB_TYPES, message: "should be one of: #{JOB_TYPES.join', '}"},
allow_blank: { value: false, message: 'cannot be empty' }
-
- optional :video_vc,
+ optional :pool,
type: String,
- desc: "video: video codec",
- default: nil
- optional :video_ac,
- type: String,
- desc: "video: audio codec",
- default: nil
+ desc: "Pool of worker to be used",
+ default: DEFAULT_POOL
+ optional :priority,
+ type: Integer,
+ desc: "Priority level of the job (lower is stronger)",
+ default: 0
- optional :video_options,
- type: Hash,
- desc: "Video: standard options passed to FFMPEG encoder",
- default: {}
+ # optional :video_options,
+ # type: Hash,
+ # type: Entities::VideoOptions,
+ # desc: "Video: standard options passed to FFMPEG encoder",
+ # default: {}
+
+ optional :video_options, type: Hash, desc: "Options passed to FFMPEG encoder" do
+ optional :video_codec, type: String
+ optional :video_bitrate, type: String
+ optional :video_bitrate_tolerance, type: String
+ optional :frame_rate, type: Integer
+ optional :resolution, type: String
+ optional :aspect, type: String
+ optional :keyframe_interval, type: String
+ optional :x264_vprofile, type: String
+ optional :x264_preset, type: String
+ optional :audio_codec, type: String
+ optional :audio_bitrate, type: String
+ optional :audio_sample_rate, type: Integer
+ optional :audio_channels, type: String
+ end
+
optional :video_custom,
type: Hash,
desc: "video: custom options passed to FFMPEG encoder",
default: {}
@@ -102,11 +117,10 @@
default: Conf.at(:transfer, :mkdir)
optional :tempfile,
type: Boolean,
desc: "Upload to a temp file before renaming it to the target filename",
default: Conf.at(:transfer, :tempfile)
- # optional :options, desc: "Options passed to FFMPEG (video jobs)", type: API::Entities::Options
end
post "/" do
# log_debug params.to_json
begin
@@ -128,10 +142,10 @@
log_error "#{exception.class.to_s} #{exception.message}"
error!({error: exception_to_error(exception), message: exception.message}, 500)
else
status 201
- present job, with: RestFtpDaemon::API::Entities::Job, hide_params: true
+ present job, with: RestFtpDaemon::Entities::Job, hide_params: true
end
end
end