add placeholder for omdb base url

This commit is contained in:
Luke Pulverenti 2017-02-13 16:03:41 -05:00
parent 5181b31886
commit eb2d3d0889
2 changed files with 11 additions and 5 deletions

View file

@ -18,8 +18,6 @@ using System.Linq;
using System.Net; using System.Net;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.IO;
using MediaBrowser.Controller.IO;
namespace MediaBrowser.Providers.Omdb namespace MediaBrowser.Providers.Omdb
{ {
@ -74,7 +72,8 @@ namespace MediaBrowser.Providers.Omdb
var imdbId = searchInfo.GetProviderId(MetadataProviders.Imdb); var imdbId = searchInfo.GetProviderId(MetadataProviders.Imdb);
var url = "https://www.omdbapi.com/?plot=full&r=json"; var baseUrl = await OmdbProvider.GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
var url = baseUrl + "/?plot=full&r=json";
if (type == "episode" && episodeSearchInfo != null) if (type == "episode" && episodeSearchInfo != null)
{ {
episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out imdbId); episodeSearchInfo.SeriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out imdbId);

View file

@ -272,6 +272,11 @@ namespace MediaBrowser.Providers.Omdb
return false; return false;
} }
public static async Task<string> GetOmdbBaseUrl(CancellationToken cancellationToken)
{
return "https://www.omdbapi.com";
}
private async Task<string> EnsureItemInfo(string imdbId, CancellationToken cancellationToken) private async Task<string> EnsureItemInfo(string imdbId, CancellationToken cancellationToken)
{ {
if (string.IsNullOrWhiteSpace(imdbId)) if (string.IsNullOrWhiteSpace(imdbId))
@ -294,7 +299,8 @@ namespace MediaBrowser.Providers.Omdb
} }
} }
var url = string.Format("https://www.omdbapi.com/?i={0}&plot=full&tomatoes=true&r=json", imdbParam); var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
var url = string.Format(baseUrl + "/?i={0}&plot=full&tomatoes=true&r=json", imdbParam);
using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
{ {
@ -328,7 +334,8 @@ namespace MediaBrowser.Providers.Omdb
} }
} }
var url = string.Format("https://www.omdbapi.com/?i={0}&season={1}&detail=full", imdbParam, seasonId); var baseUrl = await GetOmdbBaseUrl(cancellationToken).ConfigureAwait(false);
var url = string.Format(baseUrl + "/?i={0}&season={1}&detail=full", imdbParam, seasonId);
using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false)) using (var stream = await GetOmdbResponse(_httpClient, url, cancellationToken).ConfigureAwait(false))
{ {