Exemplo n.º 1
0
    HandleImpl(ISynchronizeJellyfinLibraryById request, CancellationToken cancellationToken)
    {
        Validation <BaseError, RequestParameters> validation = await Validate(request);

        return(await validation.Match(
                   parameters => Synchronize(parameters, cancellationToken),
                   error => Task.FromResult <Either <BaseError, string> >(error.Join())));
    }
Exemplo n.º 2
0
    private async Task SynchronizeJellyfinLibrary(
        ISynchronizeJellyfinLibraryById request,
        CancellationToken cancellationToken)
    {
        using IServiceScope scope = _serviceScopeFactory.CreateScope();
        IMediator mediator = scope.ServiceProvider.GetRequiredService <IMediator>();

        Either <BaseError, string> result = await mediator.Send(request, cancellationToken);

        result.BiIter(
            name => _logger.LogDebug("Done synchronizing jellyfin library {Name}", name),
            error => _logger.LogWarning(
                "Unable to synchronize jellyfin library {LibraryId}: {Error}",
                request.JellyfinLibraryId,
                error.Value));
    }
Exemplo n.º 3
0
 private async Task <Validation <BaseError, RequestParameters> > Validate(
     ISynchronizeJellyfinLibraryById request) =>
 (await ValidateConnection(request), await JellyfinLibraryMustExist(request),