phoseum-cli 0.0.2 → 0.0.3
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/bin/phoseum-cli +11 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972b9572dcaedc922fd21dce2b2e01d6e88f2d0e56d5c783f7a6dc649caaba0c
|
4
|
+
data.tar.gz: e6982fa62e3c73782969733342c5d6a9286d213bc5bec73ffeddf38b7a72bf91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee2be8d7e2955031aad2a11ab69accb4099a923da96d8b8a2af06654f12c237451eba79084af65e89bdc708f3129c74107ff377b9d2a8352395b2c9d074e4df
|
7
|
+
data.tar.gz: 52b8c5260934de17dd80c5451471ec2f100052be84ca24a0a1cd3e1d5f52910cc1e49e31fb11589d2f12a70a0a238cf19f5ef84b1b51b6c0de183104ea989a4f
|
data/bin/phoseum-cli
CHANGED
@@ -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=\"#{
|
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" =>
|
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 "
|
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 "
|
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 "
|
308
|
+
puts "\nThe server sent out an Error:".red
|
305
309
|
puts clean_html(response.body)
|
306
310
|
return false
|
307
311
|
end
|