public TVEpisodeInfo GetShowInfo(string showName, int year, int month, int day) { TVEpisodeInfo retval = null; logger.Debug("Getting TVDB show information for: {0} date: {1}-{2}-{3}", showName, year, month, day); // If we can't find it, throw an exception if (string.IsNullOrEmpty(this.APIKey)) { throw new ApplicationException("Missing TheTVDB API key. Please include the TheTVDB_APIKey in the application config"); return(retval); } // Get the seriesId for the show TVDBSeriesResult series = GetSeriesForShow(showName); // If we were able to get the seriesId... if (series != null && series.SeriesInfo != null && series.SeriesInfo.SeriesId != null) { // Get the episode information using the seriesId, airdate string apiUrl = string.Format("http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey={0}&seriesid={1}&airdate={2}-{3}-{4}", this.APIKey, series.SeriesInfo.SeriesId, year, month, day); TVDBEpisodeResult response = GetAPIResponse <TVDBEpisodeResult>(apiUrl); if (response != null) { retval = new TVEpisodeInfo() { EpisodeNumber = response.EpisodeInfo.EpisodeNumber, EpisodeSummary = response.EpisodeInfo.EpisodeSummary, EpisodeTitle = response.EpisodeInfo.EpisodeName, OriginalAirDate = response.EpisodeInfo.OriginalAirDate, SeasonNumber = response.EpisodeInfo.SeasonNumber, ShowName = series.SeriesInfo.SeriesName }; } } return(retval); }
public TVEpisodeInfo GetShowInfo(string showName, int season, int episode) { TVEpisodeInfo retval = null; logger.Debug("Getting TVDB show information for: {0} season {1}, episode {2}", showName, season, episode); // If we can't find it, throw an exception if (string.IsNullOrEmpty(this.APIKey)) { throw new Exception("Missing TheTVDB API key. Please include the TheTVDB_APIKey in the application config"); return(retval); } // Get the seriesId for the show TVDBSeriesResult series = GetSeriesForShow(showName); // If we were able to get the seriesId... if (series != null && series.SeriesInfo != null && series.SeriesInfo.SeriesId != null) { // Get the episode information using the API key, seriesId, season, episode string apiUrl = string.Format("http://thetvdb.com/api/{0}/series/{1}/default/{2}/{3}", this.APIKey, series.SeriesInfo.SeriesId, season, episode); TVDBEpisodeResult response = GetAPIResponse <TVDBEpisodeResult>(apiUrl); if (response != null) { retval = new TVEpisodeInfo() { EpisodeNumber = response.EpisodeInfo.EpisodeNumber, EpisodeSummary = response.EpisodeInfo.EpisodeSummary, EpisodeTitle = response.EpisodeInfo.EpisodeName, OriginalAirDate = response.EpisodeInfo.OriginalAirDate, SeasonNumber = response.EpisodeInfo.SeasonNumber, ShowName = series.SeriesInfo.SeriesName }; } } return(retval); }