plex collection rework (#1503)

* start to rework plex collection scanning

* sync plex collections to db

* sync plex collection items

* update changelog
This commit is contained in:
Jason Dove
2023-11-14 10:41:21 -06:00
committed by GitHub
parent 948b3735bd
commit b95a89b11f
40 changed files with 9986 additions and 103 deletions
+23
View File
@@ -70,6 +70,10 @@ public class Worker : BackgroundService
scanPlexCommand.AddOption(forceOption);
scanPlexCommand.AddOption(deepOption);
var scanPlexCollectionsCommand = new Command("scan-plex-collections", "Scan Plex collections");
scanPlexCollectionsCommand.AddArgument(mediaSourceIdArgument);
scanPlexCollectionsCommand.AddOption(forceOption);
var scanEmbyCommand = new Command("scan-emby", "Scan an Emby library");
scanEmbyCommand.AddArgument(libraryIdArgument);
scanEmbyCommand.AddOption(forceOption);
@@ -124,6 +128,24 @@ public class Worker : BackgroundService
await mediator.Send(scan, context.GetCancellationToken());
}
});
scanPlexCollectionsCommand.SetHandler(
async context =>
{
if (IsScanningEnabled())
{
bool force = context.ParseResult.GetValueForOption(forceOption);
SetProcessPriority(force);
int mediaSourceId = context.ParseResult.GetValueForArgument(mediaSourceIdArgument);
using IServiceScope scope = _serviceScopeFactory.CreateScope();
IMediator mediator = scope.ServiceProvider.GetRequiredService<IMediator>();
var scan = new SynchronizePlexCollections(mediaSourceId, force);
await mediator.Send(scan, context.GetCancellationToken());
}
});
scanEmbyCommand.SetHandler(
async context =>
@@ -202,6 +224,7 @@ public class Worker : BackgroundService
var rootCommand = new RootCommand();
rootCommand.AddCommand(scanLocalCommand);
rootCommand.AddCommand(scanPlexCommand);
rootCommand.AddCommand(scanPlexCollectionsCommand);
rootCommand.AddCommand(scanEmbyCommand);
rootCommand.AddCommand(scanEmbyCollectionsCommand);
rootCommand.AddCommand(scanJellyfinCommand);