diff options
Diffstat (limited to 'MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs')
| -rw-r--r-- | MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs index 2b4173ed9..b6852e9ba 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs @@ -46,11 +46,11 @@ namespace MediaBrowser.Controller.Providers.TV /// <summary> /// The episode query /// </summary> - private const string episodeQuery = "http://www.thetvdb.com/api/{0}/series/{1}/default/{2}/{3}/{4}.xml"; + private const string EpisodeQuery = "http://www.thetvdb.com/api/{0}/series/{1}/default/{2}/{3}/{4}.xml"; /// <summary> /// The abs episode query /// </summary> - private const string absEpisodeQuery = "http://www.thetvdb.com/api/{0}/series/{1}/absolute/{2}/{3}.xml"; + private const string AbsEpisodeQuery = "http://www.thetvdb.com/api/{0}/series/{1}/absolute/{2}/{3}.xml"; /// <summary> /// Supportses the specified item. @@ -179,25 +179,19 @@ namespace MediaBrowser.Controller.Providers.TV seasonNumber = "0"; // Specials } - var url = string.Format(episodeQuery, TVUtils.TvdbApiKey, seriesId, seasonNumber, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage); + var url = string.Format(EpisodeQuery, TVUtils.TvdbApiKey, seriesId, seasonNumber, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage); var doc = new XmlDocument(); - try + using (var result = await HttpClient.Get(new HttpRequestOptions { - using (var result = await HttpClient.Get(new HttpRequestOptions - { - Url = url, - ResourcePool = RemoteSeriesProvider.Current.TvDbResourcePool, - CancellationToken = cancellationToken, - EnableResponseCache = true + Url = url, + ResourcePool = RemoteSeriesProvider.Current.TvDbResourcePool, + CancellationToken = cancellationToken, + EnableResponseCache = true - }).ConfigureAwait(false)) - { - doc.Load(result); - } - } - catch (HttpException) + }).ConfigureAwait(false)) { + doc.Load(result); } //episode does not exist under this season, try absolute numbering. @@ -205,25 +199,19 @@ namespace MediaBrowser.Controller.Providers.TV //this is basicly just for anime. if (!doc.HasChildNodes && Int32.Parse(seasonNumber) == 1) { - url = string.Format(absEpisodeQuery, TVUtils.TvdbApiKey, seriesId, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage); + url = string.Format(AbsEpisodeQuery, TVUtils.TvdbApiKey, seriesId, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage); - try + using (var result = await HttpClient.Get(new HttpRequestOptions { - using (var result = await HttpClient.Get(new HttpRequestOptions - { - Url = url, - ResourcePool = RemoteSeriesProvider.Current.TvDbResourcePool, - CancellationToken = cancellationToken, - EnableResponseCache = true + Url = url, + ResourcePool = RemoteSeriesProvider.Current.TvDbResourcePool, + CancellationToken = cancellationToken, + EnableResponseCache = true - }).ConfigureAwait(false)) - { - if (result != null) doc.Load(result); - usingAbsoluteData = true; - } - } - catch (HttpException) + }).ConfigureAwait(false)) { + if (result != null) doc.Load(result); + usingAbsoluteData = true; } } |
