Refactor media source handling and update collection options
- Updated `IMediaSourceCatalog` to support user-added media sources, allowing dynamic editing and management of sources. - Removed the `UrlListSource` class as its functionality is now integrated into the new catalog structure. - Enhanced `CollectOptions` to default `RequireProxy` to true, ensuring stricter handling of proxy requirements. - Improved error handling in `ParseError` to include a `Subject` field for better context on failures. - Adjusted dependency injection to reflect changes in media source management, removing old source registrations. - Introduced background proxy checks to ensure a more robust proxy pool management during collection processes. These changes streamline the media collection process and improve the overall user experience by providing clearer error reporting and more flexible source management.
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using AvParser.Core.Collecting;
|
||||
using AvParser.Core.Collecting.Sources;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace AvParser.Core.DependencyInjection;
|
||||
@@ -8,26 +6,13 @@ namespace AvParser.Core.DependencyInjection;
|
||||
public static class CoreServiceCollectionExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers every media source the domain itself provides.
|
||||
/// Registers the domain services. Media sources are user-added data now, not registered types,
|
||||
/// so they are built from the persisted store in the infrastructure layer rather than here.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Adding a source is a one-line change here — that is the whole point of the
|
||||
/// <see cref="IMediaSource"/> / <see cref="IMediaSourceCatalog"/> split. Sources that need a
|
||||
/// network live in the infrastructure layer and register themselves there.
|
||||
/// </remarks>
|
||||
public static IServiceCollection AddAvParserCore(this IServiceCollection services)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(services);
|
||||
|
||||
services.AddSingleton<IMediaSource, UrlListSource>();
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
/// <summary>Id of the source the collector opens on.</summary>
|
||||
/// <remarks>
|
||||
/// Named rather than left to alphabetical order, which would land on the network source and
|
||||
/// open the page behind the proxy gate before the user has asked for anything.
|
||||
/// </remarks>
|
||||
public const string DefaultMediaSourceId = "url-list";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user