* fix plex library synchronization * add basic plex movie synchronization * proxy plex movie thumbnails (posters) * add plex path replacements * use transcoded plex artwork * remove unsynchronized plex movies on save; queue plex library scan on save * log plex path replacements * prefer buttons instead of menus * lock plex libraries before sync * add movie to collection from paged view * fix plex import memory use; quick add seasons/shows * quick add episode to collection * add favicon * add search page * disable plex for now
34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using ErsatzTV.Core;
|
|
using ErsatzTV.Core.Interfaces.Repositories;
|
|
using LanguageExt;
|
|
|
|
namespace ErsatzTV.Application.Plex.Commands
|
|
{
|
|
public class
|
|
UpdatePlexLibraryPreferencesHandler : MediatR.IRequestHandler<UpdatePlexLibraryPreferences,
|
|
Either<BaseError, Unit>>
|
|
{
|
|
private readonly IMediaSourceRepository _mediaSourceRepository;
|
|
|
|
public UpdatePlexLibraryPreferencesHandler(IMediaSourceRepository mediaSourceRepository) =>
|
|
_mediaSourceRepository = mediaSourceRepository;
|
|
|
|
public async Task<Either<BaseError, Unit>> Handle(
|
|
UpdatePlexLibraryPreferences request,
|
|
CancellationToken cancellationToken)
|
|
{
|
|
var toDisable = request.Preferences.Filter(p => p.ShouldSyncItems == false).Map(p => p.Id).ToList();
|
|
await _mediaSourceRepository.DisablePlexLibrarySync(toDisable);
|
|
|
|
IEnumerable<int> toEnable = request.Preferences.Filter(p => p.ShouldSyncItems).Map(p => p.Id);
|
|
await _mediaSourceRepository.EnablePlexLibrarySync(toEnable);
|
|
|
|
return Unit.Default;
|
|
}
|
|
}
|
|
}
|