flickr-collage 0.1.0
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 +7 -0
- data/.gitignore +39 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +79 -0
- data/Rakefile +6 -0
- data/config/flickr-collage.sample.yml +2 -0
- data/exe/flickr-collage +48 -0
- data/flickr-collage.gemspec +30 -0
- data/lib/flickr/collage.rb +39 -0
- data/lib/flickr/collage/config.rb +41 -0
- data/lib/flickr/collage/dictionary.rb +30 -0
- data/lib/flickr/collage/maker.rb +29 -0
- data/lib/flickr/collage/photo.rb +9 -0
- data/lib/flickr/collage/service.rb +60 -0
- data/lib/flickr/collage/version.rb +5 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b53e05a81dd42eb4b3083f46e759e95c01e4bb25
|
4
|
+
data.tar.gz: 5796d580f2d19050ac641e19dd0600210f819086
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ed06228f36c26c195b10fb3bec0909e440065caaaa7b0605436bf05ccf030c67d49cb5afe8e2e33ece02066071f02f96c3298b5ad14e0253da611831c8bbdc8a
|
7
|
+
data.tar.gz: b1df8c3557ad9897bf1466c0662a6aba3adf659220ce7fc005cc89c7539524deeee8c44d2d9a329159ad6f3db7a70be8bb34735d6d3d464f74adb05fa89e8fc3
|
data/.gitignore
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
## Specific to RubyMotion:
|
14
|
+
.dat*
|
15
|
+
.repl_history
|
16
|
+
build/
|
17
|
+
|
18
|
+
## Documentation cache and generated files:
|
19
|
+
/.yardoc/
|
20
|
+
/_yardoc/
|
21
|
+
/doc/
|
22
|
+
/rdoc/
|
23
|
+
|
24
|
+
## Environment normalization:
|
25
|
+
/.bundle/
|
26
|
+
/vendor/bundle
|
27
|
+
/lib/bundler/man/
|
28
|
+
|
29
|
+
# for a library or gem, you might want to ignore these files since the code is
|
30
|
+
# intended to run in multiple environments; otherwise, check them in:
|
31
|
+
Gemfile.lock
|
32
|
+
.ruby-version
|
33
|
+
.ruby-gemset
|
34
|
+
|
35
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
36
|
+
.rvmrc
|
37
|
+
|
38
|
+
.idea
|
39
|
+
config/flickr-collage.yml
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at dieter.pisarewski@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Dieter Pisarewski
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Flickr::Collage
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Follow [Prerequisits](https://github.com/rmagick/rmagick#prerequisites) section for [RMagick](https://github.com/rmagick/rmagick) in order to install image processor.
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'flickr-collage'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install flickr-collage
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### From command line:
|
24
|
+
|
25
|
+
Getting help.
|
26
|
+
|
27
|
+
flickr-collage
|
28
|
+
|
29
|
+
Save credentials for [Flickr API](https://www.flickr.com/services/api/).
|
30
|
+
|
31
|
+
flickr-collage config --api_key YOUR_API_KEY --secret YOUR_SECRET
|
32
|
+
|
33
|
+
Create a collage.
|
34
|
+
|
35
|
+
flickr-collage create [FILENAME] [--amount=N] [--columns=N] [--keywords=ONE "SECOND KEYWORD" THIRD] [--thumb_widht=N] [--api_key YOUR_API_KEY] [--secret YOUR_SECRET]
|
36
|
+
|
37
|
+
Defaults:
|
38
|
+
|
39
|
+
filename - collage.png
|
40
|
+
amount - 10
|
41
|
+
columns - 5
|
42
|
+
keywords - random keywords from `/usr/share/dict/words`
|
43
|
+
thumb_width - 300
|
44
|
+
|
45
|
+
### Using Flickr::Collage API
|
46
|
+
|
47
|
+
Save credentials for [Flickr API](https://www.flickr.com/services/api/).
|
48
|
+
|
49
|
+
Flickr::Collage.config.save(api_key: YOUR_KEY, secret: YOUR_SECRET)
|
50
|
+
|
51
|
+
Create a collage.
|
52
|
+
|
53
|
+
service = Flickr::Collage::Service.new(NUMBER_OF_PHOTOS) #NUMBER_OF_PHOTOS is optional, default is 10.
|
54
|
+
service.top_photos(KEYWORDS) #KEYWORDS is optional, by default it picks random words
|
55
|
+
maker = Flickr::Collage::Maker.new(service)
|
56
|
+
maker.create(options)
|
57
|
+
|
58
|
+
Options:
|
59
|
+
|
60
|
+
output - filename for output, default is `collage.png`
|
61
|
+
amount - number of photos on the collage, default is 10
|
62
|
+
columns - number of columns on the collage, default is 5
|
63
|
+
thumb_width - width of thumbnails, default is 300
|
64
|
+
scale_range - default is 0.2
|
65
|
+
rotate_angle - default is 0
|
66
|
+
background - background color, default is 'white'
|
67
|
+
border - border color, default is '#DDDDDD'
|
68
|
+
|
69
|
+
|
70
|
+
## Development
|
71
|
+
|
72
|
+
After checking out the repo, run `bundle` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
73
|
+
|
74
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
75
|
+
|
76
|
+
## Contributing
|
77
|
+
|
78
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/flickr-collage. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
79
|
+
|
data/Rakefile
ADDED
data/exe/flickr-collage
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
Bundler.setup
|
6
|
+
Bundler.require(:default)
|
7
|
+
|
8
|
+
require 'thor'
|
9
|
+
require 'hashie'
|
10
|
+
require 'flickr/collage'
|
11
|
+
|
12
|
+
module Flickr
|
13
|
+
module Collage
|
14
|
+
class CLI < Thor
|
15
|
+
class_option :verbose, type: :boolean
|
16
|
+
class_option :api_key, type: :string
|
17
|
+
class_option :secret, type: :string
|
18
|
+
|
19
|
+
desc 'config', 'Save configuration options to the configuration file'
|
20
|
+
option :api_key, type: :string
|
21
|
+
option :secret, type: :string
|
22
|
+
def config
|
23
|
+
Collage.config.save(options)
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'create FILENAME', 'Creates a collage for given keywords'
|
27
|
+
option :amount, type: :numeric, desc: 'Number of photos on the collage'
|
28
|
+
option :thumb_width, type: :numeric, desc: 'Width of thumbnails on the collage'
|
29
|
+
option :keywords, type: :array, desc: 'Keywords to search on Flickr'
|
30
|
+
option :columns, type: :numeric, desc: 'Number of columns on the collage'
|
31
|
+
def create(filename = nil)
|
32
|
+
Collage.verbose! if options[:verbose]
|
33
|
+
|
34
|
+
opts = Hashie::Mash.new(options.to_h)
|
35
|
+
opts.merge!(output: filename) if filename
|
36
|
+
|
37
|
+
Collage.config.settings = opts if opts[:api_key] and opts[:secret]
|
38
|
+
|
39
|
+
service = Service.new(opts[:amount])
|
40
|
+
maker = Maker.new(service)
|
41
|
+
service.top_photos(*opts[:keywords])
|
42
|
+
maker.create(opts)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Flickr::Collage::CLI.start(ARGV)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'flickr/collage/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'flickr-collage'
|
8
|
+
spec.version = Flickr::Collage::VERSION
|
9
|
+
spec.authors = ['Dieter Pisarewski']
|
10
|
+
spec.email = ['dieter.pisarewski@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = "A command line tool to create a collage from flickr photos."
|
13
|
+
spec.description = "Finds the most interesting photos on flickr by given keywords and creates a photo collage from the photos."
|
14
|
+
spec.homepage = 'https://github.com/dpisarewski/flickr-collage'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_runtime_dependency 'flickraw', '~> 0.9.8'
|
23
|
+
spec.add_runtime_dependency 'rmagick-screwdrivers', '~> 0.2.0'
|
24
|
+
spec.add_runtime_dependency 'thor', '~> 0.19.1'
|
25
|
+
spec.add_runtime_dependency 'hashie', '~> 3.4'
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'logger'
|
2
|
+
|
3
|
+
module Flickr
|
4
|
+
module Collage
|
5
|
+
LOGGER = Logger.new(STDOUT)
|
6
|
+
LOGGER.level = Logger::WARN
|
7
|
+
|
8
|
+
def self.root
|
9
|
+
File.expand_path('../..', File.dirname(__FILE__))
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.config
|
13
|
+
Config.instance
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.logger
|
17
|
+
LOGGER
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.verbose!
|
21
|
+
logger.level = Logger::DEBUG
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.silence_warnings(&block)
|
25
|
+
warn_level = $VERBOSE
|
26
|
+
$VERBOSE = nil
|
27
|
+
result = block.call
|
28
|
+
$VERBOSE = warn_level
|
29
|
+
result
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
require 'flickr/collage/version'
|
35
|
+
require 'flickr/collage/config'
|
36
|
+
require 'flickr/collage/dictionary'
|
37
|
+
require 'flickr/collage/photo'
|
38
|
+
require 'flickr/collage/service'
|
39
|
+
require 'flickr/collage/maker'
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'singleton'
|
2
|
+
require 'hashie'
|
3
|
+
require 'yaml'
|
4
|
+
require 'forwardable'
|
5
|
+
|
6
|
+
module Flickr
|
7
|
+
module Collage
|
8
|
+
class Config
|
9
|
+
extend Forwardable
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
DEFAULT_CONFIG_FILENAME = 'flickr-collage.yml'
|
13
|
+
DEFAULT_CONFIG_PATH = File.join(Collage.root, 'config', DEFAULT_CONFIG_FILENAME)
|
14
|
+
CONFIG_OPTIONS = %w[api_key secret]
|
15
|
+
|
16
|
+
attr_accessor :data
|
17
|
+
delegate CONFIG_OPTIONS => :settings
|
18
|
+
|
19
|
+
def settings
|
20
|
+
self.data ||= load
|
21
|
+
end
|
22
|
+
|
23
|
+
def settings=(hash)
|
24
|
+
filtered = hash.reject{ |k, v| !CONFIG_OPTIONS.include?(k.to_s) }
|
25
|
+
self.data = Hashie::Mash.new(filtered)
|
26
|
+
end
|
27
|
+
|
28
|
+
def load(config_path = DEFAULT_CONFIG_PATH)
|
29
|
+
self.data = Hashie::Mash.new(YAML.load_file(config_path))
|
30
|
+
end
|
31
|
+
|
32
|
+
def save(hash, config_path = DEFAULT_CONFIG_PATH)
|
33
|
+
self.settings = hash
|
34
|
+
|
35
|
+
File.open(config_path, 'w') do |file|
|
36
|
+
file.write(YAML.dump(data.to_hash))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Flickr
|
2
|
+
module Collage
|
3
|
+
class Dictionary
|
4
|
+
DEFAULT_DICT_FILE = '/usr/share/dict/words'
|
5
|
+
attr_accessor :dict_filename
|
6
|
+
|
7
|
+
def initialize(dict_filename = nil)
|
8
|
+
self.dict_filename = dict_filename || DEFAULT_DICT_FILE
|
9
|
+
end
|
10
|
+
|
11
|
+
def size
|
12
|
+
@size ||= File.open(dict_filename).inject(0) { |c, line| c + 1 }
|
13
|
+
end
|
14
|
+
|
15
|
+
def random_word
|
16
|
+
prng = Random.new
|
17
|
+
number = prng.rand(1..size).to_i
|
18
|
+
|
19
|
+
File.open(dict_filename) do |file|
|
20
|
+
#WARNING: too many IO operations
|
21
|
+
#TODO: For small files only, load the the contents into memory. For large files, index lines or use database.
|
22
|
+
#skip n - 1 lines
|
23
|
+
(number - 1).times{ file.gets }
|
24
|
+
#read line number and close the file
|
25
|
+
next file.gets.chomp
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'hashie'
|
2
|
+
|
3
|
+
Flickr::Collage.silence_warnings do
|
4
|
+
require 'rmagick/screwdrivers'
|
5
|
+
end
|
6
|
+
|
7
|
+
module Flickr
|
8
|
+
module Collage
|
9
|
+
class Maker
|
10
|
+
DEFAULT_FILENAME = 'collage.png'
|
11
|
+
DEFAULT_OPTIONS = {output: DEFAULT_FILENAME, columns: 5, rotate_angle: 0, scale_range: 0.2, thumb_width: 300}
|
12
|
+
attr_accessor :service
|
13
|
+
|
14
|
+
def initialize(service)
|
15
|
+
self.service = service
|
16
|
+
end
|
17
|
+
|
18
|
+
def create(options = {})
|
19
|
+
options = Hashie::Mash.new(options).reverse_merge(DEFAULT_OPTIONS)
|
20
|
+
options = Hashie::Extensions::SymbolizeKeys.symbolize_keys(options.to_h)
|
21
|
+
|
22
|
+
Dir.mktmpdir do |dir|
|
23
|
+
service.download(dir)
|
24
|
+
Magick::Screwdrivers.collage(dir, options).write(options[:output])
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'flickraw'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'forwardable'
|
4
|
+
|
5
|
+
module Flickr
|
6
|
+
module Collage
|
7
|
+
class Service
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
DEFAULT_PHOTOS_AMOUNT = 10
|
11
|
+
attr_accessor :photos, :photos_amount
|
12
|
+
|
13
|
+
def initialize(photos_amount = nil)
|
14
|
+
self.photos_amount = photos_amount || DEFAULT_PHOTOS_AMOUNT
|
15
|
+
self.photos = []
|
16
|
+
FlickRaw.api_key = Collage.config.api_key
|
17
|
+
FlickRaw.shared_secret = Collage.config.secret
|
18
|
+
end
|
19
|
+
|
20
|
+
def top_photos(*keywords)
|
21
|
+
self.photos = []
|
22
|
+
buffer = keywords.compact.dup
|
23
|
+
dict = Dictionary.new
|
24
|
+
|
25
|
+
while photos.size < photos_amount
|
26
|
+
buffer << dict.random_word if buffer.empty?
|
27
|
+
keyword = buffer.shift
|
28
|
+
Collage.logger.info("New keyword: #{keyword}")
|
29
|
+
photo = top_photo(keyword)
|
30
|
+
photos << photo if photo
|
31
|
+
end
|
32
|
+
|
33
|
+
photos
|
34
|
+
end
|
35
|
+
|
36
|
+
def top_photo(keyword)
|
37
|
+
#option :text returns better results than :tags
|
38
|
+
options = {text: keyword, per_page: 1, page: 1, sort: 'interestingness-desc', content_type: 1, media: :photos}
|
39
|
+
list = flickr.photos.search(options)
|
40
|
+
return if list.to_a.empty?
|
41
|
+
|
42
|
+
photo_info = flickr.photos.getInfo(photo_id: list.first['id'])
|
43
|
+
photo = Photo.new(photo_info.to_hash)
|
44
|
+
photo.url = FlickRaw.url_b(photo_info)
|
45
|
+
photo
|
46
|
+
end
|
47
|
+
|
48
|
+
def download(dir)
|
49
|
+
fail('No photos available') if photos.empty?
|
50
|
+
|
51
|
+
photos.each do |photo|
|
52
|
+
file = open(photo.url)
|
53
|
+
File.open(File.join(dir, photo.filename), 'wb') do |f|
|
54
|
+
f.write(file.read)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flickr-collage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dieter Pisarewski
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: flickraw
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.8
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.9.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rmagick-screwdrivers
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: thor
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hashie
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.11'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.11'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '3.0'
|
111
|
+
description: Finds the most interesting photos on flickr by given keywords and creates
|
112
|
+
a photo collage from the photos.
|
113
|
+
email:
|
114
|
+
- dieter.pisarewski@gmail.com
|
115
|
+
executables:
|
116
|
+
- flickr-collage
|
117
|
+
extensions: []
|
118
|
+
extra_rdoc_files: []
|
119
|
+
files:
|
120
|
+
- ".gitignore"
|
121
|
+
- ".rspec"
|
122
|
+
- ".travis.yml"
|
123
|
+
- CODE_OF_CONDUCT.md
|
124
|
+
- Gemfile
|
125
|
+
- LICENSE
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- config/flickr-collage.sample.yml
|
129
|
+
- exe/flickr-collage
|
130
|
+
- flickr-collage.gemspec
|
131
|
+
- lib/flickr/collage.rb
|
132
|
+
- lib/flickr/collage/config.rb
|
133
|
+
- lib/flickr/collage/dictionary.rb
|
134
|
+
- lib/flickr/collage/maker.rb
|
135
|
+
- lib/flickr/collage/photo.rb
|
136
|
+
- lib/flickr/collage/service.rb
|
137
|
+
- lib/flickr/collage/version.rb
|
138
|
+
homepage: https://github.com/dpisarewski/flickr-collage
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.4.8
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: A command line tool to create a collage from flickr photos.
|
162
|
+
test_files: []
|