Add user cinema mode setting

This commit is contained in:
Luke Pulverenti
2014-10-01 20:28:16 -04:00
parent 4aa959c1e2
commit 0690b4f2e0
73 changed files with 575 additions and 458 deletions

View File

@@ -869,7 +869,56 @@ namespace MediaBrowser.Server.Implementations.Channels
private async Task<ChannelItemResult> GetAllItems(IIndexableChannel indexable, IChannel channel, InternalAllChannelMediaQuery query, CancellationToken cancellationToken)
{
return await indexable.GetAllMedia(query, cancellationToken).ConfigureAwait(false);
var cacheLength = CacheLength;
var folderId = _jsonSerializer.SerializeToString(query).GetMD5().ToString("N");
var cachePath = GetChannelDataCachePath(channel, query.UserId, folderId, null, false);
try
{
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
{
return _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
}
}
catch (FileNotFoundException)
{
}
catch (DirectoryNotFoundException)
{
}
await _resourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
try
{
if (_fileSystem.GetLastWriteTimeUtc(cachePath).Add(cacheLength) > DateTime.UtcNow)
{
return _jsonSerializer.DeserializeFromFile<ChannelItemResult>(cachePath);
}
}
catch (FileNotFoundException)
{
}
catch (DirectoryNotFoundException)
{
}
var result = await indexable.GetAllMedia(query, cancellationToken).ConfigureAwait(false);
CacheResponse(result, cachePath);
return result;
}
finally
{
_resourcePool.Release();
}
}
public async Task<QueryResult<BaseItem>> GetChannelItemsInternal(ChannelItemQuery query, IProgress<double> progress, CancellationToken cancellationToken)