Skip to content

Commit

Permalink
Parse season episodes (if they are available) (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromsilvapt committed Sep 14, 2023
1 parent bd47aa0 commit 0aba5f4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tv/season.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Tmdb::Tv::Season
include PosterUrls

getter air_date : Time?
getter episodes : Array(Tv::Episode)?
getter poster_path : String?
getter season_number : Int32
getter id : Int64
Expand All @@ -21,6 +22,7 @@ class Tmdb::Tv::Season

def initialize(data : JSON::Any, @show_id : Int64)
@air_date = Tmdb.parse_date(data["air_date"])
@episodes = data["episodes"].as_a.map { |episode| Episode.new(episode, show_id) } if data["episode"]?
@poster_path = data["poster_path"].as_s?
@season_number = data["season_number"].as_i
@id = data["id"].as_i64
Expand Down

0 comments on commit 0aba5f4

Please sign in to comment.