nokaya 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a8bc730be34c83aee0865c0e1c0fb269c0a15bf
4
- data.tar.gz: a3fb50dab1917d381d01bb14b31a30ca0a39eab6
3
+ metadata.gz: 0f30bdf81f7a713f60c36acf4f78e993c306f0c5
4
+ data.tar.gz: 9f2037a5ae1f95ff17abf243e5077bc1124453c1
5
5
  SHA512:
6
- metadata.gz: 340a8ff304170008a542177ae015ea2885ac6b86bc76affdc4b63dea96b794a0b42d9d8e78924cf9d3452caed08ca2d8400f81178794475f63391ba1c99990aa
7
- data.tar.gz: f19a0c706273eeead12354c26a3ac58911911ed56809b24efdab5d55cf9a81b7adf746282973ee3ab2e61a1fa1de8a04615c67002d8b601c0692879311dd22bd
6
+ metadata.gz: 5f5012272855e7946c7219a5fa362f5546666e85e6e2002a420c9d6898cd4364dbdb2f42868f13e3b404db180b85d6990f7a7cc5981d3a9332b11405876e4536
7
+ data.tar.gz: 750f661bf436fb97147ed6a8f027bf72020aa0ab879a1d3f30e449ebae904006eae0972b12174274ac8396b8201c5c11dd03c439af4400db741a257cc7fb5360
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.0.5
2
+
3
+ - Flickr album
4
+
1
5
  # 0.0.4
2
6
 
3
7
  - Tumblr
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Nokaya
2
2
 
3
- CLI to download photos from several online services including Instagram, App.net and Favd.
3
+ CLI to download photos from several online services including Instagram, Imgur albums, Flickr albums, App.net, Tumblr...
4
4
 
5
5
  Mac OS X only for the time being.
6
6
 
@@ -50,6 +50,16 @@ Example:
50
50
 
51
51
  Downloads all images in the album.
52
52
 
53
+ ### Flickr album
54
+
55
+ `nokaya -fal url`
56
+
57
+ Example:
58
+
59
+ `nokaya -fal https://www.flickr.com/photos/ericdke/sets/72157644556227302/`
60
+
61
+ Downloads all images in the album.
62
+
53
63
  ### Favd
54
64
 
55
65
  `nokaya favd url`
data/lib/nokaya/app.rb CHANGED
@@ -14,7 +14,11 @@ module Nokaya
14
14
  nokaya = Getter.new options, :instagram, args
15
15
  page = nokaya.parse_page
16
16
  img_link = nokaya.get_basic page
17
- download_and_save img_link, nokaya
17
+ begin
18
+ download_and_save img_link, nokaya
19
+ rescue Interrupt
20
+ abort Status.canceled
21
+ end
18
22
  end
19
23
 
20
24
  desc "favd", 'Get the photo from a Favd page (nokaya favd url)'
@@ -24,7 +28,11 @@ module Nokaya
24
28
  nokaya = Getter.new options, :favd, args
25
29
  page = nokaya.parse_page
26
30
  img_link = nokaya.get_favd page
27
- download_and_save img_link, nokaya
31
+ begin
32
+ download_and_save img_link, nokaya
33
+ rescue Interrupt
34
+ abort Status.canceled
35
+ end
28
36
  end
29
37
 
30
38
  desc "adn", "Get the photo from a photos.app.net page (nokaya adn url)"
@@ -34,7 +42,11 @@ module Nokaya
34
42
  nokaya = Getter.new options, :adn, args
35
43
  page = nokaya.parse_page
36
44
  img_link = nokaya.get_basic page
37
- download_and_save img_link, nokaya
45
+ begin
46
+ download_and_save img_link, nokaya
47
+ rescue Interrupt
48
+ abort Status.canceled
49
+ end
38
50
  end
39
51
 
40
52
  desc "tumblr", "Get the photo from a Tumblr photo page (nokaya -t url)"
@@ -45,7 +57,11 @@ module Nokaya
45
57
  nokaya = Getter.new options, :tumblr, args
46
58
  page = nokaya.parse_page
47
59
  img_link = nokaya.get_basic page
48
- download_and_save img_link, nokaya
60
+ begin
61
+ download_and_save img_link, nokaya
62
+ rescue Interrupt
63
+ abort Status.canceled
64
+ end
49
65
  end
50
66
 
51
67
  desc "imgur_album", "Get all images from an Imgur album (nokaya -ial url)"
@@ -55,7 +71,25 @@ module Nokaya
55
71
  nokaya = Getter.new options, :imgur_album, args
56
72
  page = nokaya.parse_page
57
73
  img_links = nokaya.get_imgur_album page
58
- download_album img_links, nokaya
74
+ begin
75
+ download_album img_links, nokaya
76
+ rescue Interrupt
77
+ abort Status.canceled
78
+ end
79
+ end
80
+
81
+ desc "flickr_album", "Get all images from a Flickr album (nokaya -fal url)"
82
+ map "-fal" => :flickr_album
83
+ def flickr_album *args
84
+ abort Status.no_url if args.empty?
85
+ nokaya = Getter.new options, :flickr_album, args
86
+ page = nokaya.parse_page
87
+ img_links = nokaya.get_flickr_album page
88
+ begin
89
+ download_album img_links, nokaya
90
+ rescue Interrupt
91
+ abort Status.canceled
92
+ end
59
93
  end
60
94
 
61
95
  private
@@ -68,14 +102,14 @@ module Nokaya
68
102
  end
69
103
 
70
104
  def download_album img_links, nokaya
71
- puts "\nDownloading album at #{nokaya.url}...\n\n"
105
+ puts Status.downloading_album nokaya
72
106
  img_links.each do |link|
73
107
  parsed = URI.parse link
74
- file = "#{Dir.home}/Downloads#{parsed.path}"
75
- puts "Saving #{file}\n"
108
+ file = "#{Dir.home}/Downloads/#{parsed.path.split("/").last}"
109
+ puts Status.saving file
76
110
  Image.save_image(file, nokaya.get_image(link))
77
111
  end
78
- puts "\nDone.\n\n"
112
+ puts Status.done
79
113
  end
80
114
 
81
115
  end
data/lib/nokaya/getter.rb CHANGED
@@ -35,6 +35,12 @@ module Nokaya
35
35
  refs.each {|l| links << "http:#{l['href']}"}
36
36
  links
37
37
  end
38
+ def get_flickr_album page
39
+ refs = page.css('.pc_img')
40
+ links = []
41
+ refs.each {|l| links << l['data-defer-src']}
42
+ links
43
+ end
38
44
  def parse_page
39
45
  Nokogiri::HTML get_page_content
40
46
  end
data/lib/nokaya/status.rb CHANGED
@@ -13,5 +13,20 @@ module Nokaya
13
13
  def self.no_url
14
14
  "\nYou have to specify a page URL.\n\n"
15
15
  end
16
+ def self.error
17
+ "\nAn unknown error happened.\n\n"
18
+ end
19
+ def self.canceled
20
+ "\nCanceled.\n\n"
21
+ end
22
+ def self.saving file
23
+ "Saving #{file}\n"
24
+ end
25
+ def self.done
26
+ "\nDone.\n\n"
27
+ end
28
+ def self.downloading_album nokaya
29
+ "\nDownloading album at #{nokaya.url}...\n\n"
30
+ end
16
31
  end
17
32
  end
@@ -1,3 +1,3 @@
1
1
  module Nokaya
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/nokaya.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Eric Dejonckheere"]
10
10
  spec.email = ["eric@aya.io"]
11
11
  spec.summary = %q{Download photos from several online services.}
12
- spec.description = %q{CLI to download photos from several online services including Instagram. Mac OS X only for the time being.}
12
+ spec.description = %q{CLI to download photos from several online services including Instagram, Imgur albums, Flickr albums, Tumblr, App,net, etc. Mac OS X only for the time being.}
13
13
  spec.homepage = "http://github.com/ericdke/nokaya"
14
14
  spec.license = "MIT"
15
15
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokaya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Dejonckheere
@@ -192,8 +192,8 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description: CLI to download photos from several online services including Instagram.
196
- Mac OS X only for the time being.
195
+ description: CLI to download photos from several online services including Instagram,
196
+ Imgur albums, Flickr albums, Tumblr, App,net, etc. Mac OS X only for the time being.
197
197
  email:
198
198
  - eric@aya.io
199
199
  executables: