Exemplo n.º 1
0
        private void lvSearchResult_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvSearchResult.SelectedItems.Count == 1)
              {
            m_selection = (TvdbSearchResult)lvSearchResult.SelectedItems[0].Tag;
            bcSeriesBanner.ClearControl();
            if (m_selection != null)
            {
              bcSeriesBanner.BannerImage = m_selection.Banner;
            }

            txtOverview.Text = m_selection.Overview;
            linkImdb.Text = m_selection.ImdbId.Equals("")? "": "http://www.imdb.com/title/" + m_selection.ImdbId;
            txtFirstAired.Text = m_selection.FirstAired.ToShortDateString();
              }
        }
Exemplo n.º 2
0
        /// <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 == true
                      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();
            res.Id = s.Id;
            res.ImdbId = s.IMDB_ID;
            if (!s.FirstAired.Equals("")) res.FirstAired = DateTime.Parse(s.FirstAired);
            if (!s.Language.Equals("")) res.Language = Util.ParseLanguage(s.Language);
            res.SeriesName = s.SeriesName;
            res.Overview = s.Overview;
            if (!s.BannerPath.Equals(""))
            {
              res.Banner = new TvdbSeriesBanner(0, s.BannerPath, null, TvdbSeriesBanner.Type.none);
            }
            else
            {
              res.Banner = new TvdbSeriesBanner(s.Id, null, null, TvdbSeriesBanner.Type.none);
            }
            retList.Add(res);
              }

              return retList;
        }