iphoto_backup 1.0.0 → 1.0.1
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/lib/iphoto_backup/cli.rb +22 -17
- data/lib/iphoto_backup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf78d7f7f13ec97e6fba2df3407794a5901f7539
|
4
|
+
data.tar.gz: 38e8ff3f92fac97c866316728650d51206237051
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9e7e76e5e5f2aa0ed7ef3e97b13a72af84d6f81cde9270e5889fba2bbdb594cdce4086f771cb4fe5411f76542a13f0ce4c1cbf98877f2e6acf815026fd3da67
|
7
|
+
data.tar.gz: 513aaf094bcdc53a6dc37b9382230f3f423223f3406ead237ad3a02a0f8ee1c1a799dc1c3f9ca0b1ddeaee4d2e5fc860af94ec75cc9ae33359d49a672f445084
|
data/lib/iphoto_backup/cli.rb
CHANGED
@@ -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
|
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 =
|
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|
|