flickr_sync 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flickr_sync/cli.rb +8 -2
- 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: 261656c86a10baf79c11bc9acc5082d318fc9521
|
4
|
+
data.tar.gz: 69a73711d2734d901c1dde6452f378e41eed3dc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe547d5886662e21ec9ce4ae6be680a136cd4744edf7eefef1b561f8cf2b2840780ea3bfdd4b08f45a2713da0a01c757126e37f46f98b3da9f21feac5d98d426
|
7
|
+
data.tar.gz: b8d54dbdef7a7a664d60b79cae314ead69f1d9a6d337cc7648f4b54c6349cdf16fa76a678f4c6cec8ce887d62a7757968f32331a5d4596138582857daec737af
|
data/lib/flickr_sync/cli.rb
CHANGED
@@ -5,10 +5,14 @@ require 'splat'
|
|
5
5
|
|
6
6
|
module FlickrSync
|
7
7
|
class Cli < Clamp::Command
|
8
|
+
IMAGES_ONLY = %w{.jpg .gif .m4v}
|
9
|
+
IMAGES_AND_VIDEO = IMAGES_ONLY + %w{.mp4 .mov}
|
10
|
+
|
8
11
|
attr_reader :preferences
|
9
12
|
attr_reader :prompt
|
10
13
|
|
11
14
|
# option "--optimistic", :flag, "assume there are no duplicates"
|
15
|
+
option "--video", :flag, "include videos"
|
12
16
|
parameter "DIRECTORY_PATH", "the folder containing images"
|
13
17
|
|
14
18
|
def api_key
|
@@ -60,8 +64,10 @@ module FlickrSync
|
|
60
64
|
written_path = File.join directory_path, 'written.txt'
|
61
65
|
duplicates_path = File.join directory_path, 'duplicates.txt'
|
62
66
|
|
63
|
-
|
64
|
-
|
67
|
+
file_extensions = video? ? IMAGES_AND_VIDEO : IMAGES_ONLY
|
68
|
+
|
69
|
+
allfiles = `find "#{directory_path}"`.split("\n").select {|p| file_extensions.include? File.extname(p).downcase}
|
70
|
+
puts "Found #{allfiles.count} #{video? ? 'image/video' : 'image'} files"
|
65
71
|
writtenfiles = load_list written_path
|
66
72
|
puts "Found #{writtenfiles.count} previously sent files"
|
67
73
|
newfiles = allfiles - writtenfiles
|