|
|
@ -47,22 +47,27 @@ namespace Emby.Server.Implementations.Library
|
|
|
|
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
|
|
|
|
var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(cacheKey))
|
|
|
|
if (!string.IsNullOrEmpty(cacheKey))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
|
|
|
|
FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
|
|
|
|
|
|
|
// _logger.LogDebug("Found cached media info");
|
|
|
|
// _logger.LogDebug("Found cached media info");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.LogError(ex, "Error deserializing mediainfo cache");
|
|
|
|
_logger.LogError(ex, "Error deserializing mediainfo cache");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await jsonStream.DisposeAsync().ConfigureAwait(false);
|
|
|
|
await jsonStream.DisposeAsync().ConfigureAwait(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.LogError("Could not open cached media info");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (mediaInfo is null)
|
|
|
|
if (mediaInfo is null)
|
|
|
|