phoseum-cli 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/phoseum-cli +11 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dcb29425ea8aa603aa478db7af70a3606f0db955c74a3f333299a6c95cebd8a6
4
- data.tar.gz: 3c1f78e8aaa4990a24c2296402566cb20f1790570fac5addf7f49df462a01c99
3
+ metadata.gz: 972b9572dcaedc922fd21dce2b2e01d6e88f2d0e56d5c783f7a6dc649caaba0c
4
+ data.tar.gz: e6982fa62e3c73782969733342c5d6a9286d213bc5bec73ffeddf38b7a72bf91
5
5
  SHA512:
6
- metadata.gz: 6588d392a9a9baa63f1ee78148c18f32748706d0828a8c4746f9b29edc6016355c19d5d4ec60687f2da690841a18209ac151239d9ab1969fb69a5f3c1f4fac6d
7
- data.tar.gz: 2397bdeb3ca17ac719d805d19b3c215a6849340baf1ef7bb0ac4aa0ac1bc487fd3bc50e16bf0f98e6e074f6de1bd5c964d23b877c7811feb1ac19c29cfbfecb0
6
+ metadata.gz: 7ee2be8d7e2955031aad2a11ab69accb4099a923da96d8b8a2af06654f12c237451eba79084af65e89bdc708f3129c74107ff377b9d2a8352395b2c9d074e4df
7
+ data.tar.gz: 52b8c5260934de17dd80c5451471ec2f100052be84ca24a0a1cd3e1d5f52910cc1e49e31fb11589d2f12a70a0a238cf19f5ef84b1b51b6c0de183104ea989a4f
@@ -61,16 +61,21 @@ def upload(album)
61
61
  end
62
62
  total_size = (total_size + image.size)
63
63
 
64
+ # last resort solution for accents and unrecognizable characters
65
+ # but then will need to remove extension, pass the filter, then add extension again.
66
+ # human_name = check_string_sanity(filename)
67
+ human_name = filename
68
+
64
69
  uri = URI.parse($config['SERVERURL'])
65
70
  post_body = []
66
71
  post_body << "--#{BOUNDARY}\r\n"
67
- post_body << "Content-Disposition: form-data; name=\"datafile\"; filename=\"#{File.basename(filename)}\"\r\n"
72
+ post_body << "Content-Disposition: form-data; name=\"datafile\"; filename=\"#{image.signature}\"\r\n"
68
73
  post_body << "Content-Type: #{image.mime_type}\r\n"
69
74
  post_body << "\r\n"
70
75
  post_body << File.read(filename)
71
76
  post_body << "\r\n--#{BOUNDARY}--\r\n"
72
77
  http = Net::HTTP.new(uri.host, uri.port)
73
- headers = headers.merge({ "filename" => filename, "album" => "#{album}" })
78
+ headers = headers.merge({ "filename" => "#{image.signature}.#{image.type}", "album" => "#{album}", "name" => human_name })
74
79
  request = Net::HTTP::Post.new(uri, headers)
75
80
  request.body = post_body.join
76
81
  request["Content-Type"] = "multipart/form-data, boundary=#{BOUNDARY}"
@@ -84,7 +89,6 @@ def upload(album)
84
89
  end
85
90
  print "Format: #{image.type} | Dim.: W = #{image.width} H = #{image.height} | Size: #{imgSZ} : ".yellow if !$QUIET
86
91
 
87
-
88
92
  begin
89
93
  msg_resp = JSON.parse(response.body)
90
94
  if msg_resp['success']
@@ -94,11 +98,11 @@ def upload(album)
94
98
  puts "#{msg_resp['warning']}".yellow
95
99
  warn += 1
96
100
  else
97
- puts "#{msg_resp['error']}".red
101
+ puts "\n#{msg_resp['error']}".red
98
102
  error += 1
99
103
  end
100
104
  rescue
101
- puts "The server sent out an Error:".red
105
+ puts "\nThe server sent out an Error:".red
102
106
  puts clean_html(response.body)
103
107
  exit 1
104
108
  end
@@ -176,7 +180,7 @@ def health(what='',name='')
176
180
  data=list['success']
177
181
  end
178
182
  rescue
179
- puts "The server sent out an Error:".red
183
+ puts "\nThe server sent out an Error:".red
180
184
  puts clean_html(response.body)
181
185
  exit 1
182
186
  end
@@ -301,7 +305,7 @@ def user_login()
301
305
  return list['token']
302
306
  end
303
307
  rescue
304
- puts "The server sent out an Error:".red
308
+ puts "\nThe server sent out an Error:".red
305
309
  puts clean_html(response.body)
306
310
  return false
307
311
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phoseum-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julio C Hegedus