add new mirror mode

This commit is contained in:
Luke Pulverenti
2014-04-13 13:27:13 -04:00
parent b6ca79b73f
commit 8df1ebe499
31 changed files with 446 additions and 370 deletions

View File

@@ -71,10 +71,18 @@ namespace MediaBrowser.Providers.Manager
var saveLocally = item.SupportsLocalMetadata && item.IsSaveLocalMetadataEnabled() && !item.IsOwnedItem && !(item is Audio);
if (item is IItemByName || item is User)
if (item is User)
{
saveLocally = true;
}
if (item is IItemByName)
{
var hasDualAccess = item as IHasDualAccess;
if (hasDualAccess == null || hasDualAccess.IsAccessedByName)
{
saveLocally = true;
}
}
if (type != ImageType.Primary && item is Episode)
{

View File

@@ -139,8 +139,6 @@ namespace MediaBrowser.Providers.Movies
/// </summary>
private TmdbSettingsResult _tmdbSettings;
private readonly SemaphoreSlim _tmdbSettingsSemaphore = new SemaphoreSlim(1, 1);
/// <summary>
/// Gets the TMDB settings.
/// </summary>
@@ -152,32 +150,17 @@ namespace MediaBrowser.Providers.Movies
return _tmdbSettings;
}
await _tmdbSettingsSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
using (var json = await GetMovieDbResponse(new HttpRequestOptions
{
// Check again in case it got populated while we were waiting.
if (_tmdbSettings != null)
{
return _tmdbSettings;
}
Url = string.Format(TmdbConfigUrl, ApiKey),
CancellationToken = cancellationToken,
AcceptHeader = AcceptHeader
using (var json = await GetMovieDbResponse(new HttpRequestOptions
{
Url = string.Format(TmdbConfigUrl, ApiKey),
CancellationToken = cancellationToken,
AcceptHeader = AcceptHeader
}).ConfigureAwait(false))
{
_tmdbSettings = _jsonSerializer.DeserializeFromStream<TmdbSettingsResult>(json);
return _tmdbSettings;
}
}
finally
}).ConfigureAwait(false))
{
_tmdbSettingsSemaphore.Release();
_tmdbSettings = _jsonSerializer.DeserializeFromStream<TmdbSettingsResult>(json);
return _tmdbSettings;
}
}