diff --git a/ErsatzTV-Windows/ErsatzTV-Windows.csproj b/ErsatzTV-Windows/ErsatzTV-Windows.csproj index 809e330ea..ec1d21c51 100644 --- a/ErsatzTV-Windows/ErsatzTV-Windows.csproj +++ b/ErsatzTV-Windows/ErsatzTV-Windows.csproj @@ -17,7 +17,7 @@ - + diff --git a/ErsatzTV.Application/ErsatzTV.Application.csproj b/ErsatzTV.Application/ErsatzTV.Application.csproj index 0418936eb..95788167c 100644 --- a/ErsatzTV.Application/ErsatzTV.Application.csproj +++ b/ErsatzTV.Application/ErsatzTV.Application.csproj @@ -8,7 +8,7 @@ - + diff --git a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj index 46d72c573..3e936c19c 100644 --- a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj +++ b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj @@ -8,7 +8,7 @@ - + diff --git a/ErsatzTV.Core/Interfaces/Repositories/IMediaItemRepository.cs b/ErsatzTV.Core/Interfaces/Repositories/IMediaItemRepository.cs index f4d74bdb0..7bc50780a 100644 --- a/ErsatzTV.Core/Interfaces/Repositories/IMediaItemRepository.cs +++ b/ErsatzTV.Core/Interfaces/Repositories/IMediaItemRepository.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.Collections.Immutable; +using System.Globalization; using ErsatzTV.Core.Domain; namespace ErsatzTV.Core.Interfaces.Repositories; @@ -10,5 +11,5 @@ public interface IMediaItemRepository Task> FlagFileNotFound(LibraryPath libraryPath, string path); Task FlagNormal(MediaItem mediaItem); Task> DeleteItems(List mediaItemIds); - Task> GetAllTrashedItems(LibraryPath libraryPath); + Task> GetAllTrashedItems(LibraryPath libraryPath); } diff --git a/ErsatzTV.Core/Metadata/LocalFolderScanner.cs b/ErsatzTV.Core/Metadata/LocalFolderScanner.cs index 7f6de1b38..a1238e695 100644 --- a/ErsatzTV.Core/Metadata/LocalFolderScanner.cs +++ b/ErsatzTV.Core/Metadata/LocalFolderScanner.cs @@ -1,4 +1,5 @@ -using Bugsnag; +using System.Collections.Immutable; +using Bugsnag; using CliWrap; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Extensions; @@ -13,37 +14,37 @@ namespace ErsatzTV.Core.Metadata; public abstract class LocalFolderScanner { - public static readonly List VideoFileExtensions = new() + public static readonly ImmutableHashSet VideoFileExtensions = new[] { ".mpg", ".mp2", ".mpeg", ".mpe", ".mpv", ".ogg", ".mp4", ".m4p", ".m4v", ".avi", ".wmv", ".mov", ".mkv", ".ts", ".webm" - }; + }.ToImmutableHashSet(); - public static readonly List AudioFileExtensions = new() + public static readonly ImmutableHashSet AudioFileExtensions = new[] { ".aac", ".alac", ".dff", ".dsf", ".flac", ".mp3", ".m4a", ".ogg", ".opus", ".oga", ".ogx", ".spx", ".wav", ".wma" - }; + }.ToImmutableHashSet(); - public static readonly List ImageFileExtensions = new() + public static readonly ImmutableHashSet ImageFileExtensions = new[] { "jpg", "jpeg", "png", "gif", "tbn" - }; + }.ToImmutableHashSet(); - public static readonly List ExtraFiles = new() + public static readonly ImmutableHashSet ExtraFiles = new[] { "behindthescenes", "deleted", "featurette", "interview", "scene", "short", "trailer", "other" - }; + }.ToImmutableHashSet(); - public static readonly List ExtraDirectories = new List + public static readonly ImmutableHashSet ExtraDirectories = new List { "behind the scenes", "deleted scenes", "featurettes", "interviews", "scenes", "shorts", "trailers", "other", "extras", "specials" } .Map(s => $"{Path.DirectorySeparatorChar}{s}{Path.DirectorySeparatorChar}") - .ToList(); + .ToImmutableHashSet(); private readonly IClient _client; private readonly IFFmpegProcessService _ffmpegProcessService; diff --git a/ErsatzTV.Core/Metadata/MovieFolderScanner.cs b/ErsatzTV.Core/Metadata/MovieFolderScanner.cs index d3bb9a68f..f2ecb793b 100644 --- a/ErsatzTV.Core/Metadata/MovieFolderScanner.cs +++ b/ErsatzTV.Core/Metadata/MovieFolderScanner.cs @@ -1,4 +1,5 @@ -using Bugsnag; +using System.Collections.Immutable; +using Bugsnag; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Errors; using ErsatzTV.Core.Interfaces.FFmpeg; @@ -81,7 +82,7 @@ public class MovieFolderScanner : LocalFolderScanner, IMovieFolderScanner { try { - List allTrashedItems = await _mediaItemRepository.GetAllTrashedItems(libraryPath); + ImmutableHashSet allTrashedItems = await _mediaItemRepository.GetAllTrashedItems(libraryPath); decimal progressSpread = progressMax - progressMin; diff --git a/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj b/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj index 400931af6..a759d92af 100644 --- a/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj +++ b/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj @@ -7,7 +7,7 @@ - + diff --git a/ErsatzTV.Infrastructure/Data/Repositories/MediaItemRepository.cs b/ErsatzTV.Infrastructure/Data/Repositories/MediaItemRepository.cs index 83777d407..7348dac76 100644 --- a/ErsatzTV.Infrastructure/Data/Repositories/MediaItemRepository.cs +++ b/ErsatzTV.Infrastructure/Data/Repositories/MediaItemRepository.cs @@ -1,4 +1,5 @@ -using System.Globalization; +using System.Collections.Immutable; +using System.Globalization; using Dapper; using ErsatzTV.Core; using ErsatzTV.Core.Domain; @@ -82,7 +83,7 @@ public class MediaItemRepository : IMediaItemRepository return ids; } - public async Task> GetAllTrashedItems(LibraryPath libraryPath) + public async Task> GetAllTrashedItems(LibraryPath libraryPath) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(); return await dbContext.Connection.QueryAsync( @@ -92,7 +93,7 @@ public class MediaItemRepository : IMediaItemRepository INNER JOIN MediaFile MF on MV.Id = MF.MediaVersionId WHERE M.State IN (1,2) AND M.LibraryPathId = @LibraryPathId", new { LibraryPathId = libraryPath.Id }) - .Map(list => list.ToList()); + .Map(list => list.ToImmutableHashSet()); } public async Task FlagNormal(MediaItem mediaItem) diff --git a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj index 4efb8e614..a790a162d 100644 --- a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj +++ b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj @@ -9,7 +9,7 @@ - +