kijkwijzer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/kijkwijzer.gemspec +25 -0
- data/lib/kijkwijzer.rb +35 -0
- data/lib/kijkwijzer.svg +40 -0
- data/lib/kijkwijzer/railtie.rb +9 -0
- data/lib/kijkwijzer/result.rb +27 -0
- data/lib/kijkwijzer/version.rb +3 -0
- data/lib/kijkwijzer/view_helpers.rb +18 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d46482dd02faba6d2f5422c77e484b64f278b0ad
|
4
|
+
data.tar.gz: 871676e2e0f24d2384c999a30986c700aa6b9e3b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 012d3b63a93715a25609e1a78bdf240179996369410fff567a83c96a57d6bd5b819f376ce8c37979672df88c89ddf7b527792369a16e365da6e2eda87af1287d
|
7
|
+
data.tar.gz: ecbb6aaa3b138e409dd64ac916a23ca62d8a824e5713109d04a01de593dcb03d519b38c0ddc8ef7c649c8008cf70125582333031609b6af4121fecb7869f4b68
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Maarten Brouwers
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Kijkwijzer
|
2
|
+
|
3
|
+
[Kijkwijzer](http://kijkwijzer.nl) is the [Dutch film/television-screening system](https://en.wikipedia.org/wiki/Television_content_rating_systems#Netherlands). Since there is no proper API i made this gem to remove the scraping bit from my own app-source.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'kijkwijzer'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install kijkwijzer
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Usage is simple:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Kijkwijzer.search("piano")
|
27
|
+
```
|
28
|
+
|
29
|
+
Gives you results of movies, documentaries etc with known ratings.
|
30
|
+
|
31
|
+
You can also filter by year:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Kijkwijzer.search("piano", {year: 2011})
|
35
|
+
```
|
36
|
+
|
37
|
+
### Rails view-helpers (SVG icons)
|
38
|
+
|
39
|
+
To make things even easier I included the SVG-icon set. Simply use the two methods.
|
40
|
+
|
41
|
+
Somewhere in the top of your body, load the iconset definition:
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
<%= render_kijkwijzer_svg_definitions %>
|
45
|
+
```
|
46
|
+
Then to display the movie results use the view helper `render_kijkwijzers`:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
<% Kijkwijzer.search("piano").each do |rating| %>
|
50
|
+
<h2><%= rating.title %></h2>
|
51
|
+
<p><%= render_kijkwijzers rating %></p>
|
52
|
+
<% end %>
|
53
|
+
```
|
54
|
+
|
55
|
+
Make sure you format the icons properly, otherwise you'll get huge icons ... I believe I've added plenty of classes for easy styling using css.
|
56
|
+
|
57
|
+
## Development
|
58
|
+
|
59
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
60
|
+
|
61
|
+
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` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
1. Fork it ( https://github.com/[my-github-username]/kijkwijzer/fork )
|
66
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
67
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
68
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
69
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "kijkwijzer"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/kijkwijzer.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'kijkwijzer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "kijkwijzer"
|
8
|
+
spec.version = Kijkwijzer::VERSION
|
9
|
+
spec.authors = ["Maarten Brouwers"]
|
10
|
+
spec.email = ["github.com@murb.nl"]
|
11
|
+
|
12
|
+
spec.summary = "Retrieves the kijkwijzer rating for a particular title and year"
|
13
|
+
spec.description = "Retrieves the kijkwijzer rating for a particular title and year"
|
14
|
+
spec.homepage = "https://github.com/murb/kijkwijzer"
|
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_dependency "nokogiri"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.9"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
end
|
data/lib/kijkwijzer.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require "kijkwijzer/version"
|
2
|
+
include ERB::Util
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'kijkwijzer/result'
|
6
|
+
require 'kijkwijzer/railtie' if defined?(Rails)
|
7
|
+
|
8
|
+
module Kijkwijzer
|
9
|
+
class << self
|
10
|
+
def search_url(search)
|
11
|
+
"http://www.kijkwijzer.nl/index.php?id=3__i&searchfor=#{url_encode(search)}&tab=KIJKWIJZER"
|
12
|
+
end
|
13
|
+
def get_content(search)
|
14
|
+
Nokogiri::HTML(open(search_url(search)))
|
15
|
+
end
|
16
|
+
def search(search, filter={})
|
17
|
+
res = get_content(search)
|
18
|
+
results = []
|
19
|
+
res.css('.content_hok .nieuwsitem').each do |result|
|
20
|
+
r = Result.new()
|
21
|
+
r.title = result.css('b').text
|
22
|
+
meta_parse = result.text.match(/Productietype\:\s(.*)\.\sProductiejaar\:\s(\d\d\d\d)\.\s/)
|
23
|
+
r.year = meta_parse[2].to_i
|
24
|
+
r.production_type = meta_parse[1]
|
25
|
+
r.ratings = result.css("img").collect{|a| a.attr("src").match(/\/images\/icons\/M_(.*)\.png/)[1]}
|
26
|
+
include_r = true
|
27
|
+
filter.each do |key, value|
|
28
|
+
include_r = (r.send(key) == value)
|
29
|
+
end
|
30
|
+
results << r if include_r
|
31
|
+
end
|
32
|
+
results
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/kijkwijzer.svg
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" version="1.1" id="kijkwijzer-icon-defs" style="display:none">
|
2
|
+
<defs>
|
3
|
+
<g id="kijkwijzer_base">
|
4
|
+
<circle fill="#000" stroke-width="0" cx="50" cy="50" r="50" />
|
5
|
+
</g>
|
6
|
+
<g id="kijkwijzer_al">
|
7
|
+
<path id="path34" d="m40.1 80.77 0-16.6-7.77 0 0 16.6-11.5 0 0-55.5 6.43-6.53 18.03 0 6.32 6.64 0 55.4-11.5 0zm-7.77-26.98 7.77 0 0-24.58-7.77 0 0 24.58zm26.64 26.98 0-62.03 11.6 0 0 52.38 10.36 0 0 9.65-21.97 0" fill="#fff"/>
|
8
|
+
</g>
|
9
|
+
<g id="kijkwijzer_6">
|
10
|
+
<path id="path38" d="m60.21 80.77-20.41 0-6.43-6.43 0-48.86 6.32-6.54 20.52 0 6.42 6.54 0 11.82-12.12 0 0-7.88-8.91 0 0 17.84 3.73-3.53 10.78 0 6.53 6.33 0 24.38-6.42 6.33zM45.6 70.39l9.02 0 0-16.28-9.02 0 0 16.28z" fill="#fff"/>
|
11
|
+
</g>
|
12
|
+
<g id="kijkwijzer_9">
|
13
|
+
<path id="path38" d="m60.21 80.77-20.41 0-6.43-6.43 0-48.86 6.32-6.54 20.52 0 6.42 6.54 0 11.82-12.12 0 0-7.88-8.91 0 0 17.84 3.73-3.53 10.78 0 6.53 6.33 0 24.38-6.42 6.33zM45.6 70.39l9.02 0 0-16.28-9.02 0 0 16.28z" fill="#fff" transform = "rotate(-180 50 50)"/>
|
14
|
+
</g>
|
15
|
+
<g id="kijkwijzer_12">
|
16
|
+
<path id="path42" d="m24.66 80.87 0-52.28-7.77 0 0-6.02 10.36-3.63 9.53 0 0 61.93-12.13 0zm32.96-16.18 0 5.29 21.04 0 0 10.89-33.27 0 0-21.78 21.25-17.64 0-11.93-8.91 0 0 8.19-12.33 0 0-12.34 6.43-6.43 20.62 0 6.42 6.54 0 21.47-21.24 17.74" fill="#fff"/>
|
17
|
+
</g>
|
18
|
+
<g id="kijkwijzer_16">
|
19
|
+
<path id="path46" d="m24.14 80.87 0-52.28-7.77 0 0-6.02 10.47-3.63 9.43 0 0 61.93-12.13 0zm47.67 0-20.42 0-6.42-6.43 0-48.86 6.32-6.65 20.51 0 6.43 6.54 0 11.82-12.12 0 0-7.88-8.91 0 0 17.95 3.73-3.63 10.88 0 6.43 6.33 0 24.48-6.43 6.32zm-14.61-10.48 9.02 0 0-16.28-9.02 0 0 16.28z" fill="#fff"/>
|
20
|
+
</g>
|
21
|
+
<g id="kijkwijzer_violence">
|
22
|
+
<path id="path58" d="M31.61 83.36C27.26 80.25 25.4 72.98 27.78 69.14 23.53 70.6 16.07 70.29 12.64 65.62 9.74 61.47 8.4 52.03 13.37 44.56c6.01-9.13 15.44-8.09 21.86-3.73 9.54 6.43 13.58 11.1 12.44 14.53-0.42 1.14-1.35 1.97-2.7 2.38-4.46 1.35-16.06-3.11-20.52-9.65-0.93-1.34-5.18 2.08-2.07 5.71 2.38 2.9 6.42 5.4 10.06 6.23-0.11 1.56 0.52 4.25 1.66 5.81 2.69 3.53 7.15 4.46 10.47 3.22-1.45 2.7-2.49 6.64-0.83 8.92 1.66 2.28 3.83 3.53 6.01 3.32-4.46 6.23-14.2 4.98-18.14 2.07zM73.26 71.11c0.52 3.01 1.66 13.28 1.66 13.28 0.31 2.18-1.25 3.01-2.18 2.7L60.11 82.63c-0.51-0.1-0.73-0.83-0.51-1.46 0.21-0.62 0.73-0.93 1.24-0.72l9.64 1.14-1.76-10.69c-0.2-1.14 0.62-2.7 1.76-3.42L79.59 61.26 66.22 51.2C65.39 50.37 65.49 49.23 66.02 48.5l9.95-15.67-18.04 0.21c-1.14 0-1.96-0.93-2.18-2.18l-1.96-12.45-9.54 6.74c-1.66 1.15-2.8 1.35-4.45 0.42L31.71 18.93 30.26 29.52c-0.2 1.45-2.79 2.07-2.79 0L27.36 13.85c0-2.07 2.28-2.9 3.32-1.97 0 0 8.6 7.68 11.3 10.17 4.97-4.77 10.88-10.17 13.16-12.14 1.45-1.35 4.05-0.62 4.15 1.14 0 0 0.72 10.58 0.83 17.22 6.63-0.93 19.28-2.8 19.28-2.8 5.7-0.83 6.84 4.36 4.67 7.26 0 0-6.43 9.44-12.74 16.49 8.08 3.94 15.54 7.88 15.54 7.88 3.21 1.66 1.87 5.5 0.31 6.33 0 0-6.53 3.73-13.89 7.67zM44.56 43.52c-1.45-1.35-3.42-3.11-5.8-4.77-1.87-1.24-5.81-3.1-7.98-3.52 4.35-3.32 10.67-6.95 14.92-1.97 3.21 3.73 1.76 7.47-1.14 10.27zm8.81 16.8c-8.91 6.85-13.26 5.71-15.75 2.6-0.52-0.62-0.94-1.77-1.04-2.29 3.73 1.04 7.25 1.04 9.95 0.21 2.28-0.73 3.94-2.18 4.77-4.36 1.24-3.63-1.04-7.88-4.45-11.31 4.66-3.73 9.43-3.73 12.53 0.62 4.05 5.71-1.55 11.1-6.01 14.52zm7.05 14.01c-5.59 4.57-10.25 2.81-11.6 1.04-1.87-2.49-1.14-6.33 5.18-11.1 3.42-2.59 7.67-5.18 10.77-0.83 3.11 4.35-0.92 8.2-4.35 10.89" fill="#fff"/>
|
23
|
+
</g>
|
24
|
+
<g id="kijkwijzer_scary">
|
25
|
+
<path id="path50" d="m85.49 47.57c-1.97 2.07-11.92 6.33-14.29 6.74-3.11 0.62-16.8 0-16.8 1.04-0.1 1.14 11.81 2.59 13.99 3.42 2.28 0.83 9.02 4.45 10.67 6.95 2.18 3.22 4.04 16.4-1.24 16.5-2.28 0.1-3-12.24-3.83-14.01-0.52-1.03-6.63-5.29-8.08-6.01-1.45-0.73-12.23-4.36-12.33-3.64-0.21 1.04 8.19 5.61 10.47 8.41 1.87 2.28 3.11 9.44 3 11.82 0 2.39-6.01 14.01-10.05 11.93-1.56-0.83 3.94-11.62 3.94-12.76-0.11-1.87 0.1-6.22-0.52-7.99-0.72-2.07-6.11-8.4-7.15-7.88-0.41 0.21 0.73 6.22-1.14 6.22-1.45 0-1.04-6.33-2.59-6.33-1.56 0-1.14 6.33-2.59 6.33-1.76 0-0.72-6.01-1.14-6.22-1.04-0.51-6.42 5.81-7.15 7.88-0.62 1.76-0.41 6.12-0.41 7.99-0.11 1.14 5.49 11.93 3.83 12.76-4.04 2.07-9.94-9.55-10.05-11.93-0.1-2.38 1.15-9.54 3.01-11.82 2.28-2.8 10.67-7.37 10.47-8.41-0.1-0.73-10.88 2.91-12.33 3.64-1.46 0.73-7.57 4.98-7.98 6.01-0.93 1.77-1.55 14.11-3.94 14.01-5.29-0.1-3.42-13.28-1.24-16.5 1.66-2.49 8.5-6.12 10.68-6.95 2.28-0.83 14.09-2.28 13.99-3.42 0-1.04-13.58-0.42-16.79-1.04C25.49 53.9 15.54 49.64 13.57 47.57 10.57 44.45 8.08 31.18 13.47 25.26c1.34-1.45 3.52 16.19 4.87 17.95 1.25 1.76 8.7 6.95 10.88 7.36 1.35 0.22 15.86 2.39 16.17 1.25 0.31-1.03-12.95-4.25-16.07-6.01C25.28 43.52 23.31 30.14 23.94 26.41 24.66 21.64 33.99 6.18 40.72 8.56 42.49 9.18 30.88 25.16 30.36 28.07c-0.31 1.66 0.2 13.07 1.97 14.21 0.62 0.41 14.09 7.25 14.61 6.53 0.52-1.04-8.91-7.68-8.91-11.41 0-7.67 8.29-18.77 11.5-18.77 3.32 0 11.5 11.1 11.5 18.77 0 3.74-9.43 10.38-8.91 11.41 0.51 0.72 13.99-6.12 14.71-6.53C68.5 41.14 69.02 29.73 68.71 28.07 68.19 25.16 56.68 9.18 58.45 8.56 65.08 6.18 74.4 21.64 75.13 26.41c0.62 3.73-1.35 17.11-5.39 19.4-3.11 1.77-16.37 4.98-16.06 6.01 0.32 1.14 14.83-1.03 16.27-1.25 2.07-0.41 9.53-5.6 10.88-7.36 1.25-1.77 3.53-19.4 4.87-17.95 5.49 5.81 2.8 19.19-0.21 22.31" fill="#fff"/>
|
26
|
+
</g>
|
27
|
+
<g id="kijkwijzer_sex">
|
28
|
+
<path id="path70" d="m14.2 45.29c-0.62 0.52-1.56 0.11-2.07-0.41 0.31 0.93 0.1 2.07-0.31 2.39-0.62 0.41-1.45 0.41-2.07-0.42 0.52 0.93 0.41 1.97 0.1 2.49-0.41 0.52-1.86 0.62-2.9-0.62-1.66-2.18 0-4.98 1.45-3.94-1.14-2.18 0.93-4.57 2.28-3.53-0.21-3 2.59-3.94 3.73-1.45 0.72 1.77 0.62 4.88-0.2 5.5zM29.01 84.29C26.32 84.91 22.59 82.32 16.68 72.98 10.99 64.17 9.84 60.12 9.53 56.07 9.22 52.24 12.12 48.81 15.33 47.46c3.52-1.45 7.46-1.03 8.08 3.43 0.83 5.19-9.22 12.03-4.45 19.19 5.18 7.99 9.12 2.7 12.13 7.27 1.45 2.18 0.93 6.23-2.07 6.95zM18.75 44.56c-1.45-0.21-2.9-5.6-2.59-8.3 0.31-3.32 4.46-4.05 5.91-0.83 1.35 3.22-1.45 9.34-3.32 9.13zm13.89 21.58c-1.35 1.56-4.04-1.04-3.11-3.83-1.65 1.55-3.73-1.56-2.18-4.67 0.93-1.77 2.59-1.98 3.11-1.56 0.52 0.52 0.83 1.76 0.31 3.01 0.73-1.04 1.66-1.25 2.28-0.83 0.62 0.31 0.93 1.66 0.73 2.9 0.52-0.83 1.55-1.56 2.28-1.14 1.14 0.62 1.56 4.67 0.94 7.05-0.94 3.31-4.25 2.7-4.35-0.93zM37.62 32.32c-2.38 9.44 7.46 12.96 7.98 18.77 0.52 5.08-2.39 7.16-6.32 6.74-3.63-0.31-8.7-3.94-9.53-8.09-0.94-4.36-0.31-8.71 3.11-20.33 3.42-11.93 7.15-18.15 10.05-17.74 4.15 0.52 5.19 4.46 4.25 7.37-1.77 5.91-6.32 1.04-9.54 13.28zm1.35 38.38c-0.52-3.11 0.83-10.06 2.39-10.27 2.07-0.21 5.7 7.47 4.35 11.31-1.35 3.63-6.01 2.91-6.74-1.04zM60.73 57.84c-3.94 0.42-6.95-1.66-6.43-6.74 0.62-5.81 10.47-9.33 7.98-18.77-3.21-12.24-7.67-7.37-9.43-13.28-0.83-2.9 0-6.85 4.15-7.37 3.01-0.41 6.74 5.81 10.16 17.74 3.31 11.62 3.94 15.98 3.11 20.33-0.83 4.15-5.9 7.78-9.53 8.09zm-6.43 13.9c-1.35-3.84 2.18-11.51 4.25-11.31 1.65 0.21 3 7.16 2.38 10.27-0.72 3.94-5.28 4.67-6.63 1.04zm16.06-9.43c1.04 2.79-1.76 5.39-3.11 3.83 0 3.63-3.42 4.25-4.35 0.93-0.62-2.39-0.1-6.43 1.04-7.05 0.62-0.42 1.65 0.31 2.18 1.14-0.21-1.24 0.21-2.59 0.73-2.9 0.73-0.42 1.66-0.21 2.28 0.83-0.41-1.25-0.21-2.49 0.41-3.01 0.42-0.41 2.08-0.2 3 1.56 1.56 3.11-0.52 6.22-2.17 4.67zm12.96 10.68c-6.01 9.33-9.74 11.93-12.44 11.31-2.9-0.72-3.52-4.77-2.08-6.95 3.01-4.57 6.95 0.72 12.23-7.27 4.66-7.15-5.29-14-4.45-19.19 0.72-4.46 4.45-4.87 7.98-3.43 3.21 1.35 6.11 4.78 5.9 8.61-0.31 4.05-1.56 8.09-7.15 16.91zm-2.07-28.42c-1.98 0.21-4.77-5.91-3.32-9.13 1.34-3.22 5.39-2.49 5.81 0.83 0.3 2.7-1.15 8.09-2.49 8.3zm8.91 4.77c-0.42-0.52-0.52-1.56 0-2.49-0.62 0.83-1.45 0.83-2.07 0.42-0.31-0.32-0.52-1.46-0.31-2.39-0.52 0.52-1.35 0.93-1.97 0.41-0.93-0.62-1.04-3.73-0.21-5.5 1.04-2.49 3.94-1.55 3.63 1.45 1.35-1.04 3.53 1.35 2.27 3.53 1.57-1.04 3.11 1.76 1.46 3.94-0.93 1.24-2.38 1.14-2.8 0.62" fill="#fff"/>
|
29
|
+
</g>
|
30
|
+
<g id="kijkwijzer_discrimination">
|
31
|
+
<path id="path54" d="M63.11 88.24C66.42 79.83 68.5 58.25 59.9 52.13 55.13 48.71 52.23 53.59 51.5 50.99 49.84 45.08 46.22 33.98 39.58 38.02c-4.87 3.01-4.76 10.79-0.83 13.07 3.94 2.28 9.43 2.6 9.53 3.52 0.31 2.49-5.49 4.25-1.35 11.93 5.39 9.96 0.31 18.57-1.24 23.24C30.78 88.75 14.3 76.31 12.33 63.96 10.15 49.75 18.97 53.28 18.44 49.34 17.72 43.94 4.25 30.35 16.58 27.96c12.13-2.28 5.39 14.94 6.53 19.92 0.41 2.07 4.15-1.25 6.11-1.66-0.2-1.77-0.51-6.02-0.31-7.16 1.77-7.99 9.02-6.12 8.4-9.65-0.63-3.53-12.64-19.19 0.83-19.92 12.33-0.62 4.56 14.32 4.77 18.99 0.21 4.67 8.4 0.41 10.88 8.81 2.38-1.35 4.87-1.03 5.18-2.9 1.04-5.19-10.57-22.72 4.04-21.27 12.74 1.25 1.76 16.08 1.35 20.96-0.41 4.98 6.53 3.74 7.67 7.88 1.04 3.95 0.41 7.26 0.32 8.3 2.28-0.61 5.7-0.82 5.59-3.1-0.11-4.88-7.25-18.78 4.46-18.99 12.23-0.32 0.93 16.39 0.52 20.23-0.42 3.73 6.84 0.94 6.01 11.51-0.73 10.47-12.33 24.69-25.8 28.32zm-12.75 1.56c2.27-4.05 5.39-11.73 6.84-11.83 1.76-0.2 1.55 7.06 1.14 11.31-2.28 0.41-5.6 0.52-7.98 0.52" fill="#fff"/>
|
32
|
+
</g>
|
33
|
+
<g id="kijkwijzer_drugs">
|
34
|
+
<path id="path62" d="m72.86 29.52c-1.25 0-3.53 2.38-3.53 4.36 0 2.48 16.27 14.82 13.37 18.77-2.28 3.11-11.6-6.22-15.03-3.52-3.31 2.59-15.33 18.87-20.31 23.13-4.56 3.74-7.05 0-8.6 1.45-1.66 1.56-4.35 2.18-6.63 0.62-5.18 6.33-10.26 9.96-10.78 9.34-0.62-0.62 1.97-6.22 6.73-11.82-1.86-2.28-1.76-5.18-0.41-7.05 1.45-2.18-1.14-3.84 1.14-8.2 1.98-3.73 17.73-19.3 18.87-22.2 1.03-2.8-7.47-11.93-4.77-13.9 2.59-1.86 17.72 8.31 19.9 8.31 1.65 0 3.31-1.35 3.93-3.12C67.36 24.02 60.73 15.41 63.22 13.24 66.84 10.01 89.13 28.07 85.7 32.01 83.53 34.5 75.13 29.62 72.86 29.52ZM38.03 55.66c-4.04-0.73-7.36 1.98-3.21 2.6 4.15 0.62 8.29 6.64 9.64 4.67 1.35-2.07-0.52-6.12-6.43-7.26zm5.39-9.44c-4.87-0.2-5.91 1.87-0.94 3.32 5.29 1.56 9.23 7.57 10.88 5.09 1.66-2.49-1.86-7.99-9.95-8.4zm8.29-8.4c-3.94-0.31-5.18 1.14-1.25 2.8 3.73 1.66 7.77 6.02 9.12 4.05 1.34-2.07-0.52-6.23-7.88-6.85" fill="#fff"/>
|
35
|
+
</g>
|
36
|
+
<g id="kijkwijzer_language">
|
37
|
+
<path id="path66" d="m44.36 40.93c-1.15 1.24-1.56 14.31-4.56 15.76-2.9 1.34-11.82-7.47-13.27-7.16-1.86 0.42-2.07 16.6-7.46 19.61-7.77 4.46-11.61-7.16-3.84-9.44 4.05-1.25 3.94-16.7 7.88-18.57 3.01-1.45 13.37 9.34 14.61 8.62 1.56-1.04 2.59-11 4.25-12.24 1.35-1.04 10.57-3.01 13.99-3.43 1.35-0.1 1.55 1.35 0.42 1.98-3.01 1.55-11.3 3.94-12.02 4.88zm7.26-11.94c-1.56-1.04-5.49-3.22-6.53-3.1-1.25 0.1-5.7 6.32-8.09 5.7-2.38-0.62-3.72-8.81-5.59-9.13-3.11-0.62-8.29 7.89-10.16 1.45-1.86-6.43 9.43-8.09 12.34-6.85 2.06 0.94 3.83 8.3 4.97 8.61 1.56 0.31 4.87-3.73 6.84-3.73 1.86 0 5.69 3.83 7.14 5.81 0.83 1.04-0.1 1.76-0.93 1.24zm26.63 14.32c-5.29 7.05-9.01 6.95-9.54 9.02-1.04 4.04 4.14 2.7 3.52 7.78-0.62 4.46-3.31 5.7-3.63 12.24-0.31 5.5 3.22 14.93 0.83 15.77-2.9 0.93-6.84-13.49-9.95-13.17-3.21 0.41-0.21 18.14-3.21 17.42-5.29-1.35-9.64-29.88-2.59-37.34 3.63-3.83 6.64-1.14 8.29-3.73 2.18-3.53-5.6-3.11-2.79-11.52 4.66 6.95 9.84 8.3 13.16 4.46 4.25-4.87 5.28-18.36-9.22-20.43 2.59-6.96 10.98-8.51 16.88-3.95 6.32 4.98 2.91 17.22-1.76 23.45" fill="#fff"/>
|
38
|
+
</g>
|
39
|
+
</defs>
|
40
|
+
</svg>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Kijkwijzer
|
2
|
+
class Result
|
3
|
+
attr_accessor :title
|
4
|
+
attr_accessor :production_type
|
5
|
+
attr_accessor :year
|
6
|
+
attr_accessor :ratings
|
7
|
+
|
8
|
+
def ratings
|
9
|
+
@ratings.collect do |rating|
|
10
|
+
rating = rating.to_s.downcase
|
11
|
+
rv = nil
|
12
|
+
rv = rating if ["al","6","9","12","16"].include? rating
|
13
|
+
rv = "violence" if ["violence","g"].include? rating
|
14
|
+
rv = "scary" if ["scary","a"].include? rating
|
15
|
+
rv = "sex" if ["sex","s"].include? rating
|
16
|
+
rv = "drugs" if ["drugs","h"].include? rating
|
17
|
+
rv = "discrimination" if ["discrimination","d"].include? rating
|
18
|
+
rv = "language" if ["language","t"].include? rating
|
19
|
+
rv
|
20
|
+
end.compact
|
21
|
+
end
|
22
|
+
|
23
|
+
def to_s
|
24
|
+
"#<Kijkwijzer::Result @title=\"#{title}\", @year=#{year}>"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Kijkwijzer
|
2
|
+
module ViewHelpers
|
3
|
+
def render_kijkwijzer_svg_definitions
|
4
|
+
svg_txt = File.open(open(File.join(File.dirname(__FILE__),'..','kijkwijzer.svg'))).read
|
5
|
+
svg_txt = svg_txt.html_safe if defined?(ActiveSupport)
|
6
|
+
svg_txt
|
7
|
+
end
|
8
|
+
def render_kijkwijzers result
|
9
|
+
result_svgs = ""
|
10
|
+
result.ratings.each do |rating|
|
11
|
+
result_svgs+="<div class=\"kijkwijzer icons\"><svg viewBox=\"0 0 100 100\" class=\"icon kijkwijzer_#{rating}\" title=\"#{rating}\" ><use xlink:href=\"#kijkwijzer_base\"></use><use xlink:href=\"#kijkwijzer_#{rating}\"></use></svg></div>"
|
12
|
+
end
|
13
|
+
result_svgs
|
14
|
+
result_svgs = result_svgs.html_safe if defined?(ActiveSupport)
|
15
|
+
result_svgs
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kijkwijzer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Maarten Brouwers
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.9'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
description: Retrieves the kijkwijzer rating for a particular title and year
|
56
|
+
email:
|
57
|
+
- github.com@murb.nl
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- kijkwijzer.gemspec
|
73
|
+
- lib/kijkwijzer.rb
|
74
|
+
- lib/kijkwijzer.svg
|
75
|
+
- lib/kijkwijzer/railtie.rb
|
76
|
+
- lib/kijkwijzer/result.rb
|
77
|
+
- lib/kijkwijzer/version.rb
|
78
|
+
- lib/kijkwijzer/view_helpers.rb
|
79
|
+
homepage: https://github.com/murb/kijkwijzer
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.2.2
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Retrieves the kijkwijzer rating for a particular title and year
|
103
|
+
test_files: []
|