flickrchive 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/flickrchive.gemspec +1 -1
- data/lib/flickrchive/execute.rb +3 -0
- data/lib/flickrchive/prepare.rb +6 -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: 533ec7bd851cf9e99a2dca4e086535a963195c23
|
4
|
+
data.tar.gz: d4c29dc59f9abdec1448f0d8afa140476f05def0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ec2f1eae28204be8e86111a11ec37ac17602d3504ea15f73380760e628f8b07a14e60d386d01d16f3ce22d09da338303fa6371c004c572a0bc1e5f3a453544
|
7
|
+
data.tar.gz: d42dbdc7bf0eb8195dfba1dc333c4b346850dbad350afc1b4f5088337fddf367cbc9b767346e3b695a0774aecb07a8c78be63196e61ed575141befb95b56140f
|
data/flickrchive.gemspec
CHANGED
data/lib/flickrchive/execute.rb
CHANGED
@@ -21,6 +21,9 @@ module Flickrchive
|
|
21
21
|
rescue FlickRaw::FailedResponse => e
|
22
22
|
handle_flickr_fail(e)
|
23
23
|
retry
|
24
|
+
rescue EOFError
|
25
|
+
Flickrchive.logger.info("Caught network EOFError. Retrying upload")
|
26
|
+
retry
|
24
27
|
end
|
25
28
|
Flickrchive.logger.info("Uploaded file: #{photo[:filename]}")
|
26
29
|
photo[:flickr_id] = id
|
data/lib/flickrchive/prepare.rb
CHANGED
@@ -7,13 +7,18 @@ module Flickrchive
|
|
7
7
|
def prepare
|
8
8
|
fm = FileMagic.new
|
9
9
|
Flickrchive.logger.info("Recursively inspecting directory for images, this may take awhile...")
|
10
|
+
self.db.synchronize do
|
11
|
+
@existing_files = self.db.map { |k,v| v[:filename]}
|
12
|
+
end
|
10
13
|
files = FileList.new("#{self.directory}/**/*") do |fl|
|
11
14
|
self.excludes.each do |exclude_matcher|
|
12
15
|
fl.exclude(Regexp.new(exclude_matcher))
|
13
16
|
end
|
14
17
|
end
|
18
|
+
# get out list of files to attempt to process
|
19
|
+
to_do = files - @existing_files
|
15
20
|
|
16
|
-
|
21
|
+
to_do.each do |fn|
|
17
22
|
new_photo = {filename: fn}
|
18
23
|
begin
|
19
24
|
new_photo[:type] = fm.file(fn)
|