mediasearch 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +84 -0
- data/Rakefile +1 -0
- data/lib/mediasearch.rb +49 -0
- data/lib/mediasearch/configuration.rb +9 -0
- data/lib/mediasearch/media.rb +4 -0
- data/lib/mediasearch/movie.rb +20 -0
- data/lib/mediasearch/tv.rb +20 -0
- data/lib/mediasearch/version.rb +3 -0
- data/mediasearch.gemspec +25 -0
- metadata +112 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d7fdd584ac9ee7a01b17e2daee2d0f31e5820028
|
4
|
+
data.tar.gz: 6f0fa0b9460a88306bc02901c1df0b0f57f91e59
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17e38740a2a0e5e7cba20667830b395f28b179bcae55a68a5ebb12c7b159360d2107632361f80233f5fb4de09bf74dbad591f3a34b8839e922bfaf96de7376fe
|
7
|
+
data.tar.gz: 66b32801e704c9e8aa94e949a3525a675eb3e4435c098b3dde2658b9fd56523c0dc93a96fff1004ad2517b8361c66c30b1d55cafc71b212a279f32aa51fe76a4
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Benjamin Hsieh
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Mediasearch
|
2
|
+
|
3
|
+
Searches multiple libraries for movies and tv shows, maybe music someday.
|
4
|
+
|
5
|
+
## Libraries
|
6
|
+
|
7
|
+
Current dependencies in use with `mediasearch`.
|
8
|
+
|
9
|
+
### Movies
|
10
|
+
|
11
|
+
* [themoviedb](http://github.com/sicophrenic/themoviedb)
|
12
|
+
* [tvdb_party](http://github.com/sicophrenic/tvdb_party)
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
Add this line to your application's Gemfile:
|
17
|
+
|
18
|
+
gem 'mediasearch'
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install mediasearch
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
```
|
31
|
+
# Require the Mediasearch gem
|
32
|
+
require 'mediasearch'
|
33
|
+
|
34
|
+
# Throw in your API keys
|
35
|
+
Mediasearch.init_tmdb do |config|
|
36
|
+
config.api_key = 'TMDB_API_KEY'
|
37
|
+
end
|
38
|
+
|
39
|
+
Mediasearch.init_tvdb do |config|
|
40
|
+
config.api_key = 'TVDB_API_KEY'
|
41
|
+
end
|
42
|
+
|
43
|
+
# Or do it all at once
|
44
|
+
Mediasearch.init({
|
45
|
+
:tmdb => 'TMDB_API_KEY',
|
46
|
+
:tvdb => 'TVDB_API_KEY'
|
47
|
+
})
|
48
|
+
|
49
|
+
# Now search for a movie
|
50
|
+
Mediasearch::Movie.search('captain winter')
|
51
|
+
=> [#<Tmdb::Movie:0x007fe7a28c1ae0
|
52
|
+
@adult=false,
|
53
|
+
@backdrop_path="/4qfXT9BtxeFuamR4F49m2mpKQI1.jpg",
|
54
|
+
@id=100402,
|
55
|
+
@original_title="Captain America: The Winter Soldier",
|
56
|
+
@popularity=70.4275084023071,
|
57
|
+
@poster_path="/pH4oeiZAh9a40tly4D0l6aAB3ms.jpg",
|
58
|
+
@release_date="2014-04-04",
|
59
|
+
@title="Captain America: The Winter Soldier",
|
60
|
+
@vote_average=6.6,
|
61
|
+
@vote_count=90>]
|
62
|
+
|
63
|
+
# Or maybe a tv show (note the lowercase 'v' in 'Tv')
|
64
|
+
Mediasearch::Tv.search('game thrones')
|
65
|
+
=> [{"seriesid"=>"121361",
|
66
|
+
"language"=>"en",
|
67
|
+
"SeriesName"=>"Game of Thrones",
|
68
|
+
"banner"=>"graphical/121361-g19.jpg",
|
69
|
+
"Overview"=>
|
70
|
+
"Seven noble families fight for control of the mythical land of Westeros. Friction between the houses leads to full-scale war. All while a very ancient evil awakens in the farthest north. Amidst the war, a neglected military order of misfits, the Night's Watch, is all that stands between the realms of men and icy horrors beyond.",
|
71
|
+
"FirstAired"=>"2011-04-17",
|
72
|
+
"Network"=>"HBO",
|
73
|
+
"IMDB_ID"=>"tt0944947",
|
74
|
+
"zap2it_id"=>"SH01389809",
|
75
|
+
"id"=>"121361"}]
|
76
|
+
```
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
1. Fork it ( http://github.com/benspotatoes/mediasearch/fork )
|
81
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
82
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
83
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
84
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/mediasearch.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require "mediasearch/version"
|
2
|
+
require 'mediasearch/configuration'
|
3
|
+
require 'mediasearch/media'
|
4
|
+
require 'mediasearch/movie'
|
5
|
+
require 'mediasearch/tv'
|
6
|
+
|
7
|
+
module Mediasearch
|
8
|
+
class << self
|
9
|
+
def tmdb_config
|
10
|
+
@tmdb_config ||= Configuration.new
|
11
|
+
end
|
12
|
+
|
13
|
+
def tvdb_config
|
14
|
+
@tvdb_config ||= Configuration.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def init_tmdb
|
18
|
+
unless tmdb_config
|
19
|
+
tmdb_config
|
20
|
+
end
|
21
|
+
yield(@tmdb_config)
|
22
|
+
end
|
23
|
+
|
24
|
+
def init_tvdb
|
25
|
+
unless tvdb_config
|
26
|
+
tvdb_config
|
27
|
+
end
|
28
|
+
yield(@tvdb_config)
|
29
|
+
end
|
30
|
+
|
31
|
+
def tmdb_ready?
|
32
|
+
!tmdb_config.api_key.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
def tvdb_ready?
|
36
|
+
!tvdb_config.api_key.nil?
|
37
|
+
end
|
38
|
+
|
39
|
+
def init(api_keys)
|
40
|
+
if api_keys[:tvdb] && api_keys[:tmdb]
|
41
|
+
tvdb_config.api_key = api_keys[:tvdb]
|
42
|
+
tmdb_config.api_key = api_keys[:tmdb]
|
43
|
+
return api_keys
|
44
|
+
else
|
45
|
+
raise ArgumentError, 'Invalid API keys.'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'themoviedb'
|
2
|
+
|
3
|
+
module Mediasearch
|
4
|
+
class Movie < Media
|
5
|
+
def self.check_config
|
6
|
+
if Mediasearch.tmdb_ready?
|
7
|
+
Tmdb::Api.key(Mediasearch.tmdb_config.api_key)
|
8
|
+
yield
|
9
|
+
else
|
10
|
+
raise ArgumentError, 'TMDB not configured.'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.search(query)
|
15
|
+
check_config do
|
16
|
+
Tmdb::Movie.find(query)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'tvdb_party'
|
2
|
+
|
3
|
+
module Mediasearch
|
4
|
+
class Tv < Media
|
5
|
+
def self.check_client
|
6
|
+
if Mediasearch.tvdb_ready?
|
7
|
+
@client = TvdbParty::Search.new(Mediasearch.tvdb_config.api_key)
|
8
|
+
yield
|
9
|
+
else
|
10
|
+
raise ArgumentError, 'TVDB not configured.'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.search(query)
|
15
|
+
check_client do
|
16
|
+
@client.search(query)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/mediasearch.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 'mediasearch/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mediasearch"
|
8
|
+
spec.version = Mediasearch::VERSION
|
9
|
+
spec.authors = ["Benjamin Hsieh, Ben's Potatoes"]
|
10
|
+
spec.email = ["benspotatoes@gmail.com"]
|
11
|
+
spec.summary = %q{Searches multiple libraries for media titles.}
|
12
|
+
spec.description = %q{Makes searching for movies and tv shows easier.}
|
13
|
+
spec.homepage = "http://github.com/benspotatoes/effulgent-water"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'tvdb_party', '~> 0.7.0'
|
24
|
+
spec.add_development_dependency 'themoviedb', '~> 0.0.21'
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mediasearch
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Benjamin Hsieh, Ben's Potatoes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tvdb_party
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.7.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.7.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: themoviedb
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.0.21
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.0.21
|
69
|
+
description: Makes searching for movies and tv shows easier.
|
70
|
+
email:
|
71
|
+
- benspotatoes@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- LICENSE.txt
|
79
|
+
- README.md
|
80
|
+
- Rakefile
|
81
|
+
- lib/mediasearch.rb
|
82
|
+
- lib/mediasearch/configuration.rb
|
83
|
+
- lib/mediasearch/media.rb
|
84
|
+
- lib/mediasearch/movie.rb
|
85
|
+
- lib/mediasearch/tv.rb
|
86
|
+
- lib/mediasearch/version.rb
|
87
|
+
- mediasearch.gemspec
|
88
|
+
homepage: http://github.com/benspotatoes/effulgent-water
|
89
|
+
licenses:
|
90
|
+
- MIT
|
91
|
+
metadata: {}
|
92
|
+
post_install_message:
|
93
|
+
rdoc_options: []
|
94
|
+
require_paths:
|
95
|
+
- lib
|
96
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 2.2.2
|
109
|
+
signing_key:
|
110
|
+
specification_version: 4
|
111
|
+
summary: Searches multiple libraries for media titles.
|
112
|
+
test_files: []
|