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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efa9383e05431a1d58ca0e6b57c144f51ac0bf6d
4
- data.tar.gz: 187b0e1b61ef6ee338dda5659c70bbc3333777ad
3
+ metadata.gz: 78104ad0f5e08723d7e8e5e9c3337ee89a536003
4
+ data.tar.gz: 5825274cf26e5584a7a144b9148ff01fe8cac042
5
5
  SHA512:
6
- metadata.gz: d5e4f7c48107b3b25c64542684e3cb0b1ec48fd6fdeb6bf61affb2412b9501d3d02b78559e36ba244e7377626f5afa824598c8fea4a83c3cab85d1bbc904a927
7
- data.tar.gz: b150aee88ec711ab79da7567527482c1ebf9c32ac2c207950a52b09b9ace2b7935d4ec61873f7c99c600706fbe0556c2f1a6030b8d6a09dae9aacd7e40a02578
6
+ metadata.gz: 87f8db3bf58d9b74d1b2fbbe92b51f6ecc3f7d132f7783a1c08fa589c002f152055fff01ae4e90e8370049cc62a83a9ddccd0110a7de25890a36587152b3e5ff
7
+ data.tar.gz: e71a94ea567a7ef4da107bb30bff235e1eb9c6cb12ba7cb03d529dd709cb324b74e3e1c2bb4808ad87305f71ee4e8cb7ac0ff167311869b4f2c323c25345b64a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (1.0.4)
4
+ rest-ftp-daemon (1.0.5)
5
5
  activesupport (~> 4.2)
6
6
  api-auth
7
7
  aws-sdk-resources (~> 2)
@@ -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: {} do
121
- optional :option1, type: String, desc: "sample option", default: "my_value"
122
- end
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,
@@ -16,7 +16,7 @@ module RestFtpDaemon
16
16
  expose :dir
17
17
  expose :name
18
18
  expose :path
19
- expose :filepath
19
+ expose :path_fs
20
20
 
21
21
  expose :aws_region ,unless: Proc.new {|obj| obj.aws_region.nil?}
22
22
  expose :aws_bucket, unless: Proc.new {|obj| obj.aws_bucket.nil?}
@@ -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.path}] target[#{target.path}]"
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
@@ -135,7 +135,7 @@ module RestFtpDaemon
135
135
  out << '</span>'
136
136
  text = matches[2]
137
137
  else
138
- text = loc.path
138
+ text = loc.path_fs
139
139
  end
140
140
 
141
141
  # Add remaining stuff
@@ -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.filedir}"
68
- @remote.chdir_or_create @target_loc.filedir, @mkdir
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.filepath: #{@source_loc.filepath}"
16
- log_info "JobVideo.before target_loc.filepath: #{@target_loc.filepath}"
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.filepath [#{target_final.filepath}]"
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.filedir
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.path)
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.filepath, options) do |ffmpeg_progress|
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
- def filepath
64
- # "/#{path}"
65
- File.join('/', @dir.to_s, name.to_s)
63
+
64
+ def path_fs
65
+ '/' + path
66
66
  end
67
-
68
- def filedir
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
- local_file_path = filepath
84
- return unless File.exist? local_file_path
85
- return File.size local_file_path
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.filepath
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.filepath
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.filedir}]"
107
- @ftp.chdir dest.filedir
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.filepath}] [#{dest.name}]"
111
- @ftp.putbinaryfile source.filepath, dest.name, JOB_FTP_CHUNKMB do |data|
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.filepath, 'r', encoding: 'BINARY') do |file|
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.filepath
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.filepath
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.filepath, dest.filepath do |event, _uploader, *args|
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.filepath, target.filepath, flags
128
+ @sftp.rename! dest.path_fs, target.path_fs, flags
129
129
  end
130
130
 
131
131
  # progress:
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "1.0.4"
5
+ spec.version = "1.0.5"
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: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI