aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily <just.one.man@yandex.ru>2020-05-19 14:56:52 +0300
committerVasily <just.one.man@yandex.ru>2020-05-19 15:08:43 +0300
commit186b7f303cd6f95ca64e020c2838dfe2028ea54c (patch)
tree10e74eceebc5d57384eaedd36084dedb20c28faa
parenta226a4ee03d974615a6fa26b936a93458a255b70 (diff)
More small optimizations
-rw-r--r--Emby.Server.Implementations/Dto/DtoService.cs5
-rw-r--r--Emby.Server.Implementations/Library/LibraryManager.cs3
-rw-r--r--Jellyfin.Drawing.Skia/SkiaEncoder.cs6
3 files changed, 5 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs
index a34a3a192..07105786b 100644
--- a/Emby.Server.Implementations/Dto/DtoService.cs
+++ b/Emby.Server.Implementations/Dto/DtoService.cs
@@ -722,8 +722,7 @@ namespace Emby.Server.Implementations.Dto
// Prevent implicitly captured closure
var currentItem = item;
- foreach (var image in currentItem.ImageInfos.Where(i => !currentItem.AllowsMultipleImages(i.Type))
- .ToList())
+ foreach (var image in currentItem.ImageInfos.Where(i => !currentItem.AllowsMultipleImages(i.Type)))
{
if (options.GetImageLimit(image.Type) > 0)
{
@@ -735,7 +734,7 @@ namespace Emby.Server.Implementations.Dto
}
var hash = image.Hash;
- if (hash != null && hash.Length > 0)
+ if (!string.IsNullOrEmpty(hash))
{
dto.ImageHashes[tag] = image.Hash;
}
diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs
index c48664a31..9f412b725 100644
--- a/Emby.Server.Implementations/Library/LibraryManager.cs
+++ b/Emby.Server.Implementations/Library/LibraryManager.cs
@@ -1831,10 +1831,11 @@ namespace Emby.Server.Implementations.Library
}
var outdated = item.ImageInfos
- .Where(i => (i.Width == 0 || i.Height == 0 || string.IsNullOrEmpty(i.Hash)))
+ .Where(i => (i.IsLocalFile && (i.Width == 0 || i.Height == 0 || string.IsNullOrEmpty(i.Hash))))
.ToList();
if (outdated.Count == 0)
{
+ RegisterItem(item);
return;
}
diff --git a/Jellyfin.Drawing.Skia/SkiaEncoder.cs b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
index d2da0cf17..99091ea57 100644
--- a/Jellyfin.Drawing.Skia/SkiaEncoder.cs
+++ b/Jellyfin.Drawing.Skia/SkiaEncoder.cs
@@ -1,10 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
using BlurHashSharp.SkiaSharp;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Drawing;
@@ -237,7 +234,6 @@ namespace Jellyfin.Drawing.Skia
/// <exception cref="ArgumentNullException">The path is null.</exception>
/// <exception cref="FileNotFoundException">The path is not valid.</exception>
/// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception>
- [SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional")]
public string GetImageHash(string path)
{
if (path == null)
@@ -250,7 +246,7 @@ namespace Jellyfin.Drawing.Skia
throw new FileNotFoundException("File not found", path);
}
- return BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(4, 4, path);
+ return BlurHashEncoder.Encode(4, 4, path);
}
private static bool HasDiacritics(string text)