rest-ftp-daemon 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rest-ftp-daemon/api/jobs.rb +5 -3
- data/lib/rest-ftp-daemon/entities/location.rb +1 -1
- data/lib/rest-ftp-daemon/helpers/transfer.rb +1 -1
- data/lib/rest-ftp-daemon/helpers/views.rb +1 -1
- data/lib/rest-ftp-daemon/jobs/transfer.rb +2 -2
- data/lib/rest-ftp-daemon/jobs/video.rb +6 -6
- data/lib/rest-ftp-daemon/location.rb +9 -9
- data/lib/rest-ftp-daemon/remote/ftp.rb +6 -6
- data/lib/rest-ftp-daemon/remote/s3.rb +1 -1
- data/lib/rest-ftp-daemon/remote/sftp.rb +4 -4
- 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: 78104ad0f5e08723d7e8e5e9c3337ee89a536003
|
4
|
+
data.tar.gz: 5825274cf26e5584a7a144b9148ff01fe8cac042
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f8db3bf58d9b74d1b2fbbe92b51f6ecc3f7d132f7783a1c08fa589c002f152055fff01ae4e90e8370049cc62a83a9ddccd0110a7de25890a36587152b3e5ff
|
7
|
+
data.tar.gz: e71a94ea567a7ef4da107bb30bff235e1eb9c6cb12ba7cb03d529dd709cb324b74e3e1c2bb4808ad87305f71ee4e8cb7ac0ff167311869b4f2c323c25345b64a
|
data/Gemfile.lock
CHANGED
@@ -117,9 +117,11 @@ module RestFtpDaemon
|
|
117
117
|
optional :audio_channels, type: String, desc: "number of audio channels"
|
118
118
|
end
|
119
119
|
|
120
|
-
optional :video_custom, type: Hash, desc: "video: custom options passed to FFMPEG encoder", default: {}
|
121
|
-
|
122
|
-
|
120
|
+
optional :video_custom, type: Hash, desc: "video: custom options passed to FFMPEG encoder", default: {},
|
121
|
+
documentation: { hidden: false }
|
122
|
+
# do
|
123
|
+
# optional :option1, type: String, desc: "sample option", default: "my_value"
|
124
|
+
# end
|
123
125
|
|
124
126
|
optional :options, type: Hash, desc: "Options for transfers" do
|
125
127
|
optional :overwrite,
|
@@ -8,7 +8,7 @@ module RestFtpDaemon
|
|
8
8
|
raise RestFtpDaemon::AssertionFailed, "remote_upload/target" if target.nil?
|
9
9
|
|
10
10
|
# Use source filename if target path provided none (typically with multiple sources)
|
11
|
-
log_info "remote_upload temp[#{@tempfile}] source[#{source.
|
11
|
+
log_info "remote_upload temp[#{@tempfile}] source[#{source.path_fs}] target[#{target.path}]"
|
12
12
|
set_info INFO_SOURCE_CURRENT, source.name
|
13
13
|
|
14
14
|
# Remove any existing version if present, or check if it's there
|
@@ -64,8 +64,8 @@ module RestFtpDaemon
|
|
64
64
|
|
65
65
|
# Prepare target path or build it if asked
|
66
66
|
set_status JOB_STATUS_CHDIR
|
67
|
-
#log_info "do_work chdir_or_create #{@target_loc.
|
68
|
-
@remote.chdir_or_create @target_loc.
|
67
|
+
#log_info "do_work chdir_or_create #{@target_loc.dir_fs}"
|
68
|
+
@remote.chdir_or_create @target_loc.dir_fs, @mkdir
|
69
69
|
|
70
70
|
# Compute total files size
|
71
71
|
@transfer_total = sources.collect(&:size).sum
|
@@ -12,8 +12,8 @@ module RestFtpDaemon
|
|
12
12
|
|
13
13
|
# Process job
|
14
14
|
def do_before
|
15
|
-
log_info "JobVideo.before source_loc.
|
16
|
-
log_info "JobVideo.before target_loc.
|
15
|
+
log_info "JobVideo.before source_loc.path_fs: #{@source_loc.path_fs}"
|
16
|
+
log_info "JobVideo.before target_loc.path_fs: #{@target_loc.path_fs}"
|
17
17
|
|
18
18
|
# Ensure FFMPEG lib is available
|
19
19
|
check_ffmpeg_binary :ffprobe_binary
|
@@ -35,10 +35,10 @@ module RestFtpDaemon
|
|
35
35
|
# Add the source file name if none found in the target path
|
36
36
|
target_final = @target_loc.clone
|
37
37
|
target_final.name = @source_loc.name unless target_final.name
|
38
|
-
log_info "JobVideo.work target_final.
|
38
|
+
log_info "JobVideo.work target_final.path_fs [#{target_final.path_fs}]"
|
39
39
|
|
40
40
|
# Ensure target directory exists
|
41
|
-
t_dir = @target_loc.
|
41
|
+
t_dir = @target_loc.dir_fs
|
42
42
|
log_info "JobVideo.work mkdir_p [#{t_dir}]"
|
43
43
|
FileUtils.mkdir_p t_dir
|
44
44
|
|
@@ -59,7 +59,7 @@ module RestFtpDaemon
|
|
59
59
|
# Read info about source file
|
60
60
|
set_info INFO_SOURCE_CURRENT, source.name
|
61
61
|
begin
|
62
|
-
movie = FFMPEG::Movie.new(source.
|
62
|
+
movie = FFMPEG::Movie.new(source.path_fs)
|
63
63
|
rescue Errno::ENOENT => exception
|
64
64
|
raise RestFtpDaemon::VideoNotFound, exception.message
|
65
65
|
rescue StandardError => exception
|
@@ -85,7 +85,7 @@ module RestFtpDaemon
|
|
85
85
|
log_info "JobVideo.ffmpeg_command [#{FFMPEG.ffmpeg_binary}] [#{source.name}] > [#{target.name}]", options
|
86
86
|
|
87
87
|
# Build command
|
88
|
-
movie.transcode(target.
|
88
|
+
movie.transcode(target.path_fs, options) do |ffmpeg_progress|
|
89
89
|
# set_info :work, :ffmpeg_progress, ffmpeg_progress
|
90
90
|
set_info INFO_TRANFER_PROGRESS, (100.0 * ffmpeg_progress).round(1)
|
91
91
|
log_info "progress #{ffmpeg_progress}"
|
@@ -60,13 +60,12 @@ module RestFtpDaemon
|
|
60
60
|
def path
|
61
61
|
File.join(@dir.to_s, name.to_s)
|
62
62
|
end
|
63
|
-
|
64
|
-
|
65
|
-
|
63
|
+
|
64
|
+
def path_fs
|
65
|
+
'/' + path
|
66
66
|
end
|
67
|
-
|
68
|
-
|
69
|
-
"/#{@dir}"
|
67
|
+
def dir_fs
|
68
|
+
'/' + @dir
|
70
69
|
end
|
71
70
|
|
72
71
|
def local_files
|
@@ -80,9 +79,10 @@ module RestFtpDaemon
|
|
80
79
|
|
81
80
|
def size
|
82
81
|
return unless uri.is_a? URI::FILE
|
83
|
-
|
84
|
-
|
85
|
-
return File.
|
82
|
+
|
83
|
+
local_file_path = path_fs
|
84
|
+
return unless File.exist? path_fs
|
85
|
+
return File.size path_fs
|
86
86
|
end
|
87
87
|
|
88
88
|
def generate_temp_name!
|
@@ -34,7 +34,7 @@ module RestFtpDaemon
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def size_if_exists target
|
37
|
-
size = @ftp.size target.
|
37
|
+
size = @ftp.size target.path_fs
|
38
38
|
log_debug "size_if_exists [#{target.name}]"
|
39
39
|
|
40
40
|
rescue Net::FTPPermError
|
@@ -44,7 +44,7 @@ module RestFtpDaemon
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def remove! target
|
47
|
-
@ftp.delete target.
|
47
|
+
@ftp.delete target.path_fs
|
48
48
|
rescue Net::FTPPermError
|
49
49
|
log_debug "remove! [#{target.name}] not found"
|
50
50
|
else
|
@@ -103,12 +103,12 @@ module RestFtpDaemon
|
|
103
103
|
end
|
104
104
|
|
105
105
|
# Move to the directory
|
106
|
-
log_debug "upload chdir [#{dest.
|
107
|
-
@ftp.chdir dest.
|
106
|
+
log_debug "upload chdir [#{dest.dir_fs}]"
|
107
|
+
@ftp.chdir dest.dir_fs
|
108
108
|
|
109
109
|
# Do the transfer
|
110
|
-
log_debug "upload putbinaryfile [#{source.
|
111
|
-
@ftp.putbinaryfile source.
|
110
|
+
log_debug "upload putbinaryfile [#{source.path_fs}] [#{dest.name}]"
|
111
|
+
@ftp.putbinaryfile source.path_fs, dest.name, JOB_FTP_CHUNKMB do |data|
|
112
112
|
# Update job status after this block transfer
|
113
113
|
yield data.bytesize, dest.name
|
114
114
|
end
|
@@ -42,7 +42,7 @@ module RestFtpDaemon
|
|
42
42
|
log_debug "upload bucket[#{target.aws_bucket}] path[#{target.path}]"
|
43
43
|
|
44
44
|
# Do the transfer, passing the file to the best method
|
45
|
-
File.open(source.
|
45
|
+
File.open(source.path_fs, 'r', encoding: 'BINARY') do |file|
|
46
46
|
if file.size >= JOB_S3_MIN_PART
|
47
47
|
upload_multipart file, target.aws_bucket, target.path, target.name, &callback
|
48
48
|
else
|
@@ -32,7 +32,7 @@ module RestFtpDaemon
|
|
32
32
|
|
33
33
|
def size_if_exists target
|
34
34
|
log_debug "size_if_exists [#{target.name}]"
|
35
|
-
stat = @sftp.stat! target.
|
35
|
+
stat = @sftp.stat! target.path_fs
|
36
36
|
|
37
37
|
rescue Net::SFTP::StatusException
|
38
38
|
return false
|
@@ -42,7 +42,7 @@ module RestFtpDaemon
|
|
42
42
|
|
43
43
|
def remove! target
|
44
44
|
log_debug "remove! [#{target.name}]"
|
45
|
-
@sftp.remove target.
|
45
|
+
@sftp.remove target.path_fs
|
46
46
|
|
47
47
|
rescue Net::SFTP::StatusException
|
48
48
|
log_debug "#{LOG_INDENT}[#{target.name}] file not found"
|
@@ -99,7 +99,7 @@ module RestFtpDaemon
|
|
99
99
|
|
100
100
|
# Do the transfer
|
101
101
|
log_debug "upload temp[#{use_temp_name}] name[#{dest.name}]"
|
102
|
-
@sftp.upload! source.
|
102
|
+
@sftp.upload! source.path_fs, dest.path_fs do |event, _uploader, *args|
|
103
103
|
case event
|
104
104
|
when :open then
|
105
105
|
# args[0] : file metadata
|
@@ -125,7 +125,7 @@ module RestFtpDaemon
|
|
125
125
|
if use_temp_name
|
126
126
|
flags = 0x00000001
|
127
127
|
log_debug "upload rename [#{dest.name}] > [#{target.name}]"
|
128
|
-
@sftp.rename! dest.
|
128
|
+
@sftp.rename! dest.path_fs, target.path_fs, flags
|
129
129
|
end
|
130
130
|
|
131
131
|
# progress:
|
data/rest-ftp-daemon.gemspec
CHANGED