Queue and Site features share more in common

This commit is contained in:
Matt Nadareski
2026-07-08 14:09:31 -04:00
parent 55865a9535
commit c7ac2fe78b
3 changed files with 79 additions and 25 deletions

View File

@@ -33,6 +33,9 @@ namespace RedumpTool.Features
private const string _minimumName = "minimum";
internal readonly Int32Input MinimumInput = new(_minimumName, ["-min", "--minimum"], "Lower bound for page numbers (incompatible with --onlynew)");
private const string _limitName = "limit";
internal readonly Int32Input LimitInput = new(_limitName, ["--limit"], "Limit number of retrieved result pages");
private const string _listName = "list";
internal readonly FlagInput ListInput = new(_listName, ["-l", "--list"], "Only list the page IDs for the filters");
@@ -72,6 +75,7 @@ namespace RedumpTool.Features
Add(ForceContinueInput);
// Specific
Add(LimitInput);
Add(ListInput);
Add(MinimumInput);
Add(MaximumInput);
@@ -100,6 +104,7 @@ namespace RedumpTool.Features
bool forceContinue = ForceContinueInput.Value;
// Get specific values
int limit = LimitInput.Value ?? -1;
int? minId = MinimumInput.Value;
int? maxId = MaximumInput.Value;
bool onlyList = ListInput.Value;
@@ -159,7 +164,8 @@ namespace RedumpTool.Features
status,
submitter,
subType,
system);
system,
limit);
}
else if ((minId is null || maxId is null) && !onlyList)
{
@@ -171,7 +177,8 @@ namespace RedumpTool.Features
status,
submitter,
subType,
system);
system,
limit);
}
else
{

View File

@@ -64,6 +64,9 @@ namespace RedumpTool.Features
private const string _limitName = "limit";
internal readonly Int32Input LimitInput = new(_limitName, ["--limit"], "Limit number of retrieved result pages");
private const string _listName = "list";
internal readonly FlagInput ListInput = new(_listName, ["-l", "--list"], "Only list the page IDs for the filters");
private const string _maximumName = "maximum";
internal readonly Int32Input MaximumInput = new(_maximumName, ["-max", "--maximum"], "Upper bound for page numbers (incompatible with --onlynew)");
@@ -76,9 +79,6 @@ namespace RedumpTool.Features
private const string _offsetName = "offset";
internal readonly Int32Input OffsetInput = new(_offsetName, ["--offset"], "Add offset to filter");
private const string _onlyNewName = "onlynew";
internal readonly FlagInput OnlyNewInput = new(_onlyNewName, ["-n", "--onlynew"], "Use the last modified view (incompatible with min and max)");
private const string _orderName = "order";
internal readonly StringInput OrderInput = new(_orderName, ["--order"], "Add sort order to filter [asc, desc]");
@@ -145,10 +145,10 @@ namespace RedumpTool.Features
Add(ForceContinueInput);
// Specific
Add(LimitInput);
Add(ListInput);
Add(MinimumInput);
Add(MaximumInput);
Add(OnlyNewInput);
Add(LimitInput);
// Filter
Add(BarcodeInput);
@@ -197,10 +197,10 @@ namespace RedumpTool.Features
bool forceContinue = ForceContinueInput.Value;
// Get specific values
int minId = MinimumInput.Value ?? -1;
int maxId = MaximumInput.Value ?? -1;
bool onlyNew = OnlyNewInput.Value;
int limit = LimitInput.Value ?? -1;
int? minId = MinimumInput.Value;
int? maxId = MaximumInput.Value;
bool onlyList = ListInput.Value;
// Get filter values
string? barcode = BarcodeInput.Value;
@@ -240,17 +240,27 @@ namespace RedumpTool.Features
// Build the disc subpaths
DiscSubpath[] discSubpaths = Constants.AllDiscSubpaths;
// Override individual flags if shorthand flags used
if (onlyNew)
{
sort = SortCategory.Modified;
order = SortDirection.Descending;
}
// Output directory validation
if (!ValidateAndCreateOutputDirectory(outDir))
if (!onlyList && !ValidateAndCreateOutputDirectory(outDir))
return false;
// Range verification
if ((minId is null) ^ (maxId is null))
{
Console.WriteLine("Both a maximum and minimum ID are required");
return false;
}
else if (minId is not null && minId < 0)
{
Console.WriteLine($"{minId} is an invalid minimum ID");
return false;
}
else if (maxId is not null && maxId < 0)
{
Console.WriteLine($"{maxId} is an invalid maximum ID");
return false;
}
// Update redump.info client properties
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
@@ -265,11 +275,44 @@ namespace RedumpTool.Features
// Start the processing
Task<List<int>> processingTask;
if (minId >= 0 && maxId >= 0)
if ((minId is null || maxId is null) && onlyList)
{
processingTask = _client.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
processingTask = _client.ListDiscsResults(
advanced: true, // Hardcoded, only toggles the advanced options on page by default
barcode,
barcodeExact,
category,
comments,
contents,
dumper,
edc,
edition,
editionExact,
errorsMax,
errorsMin,
language,
letter,
media,
offset,
order,
protection,
query,
region,
ringcode,
serial,
serialExact,
sort,
status,
system,
title,
titleExact,
titleForeign,
titleForeignExact,
tracksMax,
tracksMin,
limit);
}
else
else if ((minId is null || maxId is null) && !onlyList)
{
processingTask = _client.DownloadDiscsResults(outDir,
advanced: true, // Hardcoded, only toggles the advanced options on page by default
@@ -307,6 +350,10 @@ namespace RedumpTool.Features
limit: limit,
discSubpaths: discSubpaths);
}
else
{
processingTask = _client.DownloadSiteRange(outDir, minId!.Value, maxId!.Value, discSubpaths: discSubpaths);
}
// Retrieve the result
processingTask.Wait();

View File

@@ -81,11 +81,10 @@ namespace RedumpTool
Console.WriteLine();
Console.WriteLine("site - Download pages and related files from the main site");
Console.WriteLine(" -min <MinId>, --minimum <MinId> - Lower bound for page numbers (incompatible with --onlynew)");
Console.WriteLine(" -max <MaxId>, --maximum <MaxId> - Upper bound for page numbers (incompatible with --onlynew)");
Console.WriteLine(" -n, --onlynew - Use the last modified view (incompatible with min and max)");
Console.WriteLine(" Internally this sets '--sort modified -sort-dir desc'");
Console.WriteLine(" --limit <Limit> - Limit number of retrieved result pages");
Console.WriteLine(" -l, --list - Only list the page IDs for the filters (incompatible with --minimum and --maximum)");
Console.WriteLine(" -min <MinId>, --minimum <MinId> - Lower bound for page numbers (requires --maximum, incompatible with --list)");
Console.WriteLine(" -max <MaxId>, --maximum <MaxId> - Upper bound for page numbers (requires --minimum, incompatible with --list)");
Console.WriteLine();
Console.WriteLine(" In addition to the above options, there are advanced options that allow users to finely tune their");
Console.WriteLine(" site queries. All flags below are incompatible with --minimum, --maximum, and --onlynew.");
@@ -123,6 +122,7 @@ namespace RedumpTool
Console.WriteLine();
Console.WriteLine("queue - Download pages and related files from the submission queue");
Console.WriteLine(" --limit <Limit> - Limit number of retrieved result pages");
Console.WriteLine(" -l, --list - Only list the page IDs for the filters (incompatible with --minimum and --maximum)");
Console.WriteLine(" -min <MinId>, --minimum <MinId> - Lower bound for page numbers (requires --maximum, incompatible with --list)");
Console.WriteLine(" -max <MaxId>, --maximum <MaxId> - Upper bound for page numbers (requires --minimum, incompatible with --list)");