Exemplo n.º 1
0
        public List <TVDBSeriesSearchResult> SearchSeries(string criteria)
        {
            List <TVDBSeriesSearchResult> results = new List <TVDBSeriesSearchResult>();

            try
            {
                Init();

                if (!initialised)
                {
                    return(results);
                }

                // Search for a series
                string url = string.Format(Constants.TvDBURLs.urlSeriesSearch, criteria);
                logger.Trace("Search TvDB Series: {0}", url);

                string xmlSeries = Utils.DownloadWebPage(url);

                XmlDocument docSeries = new XmlDocument();
                docSeries.LoadXml(xmlSeries);

                bool hasData = docSeries["Data"].HasChildNodes;
                if (hasData)
                {
                    XmlNodeList seriesItems = docSeries["Data"].GetElementsByTagName("Series");

                    foreach (XmlNode series in seriesItems)
                    {
                        TVDBSeriesSearchResult searchResult = new TVDBSeriesSearchResult(series);
                        results.Add(searchResult);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Error in SearchSeries: " + ex.ToString());
            }

            return(results);
        }
Exemplo n.º 2
0
		public List<TVDBSeriesSearchResult> SearchSeries(string criteria)
		{
			List<TVDBSeriesSearchResult> results = new List<TVDBSeriesSearchResult>();

			try
			{
				Init();

				if (!initialised) return results;

				// Search for a series
				string url = string.Format(Constants.TvDBURLs.urlSeriesSearch, criteria);
				logger.Trace("Search TvDB Series: {0}", url);

				string xmlSeries = Utils.DownloadWebPage(url);

				XmlDocument docSeries = new XmlDocument();
				docSeries.LoadXml(xmlSeries);

				bool hasData = docSeries["Data"].HasChildNodes;
				if (hasData)
				{
					XmlNodeList seriesItems = docSeries["Data"].GetElementsByTagName("Series");

					foreach (XmlNode series in seriesItems)
					{
						TVDBSeriesSearchResult searchResult = new TVDBSeriesSearchResult(series);
						results.Add(searchResult);
					}
				}
			}
			catch (Exception ex)
			{
				logger.ErrorException("Error in SearchSeries: " + ex.ToString(), ex);
			}

			return results;
		}