iphoto_backup 1.0.0 → 1.0.1

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: b9dca72c4a6a1dde1fb22151dc7d109220848923
4
- data.tar.gz: 6a4d33e9ef779e0ed4c6846ed1cb314f7e1ae7bf
3
+ metadata.gz: cf78d7f7f13ec97e6fba2df3407794a5901f7539
4
+ data.tar.gz: 38e8ff3f92fac97c866316728650d51206237051
5
5
  SHA512:
6
- metadata.gz: 1967d543c0966f836b054a704a152f4b05e9229c3fa086ccd6373705e86c03096aa79c89af93c3b55fa573c17d553b6d58320689a710321380cd1b119ef8afc3
7
- data.tar.gz: 3a8925d43561b689098c2cb026f8c873ae52a7dfa583c127a07a8452a3d12c88444603e9884e85f4197d0f90c4d99672c6c044f2e0f2756c1d17f2a97d1c8d02
6
+ metadata.gz: b9e7e76e5e5f2aa0ed7ef3e97b13a72af84d6f81cde9270e5889fba2bbdb594cdce4086f771cb4fe5411f76542a13f0ce4c1cbf98877f2e6acf815026fd3da67
7
+ data.tar.gz: 513aaf094bcdc53a6dc37b9382230f3f423223f3406ead237ad3a02a0f8ee1c1a799dc1c3f9ca0b1ddeaee4d2e5fc860af94ec75cc9ae33359d49a672f445084
@@ -8,11 +8,11 @@ module IphotoBackup
8
8
  DEFAULT_OUTPUT_DIRECTORY = "~/Google Drive/Dropbox"
9
9
  IPHOTO_EPOCH = Time.new(2001, 1, 1)
10
10
 
11
- desc "export iPhoto albums", "exports iPhoto albums into target directory"
12
- option :filter, aliases: '-e', default: '.*'
13
- option :output, aliases: '-o', default: DEFAULT_OUTPUT_DIRECTORY
14
- option :config, aliases: '-c', default: IPHOTO_ALBUM_PATH
15
- option :'date-prefix', aliases: '-d', default: false
11
+ desc "export [OPTIONS]", "exports iPhoto albums into target directory"
12
+ option :filter, desc: 'filter to only include albums that match the given regex', aliases: '-e', default: '.*'
13
+ option :output, desc: 'directory to export albums to', aliases: '-o', default: DEFAULT_OUTPUT_DIRECTORY
14
+ option :config, desc: 'iPhoto AlbumData.xml file to process', aliases: '-c', default: IPHOTO_ALBUM_PATH
15
+ option :'include-date-prefix', desc: 'automatically include ISO8601 date prefix to exported events', aliases: '-d', default: false, type: :boolean
16
16
  def export
17
17
  each_album do |folder_name, album_info|
18
18
  say "\n\nProcessing Roll: #{folder_name}..."
@@ -40,18 +40,7 @@ module IphotoBackup
40
40
  def each_album(&block)
41
41
  albums = value_for_dictionary_key("List of Rolls").children.select {|n| n.name == 'dict' }
42
42
  albums.each do |album_info|
43
- folder_name = value_for_dictionary_key('RollName', album_info).content
44
-
45
- if options[:'include-date-prefix'] && folder_name !~ /^\d{4}-\d{2}-\d{2} /
46
- album_date = nil
47
- each_image album_info do |image_info|
48
- next if album_date
49
- photo_interval = value_for_dictionary_key('DateAsTimerInterval', image_info).content.to_i
50
- album_date = (IPHOTO_EPOCH + photo_interval).to_date
51
- end
52
- say "Automatically adding #{album_date} prefix to folder: #{folder_name}"
53
- folder_name = "#{album_date} #{folder_name}"
54
- end
43
+ folder_name = album_name album_info
55
44
 
56
45
  if folder_name.match(album_filter)
57
46
  yield folder_name, album_info
@@ -61,6 +50,22 @@ module IphotoBackup
61
50
  end
62
51
  end
63
52
 
53
+ def album_name(album_info)
54
+ folder_name = value_for_dictionary_key('RollName', album_info).content
55
+
56
+ if options[:'include-date-prefix'] && folder_name !~ /^\d{4}-\d{2}-\d{2} /
57
+ album_date = nil
58
+ each_image album_info do |image_info|
59
+ next if album_date
60
+ photo_interval = value_for_dictionary_key('DateAsTimerInterval', image_info).content.to_i
61
+ album_date = (IPHOTO_EPOCH + photo_interval).strftime('%Y-%d-%m')
62
+ end
63
+ say "Automatically adding #{album_date} prefix to folder: #{folder_name}"
64
+ folder_name = "#{album_date} #{folder_name}"
65
+ end
66
+ folder_name
67
+ end
68
+
64
69
  def each_image(album_info, &block)
65
70
  album_images = value_for_dictionary_key('KeyList', album_info).css('string').map(&:content)
66
71
  album_images.each do |image_id|
@@ -1,3 +1,3 @@
1
1
  module IphotoBackup
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iphoto_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Sonnek