2
0
Эх сурвалжийг харах

Add ex to catch if cached mediainfo doesnt exist

TelepathicWalrus 1 жил өмнө
parent
commit
08592fb3fe

+ 14 - 9
Emby.Server.Implementations/Library/LiveStreamHelper.cs

@@ -48,20 +48,25 @@ namespace Emby.Server.Implementations.Library
 
             if (!string.IsNullOrEmpty(cacheKey))
             {
-                FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
                 try
                 {
-                    mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
+                    FileStream jsonStream = AsyncFile.OpenRead(cacheFilePath);
 
-                    // _logger.LogDebug("Found cached media info");
-                }
-                catch (Exception ex)
-                {
-                    _logger.LogError(ex, "Error deserializing mediainfo cache");
+                    try
+                    {
+                        mediaInfo = await JsonSerializer.DeserializeAsync<MediaInfo>(jsonStream, _jsonOptions, cancellationToken).ConfigureAwait(false);
+                        // _logger.LogDebug("Found cached media info");
+                    }
+                    catch (Exception ex)
+                    {
+                        _logger.LogError(ex, "Error deserializing mediainfo cache");
+                    }
+
+                    await jsonStream.DisposeAsync().ConfigureAwait(false);
                 }
-                finally
+                catch
                 {
-                    await jsonStream.DisposeAsync().ConfigureAwait(false);
+                    _logger.LogError("Could not open cached media info");
                 }
             }