* re-enable plex, temp force secure connections * add plex fanart * synchronize genre from plex * fix plex library sync * improve stream error handling * synchronize plex artwork * use switch instead of button * prioritize local connections for insecure plex sources * sign out of plex * better plex sign in/out * code cleanup * fix plex movie aspect ratio and scan type
37 lines
1.2 KiB
C#
37 lines
1.2 KiB
C#
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using ErsatzTV.Core;
|
|
using ErsatzTV.Core.Interfaces.Locking;
|
|
using ErsatzTV.Core.Interfaces.Plex;
|
|
using ErsatzTV.Core.Interfaces.Repositories;
|
|
using LanguageExt;
|
|
|
|
namespace ErsatzTV.Application.Plex.Commands
|
|
{
|
|
public class SignOutOfPlexHandler : MediatR.IRequestHandler<SignOutOfPlex, Either<BaseError, Unit>>
|
|
{
|
|
private readonly IEntityLocker _entityLocker;
|
|
private readonly IMediaSourceRepository _mediaSourceRepository;
|
|
private readonly IPlexSecretStore _plexSecretStore;
|
|
|
|
public SignOutOfPlexHandler(
|
|
IMediaSourceRepository mediaSourceRepository,
|
|
IPlexSecretStore plexSecretStore,
|
|
IEntityLocker entityLocker)
|
|
{
|
|
_mediaSourceRepository = mediaSourceRepository;
|
|
_plexSecretStore = plexSecretStore;
|
|
_entityLocker = entityLocker;
|
|
}
|
|
|
|
public async Task<Either<BaseError, Unit>> Handle(SignOutOfPlex request, CancellationToken cancellationToken)
|
|
{
|
|
await _mediaSourceRepository.DeleteAllPlex();
|
|
await _plexSecretStore.DeleteAll();
|
|
_entityLocker.UnlockPlex();
|
|
|
|
return Unit.Default;
|
|
}
|
|
}
|
|
}
|