rest-ftp-daemon 0.421.1 → 0.422.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d5d765b823e1d4589ad7fba0f723c08d08b901d
4
- data.tar.gz: 9bb488ac0efa76a77a9d2daa006f39e83817065b
3
+ metadata.gz: b007f413aeb958a7261cf4b52ab1cc55e5090295
4
+ data.tar.gz: a632d6c795c89047868b080308fdefc458887ed3
5
5
  SHA512:
6
- metadata.gz: a4a3790911b1e135fd0c217298a0440dbdf60bf605125e0f10f35fe9a70504b670a5b28f4ad7b989da0ac3f00737b44e30309e2615220287f655688977c5fc09
7
- data.tar.gz: f9fb6bafae5b584f849f6ee403dcceeec684e5ec9d785a56b0dbfb38b290dfd580d48a568a520990816c2302f954cabea83c60911e36fcee4bc1272d701265dc
6
+ metadata.gz: 004961d712ba67aff69de7732f5d9bfb04ca66783860185670784498e400502704440e44b4c1368d4f652328ba3ad948f7ec8b37543536d4211c3674f5bd5e78
7
+ data.tar.gz: 949d07757d921d4d6da41f5f67e7418de536d0e44c04673629b087585724105659e94709ab20178cf34166c017b83a7e265e7aee15391d18e910962ed37497b8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (0.421.1)
4
+ rest-ftp-daemon (0.422.0)
5
5
  activesupport (~> 4.2)
6
6
  api-auth
7
7
  aws-sdk-resources (~> 2)
@@ -82,6 +82,11 @@ module RestFtpDaemon
82
82
  type: String,
83
83
  desc: "video: audio codec",
84
84
  default: nil
85
+
86
+ optional :video_options,
87
+ type: Hash,
88
+ desc: "Video: standard options passed to FFMPEG encoder",
89
+ default: {}
85
90
  optional :video_custom,
86
91
  type: Hash,
87
92
  desc: "video: custom options passed to FFMPEG encoder",
@@ -99,8 +104,7 @@ module RestFtpDaemon
99
104
  type: Boolean,
100
105
  desc: "Upload to a temp file before renaming it to the target filename",
101
106
  default: Conf.at(:transfer, :tempfile)
102
- # optional :options, desc: "", type: API::Entities::Options
103
-
107
+ # optional :options, desc: "Options passed to FFMPEG (video jobs)", type: API::Entities::Options
104
108
  end
105
109
 
106
110
  post "/" do
@@ -13,7 +13,9 @@ JOB_RANDOM_LEN = 8
13
13
  JOB_IDENT_LEN = 4
14
14
  JOB_TEMPFILE_LEN = 8
15
15
  JOB_UPDATE_INTERVAL = 1
16
+
16
17
  JOB_FFMPEG_THREADS = 2
18
+ JOB_FFMPEG_ATTRIBUTES = [:video_codec, :video_bitrate, :video_bitrate_tolerance, :frame_rate, :resolution, :aspect, :keyframe_interval, :x264_vprofile, :x264_preset, :audio_codec, :audio_bitrate, :audio_sample_rate, :audio_channels]
17
19
 
18
20
  # Constants: logger
19
21
  LOG_ROTATION = "daily"
@@ -17,7 +17,7 @@ module RestFtpDaemon
17
17
  # Class constants
18
18
  FIELDS = [:type, :source, :target, :label, :priority, :pool, :notify,
19
19
  :overwrite, :mkdir, :tempfile,
20
- :video_vc, :video_ac, :video_custom,
20
+ :video_options, :video_custom
21
21
  ]
22
22
 
23
23
  # Class options
@@ -253,7 +253,7 @@ module RestFtpDaemon
253
253
 
254
254
  # Add each field to @infos
255
255
  fields.each do |what|
256
- set_info prefix, what, location.send(what)
256
+ set_info prefix, "loc_#{what}".to_sym, location.send(what)
257
257
  end
258
258
  end
259
259
 
@@ -59,27 +59,30 @@ module RestFtpDaemon
59
59
 
60
60
  # Read info about source file
61
61
  movie = FFMPEG::Movie.new(source.path)
62
+ set_info :source, :ffmpeg_size, movie.size
63
+ set_info :source, :ffmpeg_duration, movie.duration
64
+ set_info :source, :ffmpeg_resolution, movie.resolution
65
+
66
+
67
+
62
68
 
63
69
  # Build options
64
70
  options = {
65
- threads: JOB_FFMPEG_THREADS
71
+ threads: JOB_FFMPEG_THREADS,
72
+ custom: options_from(@video_custom)
66
73
  }
67
- options[:audio_codec] = @video_ac unless @video_ac.to_s.empty?
68
- options[:video_codec] = @video_vc unless @video_vc.to_s.empty?
69
- options[:custom] = options_from(@video_custom) if @video_custom.is_a? Hash
70
-
74
+ JOB_FFMPEG_ATTRIBUTES.each do |name|
75
+ options[name] = @video_options[name] unless @video_options[name].nil?
76
+ end
71
77
  set_info :work, :ffmpeg_options, options
72
78
 
73
- # Announce contexte
79
+ # Announce context
74
80
  log_info "JobVideo.ffmpeg_command [#{FFMPEG.ffmpeg_binary}] [#{source.name}] > [#{target.name}]", options
75
81
 
76
82
  # Build command
77
83
  movie.transcode(target.path, options) do |ffmpeg_progress|
78
- set_info :work, :ffmpeg_progress, ffmpeg_progress
79
-
80
- percent0 = (100.0 * ffmpeg_progress).round(0)
81
- set_info :work, :progress, percent0
82
-
84
+ # set_info :work, :ffmpeg_progress, ffmpeg_progress
85
+ set_info :work, :progress, (100.0 * ffmpeg_progress).round(1)
83
86
  log_debug "progress #{ffmpeg_progress}"
84
87
  end
85
88
  end
@@ -87,7 +90,6 @@ module RestFtpDaemon
87
90
  def options_from attributes
88
91
  # Ensure options ar in the correct format
89
92
  return [] unless attributes.is_a? Hash
90
- # video_custom_parts = @video_custom.to_s.scan(/(?:\w|"[^"]*")+/)
91
93
 
92
94
  # Build the final array
93
95
  custom_parts = []
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "0.421.1"
5
+ spec.version = "0.422.0"
6
6
 
7
7
  # Project description
8
8
  spec.name = "rest-ftp-daemon"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-ftp-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.421.1
4
+ version: 0.422.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI