/// <summary> /// Gets Series information from TvDB. /// </summary> /// <param name="imdbId">The IMDB id for the Series.</param> /// <param name="series">Returns the Series information</param> /// <returns><c>true</c> if successful</returns> public bool GetSeries(string imdbId, out TvdbSearchResult series) { series = _tvdbHandler.GetSeriesByRemoteId(ExternalId.ImdbId, imdbId); return (series != null); }
/// <summary> /// Extract the results of a series search with format: /// <![CDATA[ /// <?xml version="1.0" encoding="UTF-8" ?> /// <Data> /// <Series> /// <seriesid>73739</seriesid> /// <language>en</language> /// <SeriesName>Lost</SeriesName> /// <banner>graphical/24313-g2.jpg</banner> /// <Overview>After Oceanic Air flight 815...</Overview> /// <FirstAired>2004-09-22</FirstAired> /// <IMDB_ID>tt0411008</IMDB_ID> /// <zap2it_id>SH672362</zap2it_id> /// <id>73739</id> /// </Series> /// </Data> /// ]]> /// </summary> /// <param name="data"></param> /// <returns></returns> internal List<TvdbSearchResult> ExtractSeriesSearchResults(String data) { XDocument xml = XDocument.Parse(data); var allSeries = from series in xml.Descendants("Series") where series.HasElements select new { Id = Util.Int32Parse(series.Element("seriesid").Value), FirstAired = series.Element("FirstAired") != null ? series.Element("FirstAired").Value : "", Language = series.Element("language") != null ? series.Element("language").Value : "", Overview = series.Element("Overview") != null ? series.Element("Overview").Value : "", SeriesName = series.Element("SeriesName") != null ? series.Element("SeriesName").Value : "", IMDB_ID = series.Element("IMDB_ID") != null ? series.Element("IMDB_ID").Value : "", BannerPath = series.Element("banner") != null ? series.Element("banner").Value : "" }; List<TvdbSearchResult> retList = new List<TvdbSearchResult>(); foreach (var s in allSeries) { TvdbSearchResult res = new TvdbSearchResult { Id = s.Id, ImdbId = s.IMDB_ID }; if (!s.FirstAired.Equals("")) res.FirstAired = DateTime.Parse(s.FirstAired); if (!s.Language.Equals("")) res.Language = TvDbUtils.ParseLanguage(s.Language); res.SeriesName = s.SeriesName; res.Overview = s.Overview; res.Banner = !s.BannerPath.Equals("") ? new TvdbSeriesBanner(0, s.BannerPath, null, TvdbSeriesBanner.Type.None) : new TvdbSeriesBanner(s.Id, null, null, TvdbSeriesBanner.Type.None); retList.Add(res); } return retList; }