where_to 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/where_to/configuration.rb +2 -1
- data/lib/where_to/locator.rb +5 -0
- data/lib/where_to/tvdb.rb +53 -0
- data/lib/where_to/version.rb +1 -1
- data/where_to.gemspec +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzY0MmExOTdkYjBiMzk1OWQyMmNjNzkyZTk3YmU0MzdiZDMxM2YzNQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGEyMDc5NzhhNDliYzFhZDllZjA0NjkwODUyOThlNGM4NDJhZTAwYg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGI0MmE3Y2VjNmI4OGE3NWVmMjI1YmM5ZGQyNDI2NGE5YTcyOGQzYTg5Y2Q5
|
10
|
+
NTI3YTNiNTQwODg1YWI2YWExZjJhZjQ3Y2I2M2FiNTIyM2IzOTI5ODk3Yzkw
|
11
|
+
YWMyZTRiNjFkYmIxNjU3MTMzY2RiNzg4ZjNiZTljM2E3NjM0ZTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZGRhZGUxMzBiNjVlOGNjNmY2OWViNmIyZTZjOTJmN2RjYTcxZjUwM2EwZjA2
|
14
|
+
NzdhNDJmMDBmNmNiYTMzMWU0MWM1NzNhYjQ3YTdlMmE3ZGFmZmYwNTc5OTE5
|
15
|
+
YzFmYTQ5ZjJkNTYwZTIwZGRjZWM2ZWUyNWE1ZmQ5NzNjZTY1NzA=
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module WhereTo
|
2
2
|
class Configuration
|
3
|
-
attr_accessor :folder_format
|
3
|
+
attr_accessor :folder_format, :tvdb_api_key
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@folder_format = "%series_title/Season %season_number (%season_airdate)/"
|
7
|
+
@tvdb_api_key = "You need to get one before you can lookup episode information automatically"
|
7
8
|
end
|
8
9
|
|
9
10
|
def folder_format
|
data/lib/where_to/locator.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'tvdb_party'
|
2
|
+
|
3
|
+
module WhereTo
|
4
|
+
class TVDB
|
5
|
+
attr_accessor :series_title, :episode_number, :season, :episode_title
|
6
|
+
attr_reader :api_key
|
7
|
+
|
8
|
+
def initialize(params = {})
|
9
|
+
load_values_from params
|
10
|
+
@api_key = WhereTo.configuration.tvdb_api_key
|
11
|
+
@db = TvdbParty::Search.new api_key
|
12
|
+
end
|
13
|
+
|
14
|
+
def lookup!
|
15
|
+
validate!
|
16
|
+
results = @db.search(series_title).first
|
17
|
+
series = @db.get_series_by_id results['seriesid']
|
18
|
+
episode = series.get_episode season, episode_number
|
19
|
+
@episode_title = episode.name
|
20
|
+
|
21
|
+
updated = {}
|
22
|
+
updated[:episode_title] = episode_title
|
23
|
+
updated
|
24
|
+
rescue URI::InvalidURIError
|
25
|
+
raise 'You need to configure your TVDB API key before looking up episode information'
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate!
|
29
|
+
raise 'A series title is required to lookup episode information' if series_title.nil?
|
30
|
+
raise 'An episode number is required to lookup episode information' if episode_number.nil?
|
31
|
+
raise 'A season number is required to lookup episode information' if season.nil?
|
32
|
+
true
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def set_unless_nil(key, value)
|
38
|
+
send("#{key}=".to_sym, value) unless value.nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
def load_values_from(hash = {})
|
42
|
+
set_unless_nil :series_title, hash[:series_title]
|
43
|
+
set_unless_nil :airdate, hash[:airdate]
|
44
|
+
set_unless_nil :season, hash[:season_number]
|
45
|
+
set_unless_nil :season, hash[:season]
|
46
|
+
set_unless_nil :season_airdate, hash[:season_airdate]
|
47
|
+
set_unless_nil :episode_title, hash[:episode_title]
|
48
|
+
set_unless_nil :episode_number, hash[:episode_number]
|
49
|
+
set_unless_nil :episode_quality, hash[:episode_quality]
|
50
|
+
set_unless_nil :episode_extension, hash[:episode_extension]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/where_to/version.rb
CHANGED
data/where_to.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: where_to
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Toniazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: tvdb_party
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.8.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.8.0
|
83
97
|
description:
|
84
98
|
email:
|
85
99
|
- jutonz42@gmail.com
|
@@ -100,6 +114,7 @@ files:
|
|
100
114
|
- lib/where_to/episode_formatter.rb
|
101
115
|
- lib/where_to/location.rb
|
102
116
|
- lib/where_to/locator.rb
|
117
|
+
- lib/where_to/tvdb.rb
|
103
118
|
- lib/where_to/version.rb
|
104
119
|
- where_to.gemspec
|
105
120
|
homepage: https://github.com/jutonz/where_to
|