diff --git a/lib/tvdb_party/episode.rb b/lib/tvdb_party/episode.rb index 7fa74e3..5887773 100644 --- a/lib/tvdb_party/episode.rb +++ b/lib/tvdb_party/episode.rb @@ -2,7 +2,7 @@ module TvdbParty class Episode attr_reader :client attr_accessor :id, :season_number, :number, :name, :overview, :air_date, :thumb, :guest_stars, :director, :writer - + def initialize(client, options={}) @client = client @id = options["id"] @@ -15,20 +15,20 @@ def initialize(client, options={}) @writer = options["Writer"] @series_id = options["seriesid"] if options["GuestStars"] - @guest_stars = options["GuestStars"][1..-1].split("|") + @guest_stars = options["GuestStars"].split("|").reject(&:empty?) else @guest_stars = [] end - begin + begin @air_date = Date.parse(options["FirstAired"]) rescue puts 'invalid date' end end - + def series client.get_series_by_id(@series_id) end end -end \ No newline at end of file +end diff --git a/lib/tvdb_party/series.rb b/lib/tvdb_party/series.rb index 0123ccf..5215049 100644 --- a/lib/tvdb_party/series.rb +++ b/lib/tvdb_party/series.rb @@ -15,7 +15,7 @@ def initialize(client, options={}) @imdb_id = options["IMDB_ID"] if options["Genre"] - @genres = options["Genre"][1..-1].split("|") + @genres = options["Genre"].split("|").reject(&:empty?) else @genres = [] end