hide unused local libraries (#655)
This commit is contained in:
@@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Disable framerate normalization by default and on all ffmpeg profiles
|
||||
- If framerate normalization is desired (not typically needed), it can be re-enabled manually
|
||||
- Show watermarks over songs
|
||||
- Hide unused local libraries
|
||||
|
||||
## [0.4.1-alpha] - 2022-02-10
|
||||
### Fixed
|
||||
|
||||
+1
-1
@@ -3,5 +3,5 @@ using MediatR;
|
||||
|
||||
namespace ErsatzTV.Application.Libraries.Queries
|
||||
{
|
||||
public record GetAllLibraries : IRequest<List<LibraryViewModel>>;
|
||||
public record GetConfiguredLibraries : IRequest<List<LibraryViewModel>>;
|
||||
}
|
||||
+7
-4
@@ -10,13 +10,16 @@ using static ErsatzTV.Application.Libraries.Mapper;
|
||||
|
||||
namespace ErsatzTV.Application.Libraries.Queries
|
||||
{
|
||||
public class GetAllLibrariesHandler : IRequestHandler<GetAllLibraries, List<LibraryViewModel>>
|
||||
public class GetConfiguredLibrariesHandler : IRequestHandler<GetConfiguredLibraries, List<LibraryViewModel>>
|
||||
{
|
||||
private readonly ILibraryRepository _libraryRepository;
|
||||
|
||||
public GetAllLibrariesHandler(ILibraryRepository libraryRepository) => _libraryRepository = libraryRepository;
|
||||
public GetConfiguredLibrariesHandler(ILibraryRepository libraryRepository) =>
|
||||
_libraryRepository = libraryRepository;
|
||||
|
||||
public Task<List<LibraryViewModel>> Handle(GetAllLibraries request, CancellationToken cancellationToken) =>
|
||||
public Task<List<LibraryViewModel>> Handle(
|
||||
GetConfiguredLibraries request,
|
||||
CancellationToken cancellationToken) =>
|
||||
_libraryRepository.GetAll()
|
||||
.Map(
|
||||
list => list.Filter(ShouldIncludeLibrary)
|
||||
@@ -28,7 +31,7 @@ namespace ErsatzTV.Application.Libraries.Queries
|
||||
private static bool ShouldIncludeLibrary(Library library) =>
|
||||
library switch
|
||||
{
|
||||
LocalLibrary => true,
|
||||
LocalLibrary => library.Paths.Count > 0,
|
||||
PlexLibrary plex => plex.ShouldSyncItems,
|
||||
JellyfinLibrary jellyfin => jellyfin.ShouldSyncItems,
|
||||
EmbyLibrary emby => emby.ShouldSyncItems,
|
||||
@@ -62,6 +62,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
||||
return context.Libraries
|
||||
.AsNoTracking()
|
||||
.Include(l => l.MediaSource)
|
||||
.Include(l => l.Paths)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
|
||||
private async Task LoadLibraries()
|
||||
{
|
||||
_libraries = await _mediator.Send(new GetAllLibraries());
|
||||
_libraries = await _mediator.Send(new GetConfiguredLibraries());
|
||||
_progressByLibrary = _libraries.ToDictionary(vm => vm.Id, _ => 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user