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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rest-ftp-daemon/api/jobs.rb +6 -2
- data/lib/rest-ftp-daemon/constants.rb +2 -0
- data/lib/rest-ftp-daemon/job.rb +2 -2
- data/lib/rest-ftp-daemon/jobs/video.rb +14 -12
- data/rest-ftp-daemon.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b007f413aeb958a7261cf4b52ab1cc55e5090295
|
4
|
+
data.tar.gz: a632d6c795c89047868b080308fdefc458887ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 004961d712ba67aff69de7732f5d9bfb04ca66783860185670784498e400502704440e44b4c1368d4f652328ba3ad948f7ec8b37543536d4211c3674f5bd5e78
|
7
|
+
data.tar.gz: 949d07757d921d4d6da41f5f67e7418de536d0e44c04673629b087585724105659e94709ab20178cf34166c017b83a7e265e7aee15391d18e910962ed37497b8
|
data/Gemfile.lock
CHANGED
@@ -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"
|
data/lib/rest-ftp-daemon/job.rb
CHANGED
@@ -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
|
-
:
|
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
|
-
|
68
|
-
|
69
|
-
|
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
|
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 = []
|
data/rest-ftp-daemon.gemspec
CHANGED