示例#1
0
        /// <summary>
        /// Download the episodes
        /// </summary>
        /// <param name="_seriesId"></param>
        /// <param name="_language"></param>
        /// <returns></returns>
        internal List <TvdbEpisode> DownloadEpisodes(int _seriesId, TvdbLanguage _language)
        {
            String xml  = "";
            String link = "";

            try
            {
                link = TvdbLinks.CreateSeriesEpisodesLink(m_apiKey, _seriesId, _language);
                xml  = m_webClient.DownloadString(link);
                List <TvdbEpisode> epList = m_xmlHandler.ExtractEpisodes(xml);
                return(epList);
            }
            catch (XmlException ex)
            {
                Log.Error("Error parsing the xml file " + link + "\n\n" + xml, ex);
                throw new TvdbInvalidXmlException("Error parsing the xml file " + link + "\n\n" + xml);
            }
            catch (WebException ex)
            {
                Log.Warn("Request not successfull", ex);
                if (ex.Message.Equals("The remote server returned an error: (404) Not Found."))
                {
                    throw new TvdbInvalidApiKeyException("Couldn't connect to Thetvdb.com to retrieve episodes fo " + _seriesId +
                                                         ", it seems like you have an invalid api key");
                }
                else
                {
                    throw new TvdbNotAvailableException("Couldn't connect to Thetvdb.com to retrieve episodes for" + _seriesId +
                                                        ", check your internet connection and the status of http://thetvdb.com");
                }
            }
        }
示例#2
0
        /// <summary>
        /// Download the episodes
        /// </summary>
        /// <param name="_seriesId"></param>
        /// <param name="_language"></param>
        /// <returns></returns>
        internal List <TvdbEpisode> DownloadEpisodes(int _seriesId, TvdbLanguage _language)
        {
            String             xml    = m_webClient.DownloadString(TvdbLinks.CreateSeriesEpisodesLink(m_apiKey, _seriesId, _language));
            List <TvdbEpisode> epList = m_xmlHandler.ExtractEpisodes(xml);

            return(epList);
        }