fix emby scanning (#1201)
This commit is contained in:
@@ -50,9 +50,6 @@ public class EmbyService : BackgroundService
|
||||
case SynchronizeEmbyMediaSources synchronizeEmbyMediaSources:
|
||||
requestTask = SynchronizeSources(synchronizeEmbyMediaSources, cancellationToken);
|
||||
break;
|
||||
case SynchronizeEmbyLibraries synchronizeEmbyLibraries:
|
||||
requestTask = SynchronizeLibraries(synchronizeEmbyLibraries, cancellationToken);
|
||||
break;
|
||||
default:
|
||||
throw new NotSupportedException($"Unsupported request type: {request.GetType().Name}");
|
||||
}
|
||||
@@ -105,20 +102,4 @@ public class EmbyService : BackgroundService
|
||||
error.Value);
|
||||
});
|
||||
}
|
||||
|
||||
private async Task SynchronizeLibraries(SynchronizeEmbyLibraries request, CancellationToken cancellationToken)
|
||||
{
|
||||
using IServiceScope scope = _serviceScopeFactory.CreateScope();
|
||||
IMediator mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
|
||||
Either<BaseError, Unit> result = await mediator.Send(request, cancellationToken);
|
||||
result.BiIter(
|
||||
_ => _logger.LogInformation(
|
||||
"Successfully synchronized Emby libraries for source {MediaSourceId}",
|
||||
request.EmbyMediaSourceId),
|
||||
error => _logger.LogWarning(
|
||||
"Unable to synchronize Emby libraries for source {MediaSourceId}: {Error}",
|
||||
request.EmbyMediaSourceId,
|
||||
error.Value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,9 @@ public class ScannerService : BackgroundService
|
||||
case ISynchronizeJellyfinLibraryById synchronizeJellyfinLibraryById:
|
||||
requestTask = SynchronizeJellyfinLibrary(synchronizeJellyfinLibraryById, cancellationToken);
|
||||
break;
|
||||
case SynchronizeEmbyLibraries synchronizeEmbyLibraries:
|
||||
requestTask = SynchronizeLibraries(synchronizeEmbyLibraries, cancellationToken);
|
||||
break;
|
||||
case ISynchronizeEmbyLibraryById synchronizeEmbyLibraryById:
|
||||
requestTask = SynchronizeEmbyLibrary(synchronizeEmbyLibraryById, cancellationToken);
|
||||
break;
|
||||
@@ -224,6 +227,22 @@ public class ScannerService : BackgroundService
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SynchronizeLibraries(SynchronizeEmbyLibraries request, CancellationToken cancellationToken)
|
||||
{
|
||||
using IServiceScope scope = _serviceScopeFactory.CreateScope();
|
||||
IMediator mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
|
||||
|
||||
Either<BaseError, Unit> result = await mediator.Send(request, cancellationToken);
|
||||
result.BiIter(
|
||||
_ => _logger.LogInformation(
|
||||
"Successfully synchronized Emby libraries for source {MediaSourceId}",
|
||||
request.EmbyMediaSourceId),
|
||||
error => _logger.LogWarning(
|
||||
"Unable to synchronize Emby libraries for source {MediaSourceId}: {Error}",
|
||||
request.EmbyMediaSourceId,
|
||||
error.Value));
|
||||
}
|
||||
|
||||
private async Task SynchronizeEmbyLibrary(ISynchronizeEmbyLibraryById request, CancellationToken cancellationToken)
|
||||
{
|
||||
using IServiceScope scope = _serviceScopeFactory.CreateScope();
|
||||
|
||||
Reference in New Issue
Block a user