thetvdb_party 0.0.12.pre → 0.0.13.pre
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 +4 -4
- data/README.md +40 -2
- data/lib/thetvdb_party/actor.rb +15 -5
- data/lib/thetvdb_party/banner.rb +98 -21
- data/lib/thetvdb_party/baseepisoderecord.rb +88 -17
- data/lib/thetvdb_party/baseseriesrecord.rb +46 -10
- data/lib/thetvdb_party/client.rb +4 -2
- data/lib/thetvdb_party/searchseriesrecord.rb +24 -13
- data/lib/thetvdb_party/version.rb +1 -1
- data/spec/thetvdb_party/actor_spec.rb +15 -15
- data/spec/thetvdb_party/banner_spec.rb +54 -48
- data/spec/thetvdb_party/baseepisoderecord_spec.rb +404 -6
- data/spec/thetvdb_party/baseseriesrecord_spec.rb +366 -12
- data/spec/thetvdb_party/client_spec.rb +27 -0
- data/spec/thetvdb_party/searchseriesrecord_spec.rb +138 -0
- data/spec/thetvdb_party_spec.rb +16 -7
- data/thetvdb_party.gemspec +1 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce7a724e350ab2d80b5e574e8a796e804d878bf7
|
4
|
+
data.tar.gz: 5a4c17f77cd912885baca62f0af0a1350a3848c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9aa0d56803fd445b98eeb30d9ff4dff8694203bfcaea746cf36411727ac05d67fbdd3b21c67a5b39ff27cc39cb93bca2610d5a0b74db06d143f247bc1347f27
|
7
|
+
data.tar.gz: d0effd5dc336ac05356c698f156b4d82e7b8c584fd42db41f31a9c2494a40b4d6d3b904b6b3ffbac1bcf546613e225963016b21d0b63ddad22ce035923f2c8c4
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# TheTvDbParty
|
1
|
+
# TheTvDbParty [](http://badge.fury.io/rb/thetvdb_party)
|
2
2
|
|
3
3
|
The thetvdb_party gem accesses the TheTvDB programmers API as it is described on http://thetvdb.com/wiki/index.php/Programmers_API
|
4
4
|
|
@@ -22,7 +22,45 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Creating a TheTvDb API client
|
26
|
+
|
27
|
+
To create a new client without an api key:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
client = TheTvDbParty::Client.new
|
31
|
+
```
|
32
|
+
|
33
|
+
Or with an api key:
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
client = TheTvDbParty::Client.new "<your api key>"
|
37
|
+
```
|
38
|
+
|
39
|
+
It is recommended to use an `.env` file or environment variable to store the API key.
|
40
|
+
For example like this:
|
41
|
+
|
42
|
+
Contents of `.env`
|
43
|
+
|
44
|
+
TVDB_API_KEY=<YOUR API KEY>
|
45
|
+
|
46
|
+
### Performing searches
|
47
|
+
|
48
|
+
Once you have a client instance, you can perform searches against the TheTvDb API.
|
49
|
+
The following example searches for `The Mentalist` on TheTvDb.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
results = client.search "The Mentalist"
|
53
|
+
```
|
54
|
+
|
55
|
+
The `#search` method of the client returns an array containing the search results. Iterate over this array to get
|
56
|
+
the **Base Series Record** of the search results.
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
results.each do |search_result_record|
|
60
|
+
base_series_record = search_result_record.get_base_series_record
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
26
64
|
|
27
65
|
## Contributing
|
28
66
|
|
data/lib/thetvdb_party/actor.rb
CHANGED
@@ -2,16 +2,18 @@ module TheTvDbParty
|
|
2
2
|
# Actors holds information about actors
|
3
3
|
# See also:: http://thetvdb.com/wiki/index.php/API:actors.xml
|
4
4
|
class Actor
|
5
|
+
# The client that was used to get this actor
|
6
|
+
attr_reader :client
|
5
7
|
# Useless field, will eventually be used to link actors between series but currently isn't in use and may actually change once it gets fully implemented so don't bother storing it at all.
|
6
8
|
attr_reader :id
|
7
9
|
# Can be appended to <mirrorpath>/banners/ to determine the actual location of the artwork.
|
8
|
-
attr_reader :
|
10
|
+
attr_reader :image_path_relative
|
9
11
|
# The actors real name.
|
10
12
|
attr_reader :name
|
11
13
|
# The name of the actors character in the series.
|
12
14
|
attr_reader :role
|
13
15
|
# An integer from 0-3. 1 being the most important actor on the show and 3 being the third most important actor. 0 means they have no special sort order. Duplicates of 1-3 aren't suppose to be allowed but currently are so the field isn't perfect but can still be used for basic sorting.
|
14
|
-
attr_reader :
|
16
|
+
attr_reader :sort_order
|
15
17
|
|
16
18
|
# Initializes a new Actor as it was retrieved from a given client.
|
17
19
|
# Parameters::
|
@@ -24,13 +26,21 @@ module TheTvDbParty
|
|
24
26
|
read_hash_values
|
25
27
|
end
|
26
28
|
|
29
|
+
def image_path_full
|
30
|
+
if @image_path_relative
|
31
|
+
return (URI::join(BASE_URL, "banners/", @image_path_relative))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
private
|
28
36
|
def read_hash_values
|
29
|
-
@id =
|
30
|
-
@
|
37
|
+
@id = @hashValues["id"]
|
38
|
+
@image_path_relative = @hashValues["Image"]
|
31
39
|
@name = @hashValues["Name"]
|
32
40
|
@role = @hashValues["Role"]
|
33
|
-
|
41
|
+
sort_order = (default @hashValues["SortOrder"], 0).to_i
|
42
|
+
sort_order = sort_order>=0 && sort_order <=3 ? sort_order : 0
|
43
|
+
@sort_order = sort_order
|
34
44
|
|
35
45
|
nil
|
36
46
|
end
|
data/lib/thetvdb_party/banner.rb
CHANGED
@@ -2,18 +2,20 @@ module TheTvDbParty
|
|
2
2
|
# Banner holds information about banners associated with series and seasons.
|
3
3
|
# See Also:: http://thetvdb.com/wiki/index.php/API:banners.xml
|
4
4
|
class Banner
|
5
|
+
# The client that was used to get this banner
|
6
|
+
attr_reader :client
|
5
7
|
# Unique ID for this banner
|
6
8
|
attr_reader :id
|
7
9
|
# Can be appended to <mirrorpath>/banners/ to determine the actual location of the artwork.
|
8
|
-
attr_reader :
|
10
|
+
attr_reader :banner_path_relative
|
9
11
|
# Used exactly the same way as BannerPath, only shows if BannerType is fanart.
|
10
|
-
attr_reader :
|
11
|
-
attr_reader :
|
12
|
+
attr_reader :thumbnail_path_relative
|
13
|
+
attr_reader :vignette_path_relative
|
12
14
|
# This can be poster, fanart, series or season.
|
13
|
-
attr_reader :
|
15
|
+
attr_reader :banner_type
|
14
16
|
# For series banners it can be text, graphical, or blank. For season banners it can be season or seasonwide. For fanart it can be 1280x720 or 1920x1080. For poster it will always be 680x1000.
|
15
17
|
# Blank banners will leave the title and show logo off the banner. Text banners will show the series name as plain text in an Arial font. Graphical banners will show the series name in the show's official font or will display the actual logo for the show. Season banners are the standard DVD cover format while wide season banners will be the same dimensions as the series banners.
|
16
|
-
attr_reader :
|
18
|
+
attr_reader :banner_type_2
|
17
19
|
# Some banners list the series name in a foreign language. The language abbreviation will be listed here.
|
18
20
|
attr_reader :language
|
19
21
|
# If the banner is for a specific season.
|
@@ -21,11 +23,15 @@ module TheTvDbParty
|
|
21
23
|
# Either nil or a decimal with four decimal places. The rating the banner currently has on the site.
|
22
24
|
attr_reader :rating
|
23
25
|
# Always returns an unsigned integer. Number of people who have rated the image.
|
24
|
-
attr_reader :
|
26
|
+
attr_reader :rating_count
|
25
27
|
# This can be true or false. Only shows if BannerType is fanart. Indicates if the seriesname is included in the image or not.
|
26
|
-
attr_reader :
|
27
|
-
# Returns either nil or
|
28
|
-
attr_reader :
|
28
|
+
attr_reader :series_name
|
29
|
+
# Returns either nil or a RGB color. These are colors the artist picked that go well with the image. It's meant to be used if you want to write something over the image, it gives you a good idea of what colors may work and show up well. Only shows if BannerType is fanart.
|
30
|
+
attr_reader :light_accent_color
|
31
|
+
# Returns either nil or a RGB color. These are colors the artist picked that go well with the image. It's meant to be used if you want to write something over the image, it gives you a good idea of what colors may work and show up well. Only shows if BannerType is fanart.
|
32
|
+
attr_reader :dark_accent_color
|
33
|
+
# Returns either nil or a RGB color. These are colors the artist picked that go well with the image. It's meant to be used if you want to write something over the image, it gives you a good idea of what colors may work and show up well. Only shows if BannerType is fanart.
|
34
|
+
attr_reader :neutral_midtone_color
|
29
35
|
|
30
36
|
# Initializes a new Banner as it was retrieved from a given client.
|
31
37
|
# Parameters::
|
@@ -38,21 +44,92 @@ module TheTvDbParty
|
|
38
44
|
read_hash_values
|
39
45
|
end
|
40
46
|
|
47
|
+
def banner_path_full
|
48
|
+
if @banner_path_relative
|
49
|
+
return (URI::join(BASE_URL, "banners/", @banner_path_relative))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def thumbnail_path_full
|
54
|
+
if @thumbnail_path_relative
|
55
|
+
return (URI::join(BASE_URL, "banners/", @thumbnail_path_relative))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def vignette_path_full
|
60
|
+
if @vignette_path_relative
|
61
|
+
return (URI::join(BASE_URL, "banners/", @vignette_path_relative))
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
41
65
|
private
|
42
66
|
def read_hash_values
|
43
|
-
@id =
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@
|
47
|
-
|
48
|
-
|
67
|
+
@id = @hashValues["id"]
|
68
|
+
@banner_path_relative = @hashValues["BannerPath"]
|
69
|
+
@thumbnail_path_relative = @hashValues["ThumbnailPath"]
|
70
|
+
@vignette_path_relative = @hashValues["VignettePath"]
|
71
|
+
banner_type = @hashValues["BannerType"] ? (@hashValues["BannerType"].downcase) : nil
|
72
|
+
if ["poster", "fanart", "series", "season"].include? banner_type
|
73
|
+
@banner_type = banner_type
|
74
|
+
banner_type_2 = @hashValues["BannerType2"] ? (@hashValues["BannerType2"].downcase) : nil
|
75
|
+
case banner_type
|
76
|
+
when "series"
|
77
|
+
validValues = ["text", "graphical", "blank"]
|
78
|
+
when "season"
|
79
|
+
validValues = ["season", "seasonwide"]
|
80
|
+
when "fanart"
|
81
|
+
validValues = ["1280x720", "1920x1080"]
|
82
|
+
when "poster"
|
83
|
+
validValues = ["680x1000"]
|
84
|
+
else
|
85
|
+
validValues = []
|
86
|
+
end
|
87
|
+
if validValues.include? banner_type_2
|
88
|
+
@banner_type_2 = banner_type_2
|
89
|
+
else
|
90
|
+
@banner_type_2 = nil
|
91
|
+
end
|
92
|
+
else
|
93
|
+
@banner_type = nil
|
94
|
+
@banner_type_2 = nil
|
95
|
+
end
|
49
96
|
@language = @hashValues["Language"]
|
50
|
-
@season = @hashValues["Season"]
|
51
|
-
@rating = @hashValues["Rating"]
|
52
|
-
@
|
53
|
-
|
54
|
-
|
55
|
-
|
97
|
+
@season = @hashValues["Season"] ? @hashValues["Season"].to_i : nil
|
98
|
+
@rating = @hashValues["Rating"] ? @hashValues["Rating"].to_f : 0.to_f
|
99
|
+
@rating_count = @hashValues["RatingCount"] ? @hashValues["RatingCount"].to_i : 0
|
100
|
+
if banner_type == "fanart"
|
101
|
+
@series_name = @hashValues["SeriesName"] ? (@hashValues["SeriesName"]=="true" ? true : false) : false
|
102
|
+
else
|
103
|
+
@series_name = false
|
104
|
+
end
|
105
|
+
if @hashValues["Colors"] && banner_type == "fanart"
|
106
|
+
colors = (@hashValues["Colors"].split "|")[1..3]
|
107
|
+
if colors.length==3
|
108
|
+
@light_accent_color = (colors[0].split ",").collect{|x| x.to_i}
|
109
|
+
for value in @light_accent_color
|
110
|
+
if value == nil || value <0 || value >255
|
111
|
+
@light_accent_color = nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
@dark_accent_color = (colors[1].split ",").collect{|x| x.to_i}
|
115
|
+
for value in @dark_accent_color
|
116
|
+
if value == nil || value <0 || value >255
|
117
|
+
@dark_accent_color = nil
|
118
|
+
end
|
119
|
+
end
|
120
|
+
@neutral_midtone_color = (colors[2].split ",").collect{|x| x.to_i}
|
121
|
+
for value in @neutral_midtone_color
|
122
|
+
if value == nil || value <0 || value >255
|
123
|
+
@neutral_midtone_color = nil
|
124
|
+
end
|
125
|
+
end
|
126
|
+
if @light_accent_color.length!=3 || @dark_accent_color.length!=3 || @neutral_midtone_color.length!=3
|
127
|
+
@light_accent_color = nil
|
128
|
+
@dark_accent_color = nil
|
129
|
+
@neutral_midtone_color = nil
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
56
133
|
nil
|
57
134
|
end
|
58
135
|
|
@@ -139,18 +139,53 @@ module TheTvDbParty
|
|
139
139
|
|
140
140
|
private
|
141
141
|
def read_hash_values
|
142
|
-
@id = @hashValues["id"] ? @hashValues["id"].to_i : -1
|
143
|
-
|
144
|
-
|
142
|
+
# @id = @hashValues["id"] ? @hashValues["id"].to_i : -1
|
143
|
+
begin
|
144
|
+
@id = @hashValues["id"] ? Integer(@hashValues["id"], 10) : -1
|
145
|
+
rescue ArgumentError
|
146
|
+
@id = -1
|
147
|
+
end
|
148
|
+
# @combined_episodenumber = @hashValues["Combined_episodenumber"] ? @hashValues["Combined_episodenumber"].to_f : -1.0
|
149
|
+
begin
|
150
|
+
@combined_episodenumber = @hashValues["Combined_episodenumber"] ? Float(@hashValues["Combined_episodenumber"]) : -1.0
|
151
|
+
rescue ArgumentError
|
152
|
+
@combined_episodenumber = -1.0
|
153
|
+
end
|
154
|
+
# @combined_season = @hashValues["Combined_season"] ? @hashValues["Combined_season"].to_f : -1.0
|
155
|
+
begin
|
156
|
+
@combined_season = @hashValues["Combined_season"] ? Integer(@hashValues["Combined_season"]) : -1
|
157
|
+
rescue ArgumentError
|
158
|
+
@combined_season = -1
|
159
|
+
end
|
145
160
|
@dvd_chapter = @hashValues["DVD_chapter"]
|
146
161
|
@dvd_discid = @hashValues["DVD_discid"]
|
147
|
-
@dvd_episodenumber = @hashValues["DVD_episodenumber"] ? @hashValues["DVD_episodenumber"].to_f : -1.0
|
148
|
-
|
162
|
+
# @dvd_episodenumber = @hashValues["DVD_episodenumber"] ? @hashValues["DVD_episodenumber"].to_f : -1.0
|
163
|
+
begin
|
164
|
+
@dvd_episodenumber = @hashValues["DVD_episodenumber"] ? Float(@hashValues["DVD_episodenumber"]) : -1.0
|
165
|
+
rescue ArgumentError
|
166
|
+
@dvd_episodenumber = -1.0
|
167
|
+
end
|
168
|
+
# @dvd_season = @hashValues["DVD_season"] ? @hashValues["DVD_season"].to_i : -1
|
169
|
+
begin
|
170
|
+
@dvd_season = @hashValues["DVD_season"] ? Integer(@hashValues["DVD_season"]) : -1
|
171
|
+
rescue ArgumentError
|
172
|
+
@dvd_season = -1
|
173
|
+
end
|
149
174
|
@director = @hashValues["Director"] ? @hashValues["Director"].split('|').reject { |a| a.nil? || a.empty? } : []
|
150
|
-
|
175
|
+
epimgflag = @hashValues["EpImgFlag"] ? @hashValues["EpImgFlag"].to_i : 0
|
176
|
+
@epimgflag = (1..6).include?(epimgflag) ? epimgflag : 0
|
151
177
|
@episodename = @hashValues["EpisodeName"]
|
152
|
-
@episodenumber = @hashValues["EpisodeNumber"] ? @hashValues["EpisodeNumber"].to_i : -1
|
153
|
-
|
178
|
+
# @episodenumber = @hashValues["EpisodeNumber"] ? @hashValues["EpisodeNumber"].to_i : -1
|
179
|
+
begin
|
180
|
+
@episodenumber = @hashValues["EpisodeNumber"] ? Integer(@hashValues["EpisodeNumber"]) : -1
|
181
|
+
rescue ArgumentError
|
182
|
+
@episodenumber = -1
|
183
|
+
end
|
184
|
+
begin
|
185
|
+
@firstaired = @hashValues["FirstAired"] ? Date.parse(@hashValues["FirstAired"]) : nil
|
186
|
+
rescue ArgumentError
|
187
|
+
@firstaired = nil
|
188
|
+
end
|
154
189
|
@gueststars = @hashValues["GuestStars"] ? @hashValues["GuestStars"].split('|').reject { |a| a.nil? || a.empty? } : []
|
155
190
|
@imdb_id = @hashValues["IMDB_ID"]
|
156
191
|
@language = @hashValues["Language"]
|
@@ -158,18 +193,54 @@ module TheTvDbParty
|
|
158
193
|
@productioncode = @hashValues["ProductionCode"]
|
159
194
|
@rating = @hashValues["Rating"] ? @hashValues["Rating"].to_f : 0.0
|
160
195
|
@ratingcount = @hashValues["RatingCount"] ? @hashValues["RatingCount"].to_i : 0
|
161
|
-
|
196
|
+
begin
|
197
|
+
@seasonnumber = @hashValues["SeasonNumber"] ? Integer(@hashValues["SeasonNumber"]) : -1
|
198
|
+
rescue ArgumentError
|
199
|
+
@seasonnumber = -1
|
200
|
+
end
|
162
201
|
@writer = @hashValues["Writer"] ? @hashValues["Writer"].split('|').reject { |a| a.nil? || a.empty? } : []
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
202
|
+
begin
|
203
|
+
@absolute_number = @hashValues["absolute_number"] ? Integer(@hashValues["absolute_number"]) : -1
|
204
|
+
rescue ArgumentError
|
205
|
+
@absolute_number = -1
|
206
|
+
end
|
207
|
+
begin
|
208
|
+
@airsafter_season = @hashValues["airsafter_season"] ? Integer(@hashValues["airsafter_season"]) : -1
|
209
|
+
rescue ArgumentError
|
210
|
+
@airsafter_season = -1
|
211
|
+
end
|
212
|
+
begin
|
213
|
+
@airsbefore_episode = @hashValues["airsbefore_episode"] ? Integer(@hashValues["airsbefore_episode"]) : -1
|
214
|
+
rescue ArgumentError
|
215
|
+
@airsbefore_episode = -1
|
216
|
+
end
|
217
|
+
begin
|
218
|
+
@airsbefore_season = @hashValues["airsbefore_season"] ? Integer(@hashValues["airsbefore_season"]) : -1
|
219
|
+
rescue ArgumentError
|
220
|
+
@airsbefore_season = -1
|
221
|
+
end
|
167
222
|
@imagepath_relative = @hashValues["filename"]
|
168
223
|
@imagepath_full = @imagepath_relative ? URI::join(BASE_URL, 'banners/', @imagepath_relative) : nil
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
224
|
+
begin
|
225
|
+
@lastupdated = @hashValues["lastupdated"] ? Time.at(Integer(@hashValues["lastupdated"])).to_datetime : nil
|
226
|
+
rescue ArgumentError
|
227
|
+
@lastupdated = nil
|
228
|
+
end
|
229
|
+
begin
|
230
|
+
@seasonid = @hashValues["seasonid"] ? Integer(@hashValues["seasonid"]) : -1
|
231
|
+
rescue ArgumentError
|
232
|
+
@seasonid = -1
|
233
|
+
end
|
234
|
+
begin
|
235
|
+
@seriesid = @hashValues["seriesid"] ? Integer(@hashValues["seriesid"]) : -1
|
236
|
+
rescue ArgumentError
|
237
|
+
@seriesid = -1
|
238
|
+
end
|
239
|
+
begin
|
240
|
+
@thumb_added = @hashValues["thumb_added"] ? Time.parse(@hashValues["thumb_added"]).to_datetime : nil
|
241
|
+
rescue ArgumentError
|
242
|
+
@thumb_added = nil
|
243
|
+
end
|
173
244
|
@thumb_height = @hashValues["thumb_height"] ? @hashValues["thumb_height"].to_i : 0
|
174
245
|
@thumb_width = @hashValues["thumb_width"] ? @hashValues["thumb_width"].to_i : 0
|
175
246
|
|
@@ -123,31 +123,67 @@ module TheTvDbParty
|
|
123
123
|
|
124
124
|
private
|
125
125
|
def read_hash_values
|
126
|
-
|
126
|
+
begin
|
127
|
+
@seriesid = @hashValues["id"] ? Integer(@hashValues["id"]) : -1
|
128
|
+
rescue ArgumentError
|
129
|
+
@seriesid = -1
|
130
|
+
end
|
127
131
|
@actors = @hashValues["Actors"] ? @hashValues["Actors"].split('|').reject { |a| a.nil? || a.empty? } : []
|
128
132
|
@airs_dayofweek = @hashValues["Airs_DayOfWeek"]
|
129
|
-
|
133
|
+
begin
|
134
|
+
@airs_time = @hashValues["Airs_Time"] ? Time.parse(@hashValues["Airs_Time"]) : nil
|
135
|
+
rescue ArgumentError
|
136
|
+
@airs_time = nil
|
137
|
+
end
|
130
138
|
@contentrating = @hashValues["ContentRating"]
|
131
|
-
|
139
|
+
begin
|
140
|
+
@firstaired = @hashValues["FirstAired"] ? Date.parse(@hashValues["FirstAired"]) : nil
|
141
|
+
rescue ArgumentError
|
142
|
+
@firstaired = nil
|
143
|
+
end
|
132
144
|
@genres = @hashValues["Genre"] ? @hashValues["Genre"].split('|').reject { |a| a.nil? || a.empty? } : []
|
133
145
|
@imdb_id = @hashValues["IMDB_ID"]
|
134
146
|
@language = @hashValues["Language"]
|
135
147
|
@network = @hashValues["Network"]
|
136
|
-
|
148
|
+
begin
|
149
|
+
@networkid = @hashValues["NetworkID"] ? Integer(@hashValues["NetworkID"]) : nil
|
150
|
+
rescue ArgumentError
|
151
|
+
@networkid = nil
|
152
|
+
end
|
137
153
|
@overview = @hashValues["Overview"]
|
138
154
|
@rating = @hashValues["Rating"] ? @hashValues["Rating"].to_f : 0.0
|
139
155
|
@ratingcount = @hashValues["RatingCount"] ? @hashValues["RatingCount"].to_i : 0
|
140
|
-
|
141
|
-
|
156
|
+
begin
|
157
|
+
@runtime = @hashValues["Runtime"] ? Integer(@hashValues["Runtime"]) : -1
|
158
|
+
rescue ArgumentError
|
159
|
+
@runtime = -1
|
160
|
+
end
|
161
|
+
begin
|
162
|
+
@tvcom_id = @hashValues["SeriesID"] ? Integer(@hashValues["SeriesID"]) : nil
|
163
|
+
rescue ArgumentError
|
164
|
+
@tvcom_id = nil
|
165
|
+
end
|
142
166
|
@seriesname = @hashValues["SeriesName"]
|
143
|
-
@status = @hashValues["Status"]
|
144
|
-
|
145
|
-
|
167
|
+
@status = @hashValues["Status"] && %w(Ended Continuing).include?(@hashValues["Status"]) ? @hashValues["Status"] : nil
|
168
|
+
begin
|
169
|
+
@added = @hashValues["added"] ? DateTime.parse(@hashValues["added"]) : nil
|
170
|
+
rescue ArgumentError
|
171
|
+
@added = nil
|
172
|
+
end
|
173
|
+
begin
|
174
|
+
@addedby = @hashValues["addedBy"] ? Integer(@hashValues["addedBy"]) : nil
|
175
|
+
rescue ArgumentError
|
176
|
+
@addedby = nil
|
177
|
+
end
|
146
178
|
@bannerpath_relative = @hashValues["banner"]
|
147
179
|
@fanartpath_relative = @hashValues["fanart"]
|
148
180
|
@posterpath_relative = @hashValues["poster"]
|
149
181
|
@zap2it_id = @hashValues["zap2it_id"]
|
150
|
-
|
182
|
+
begin
|
183
|
+
@lastupdated = @hashValues["lastupdated"] ? Time.at(Integer(@hashValues["lastupdated"])).to_datetime : nil
|
184
|
+
rescue ArgumentError
|
185
|
+
@lastupdated = nil
|
186
|
+
end
|
151
187
|
@bannerpath_full = @bannerpath_relative ? URI::join(BASE_URL, "banners/", @bannerpath_relative) : nil
|
152
188
|
@fanartpath_full = @fanartpath_relative ? URI::join(BASE_URL, "banners/", @fanartpath_relative) : nil
|
153
189
|
@posterpath_full = @posterpath_relative ? URI::join(BASE_URL, "banners/", @posterpath_relative) : nil
|