Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added aired date

  • Loading branch information...
commit f1ba3eb9795ee47ee19643242eb0e63e947cfcd6 1 parent 037ae1d
@schmurfy authored
Showing with 13 additions and 1 deletion.
  1. +12 −0 lib/em-tvdb/client.rb
  2. +1 −1  lib/em-tvdb/version.rb
View
12 lib/em-tvdb/client.rb
@@ -1,3 +1,5 @@
+require 'time'
+
require 'rest-core'
require 'eventmachine'
require 'nokogiri'
@@ -102,11 +104,21 @@ def search_serie(name, &block)
def episodes(serie_id, &block)
@client.get("/#{@api_key}/series/#{serie_id}/all/en.xml") do |xml|
episodes = xml.css('Episode').map do |ep|
+ aired_date = ep.content_node('FirstAired')
+
+ if aired_date.empty?
+ aired_date = nil
+ else
+ aired_date = Time.parse(aired_date)
+ end
+
+
Hashie::Mash.new(
:id => ep.content_node('id'),
:name => ep.content_node('EpisodeName'),
:episode_number => ep.content_node('EpisodeNumber').to_i,
:season_number => ep.content_node('SeasonNumber').to_i,
+ :aired_date => aired_date,
:overview => ep.content_node('Overview')
)
end
View
2  lib/em-tvdb/version.rb
@@ -1,3 +1,3 @@
module EmTvdb
- VERSION = "0.0.1"
+ VERSION = "0.0.2"
end
Please sign in to comment.
Something went wrong with that request. Please try again.