photo-helper 0.4.2 → 0.5.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 +5 -5
- data/Gemfile.lock +2 -2
- data/lib/helpers/image_helper.rb +2 -0
- data/lib/helpers/smugmug_album.rb +7 -4
- data/lib/helpers/smugmug_api.rb +7 -0
- data/lib/photo-helper/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 75db20783f1ad95d982739dab69646006eac47e9fc043fb2614c680e85dfb277
|
4
|
+
data.tar.gz: 528fb0f9ca7a576acb00bcb960a89da051371d4c0fb4af3cfec12fa557224ba5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 278a618d88c891739e81d1e2de99d1643280a05424346335e03cd75f6184ebe2d94a553573ec2c0ac5683691ecdebf9c4fa2dd2722817548749c5ffc589b2f4e
|
7
|
+
data.tar.gz: 34bac974e7ac02115d1b382dc217f4e3b7c3c9c204072daca8106d7c717d84a6244a94a7114d9d5021e535c69186ab2335d0b98f3f4407ea920ac4b9a169398a
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
photo-helper (0.
|
4
|
+
photo-helper (0.5.0)
|
5
5
|
ejson
|
6
6
|
mimemagic
|
7
7
|
mini_magick
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
builder
|
29
29
|
minitest (>= 5.0)
|
30
30
|
ruby-progressbar
|
31
|
-
oauth (0.5.
|
31
|
+
oauth (0.5.4)
|
32
32
|
parallel (1.12.0)
|
33
33
|
parser (2.4.0.0)
|
34
34
|
ast (~> 2.2)
|
data/lib/helpers/image_helper.rb
CHANGED
@@ -3,6 +3,8 @@ class ImageHelper
|
|
3
3
|
IMAGE_CLASS_REGEX = /xmp:Label="(.+)"/
|
4
4
|
RATING_REGEX = /xmp:Rating="(.+)"/
|
5
5
|
|
6
|
+
# identify -format '%[EXIF:*]' .jepg
|
7
|
+
|
6
8
|
def self.xmp(image)
|
7
9
|
xmp = File.join(File.dirname(image), File.basename(image, ".*") + ".XMP")
|
8
10
|
return unless File.exist?(xmp)
|
@@ -177,10 +177,13 @@ class SmugmugAlbumHelper
|
|
177
177
|
# puts "delete #{to_delete.count}???"
|
178
178
|
if delete && to_delete.any?
|
179
179
|
puts "Deleting #{to_delete.count} images"
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
180
|
+
trash_album_name = File.join("trash/#{album_name}")
|
181
|
+
trash_album = @smugmug.get_or_create_album(trash_album_name)
|
182
|
+
@smugmug.move_images(to_delete.map{ |u| u[:uri] }, trash_album[:id])
|
183
|
+
# to_delete.each do |uploaded|
|
184
|
+
# puts uploaded[:filename]
|
185
|
+
# @smugmug.http(:delete, uploaded[:uri])
|
186
|
+
# end
|
184
187
|
end
|
185
188
|
end
|
186
189
|
|
data/lib/helpers/smugmug_api.rb
CHANGED
@@ -79,6 +79,7 @@ class SmugmugAPI
|
|
79
79
|
folder_list
|
80
80
|
end
|
81
81
|
|
82
|
+
# path is the full path with spaces
|
82
83
|
def get_or_create_album(path, album_url: nil)
|
83
84
|
folder_path = File.dirname(path).split('/').map(&:capitalize).join('/')
|
84
85
|
album_name = File.basename(path).split(' ').map(&:capitalize).join(' ')
|
@@ -224,6 +225,12 @@ class SmugmugAPI
|
|
224
225
|
post("/api/v2/album/#{album_id}!collectimages", "CollectUris" => images)
|
225
226
|
end
|
226
227
|
|
228
|
+
def move_images(images, album_id)
|
229
|
+
return if images.empty?
|
230
|
+
images = images.join(",") if images.is_a? Array
|
231
|
+
post("/api/v2/album/#{album_id}!moveimages", "MoveUris" => images)
|
232
|
+
end
|
233
|
+
|
227
234
|
def request_access_token
|
228
235
|
@consumer = OAuth::Consumer.new(@secrets.api_key, @secrets.api_secret,
|
229
236
|
site: OAUTH_ORIGIN,
|
data/lib/photo-helper/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photo-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Caldwell
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -262,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '0'
|
263
263
|
requirements: []
|
264
264
|
rubyforge_project:
|
265
|
-
rubygems_version: 2.6
|
265
|
+
rubygems_version: 2.7.6
|
266
266
|
signing_key:
|
267
267
|
specification_version: 4
|
268
268
|
summary: A tool to automatate my photo workflows
|