mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-07-08 18:16:25 +00:00
Make redump.info the default, add flag for old site
This commit is contained in:
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using SabreTools.CommandLine;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
{
|
||||
@@ -29,6 +28,9 @@ namespace RedumpTool.Features
|
||||
private const string _passwordName = "password";
|
||||
internal readonly StringInput PasswordInput = new(_passwordName, ["-p", "--password"], "Redump password");
|
||||
|
||||
private const string _oldSiteName = "oldsite";
|
||||
internal readonly FlagInput OldSiteInput = new(_oldSiteName, ["--old"], "Connect to redump.org instead of redump.info");
|
||||
|
||||
private const string _timeoutName = "timeout";
|
||||
internal readonly Int32Input TimeoutInput = new(_timeoutName, ["-t", "--timeout"], "Request timeout in whole seconds (default 30)");
|
||||
|
||||
@@ -119,16 +121,22 @@ namespace RedumpTool.Features
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Client to use for external connections
|
||||
/// redump.info client to use for external connections
|
||||
/// </summary>
|
||||
protected Client _client;
|
||||
protected SabreTools.RedumpLib.RedumpInfo.Client _infoClient;
|
||||
|
||||
/// <summary>
|
||||
/// redump.org client to use for external connections
|
||||
/// </summary>
|
||||
protected SabreTools.RedumpLib.RedumpOrg.Client _orgClient;
|
||||
|
||||
#endregion
|
||||
|
||||
public BaseFeature(string name, string[] flags, string description, string? detailed = null)
|
||||
: base(name, flags, description, detailed)
|
||||
{
|
||||
_client = new Client();
|
||||
_infoClient = new SabreTools.RedumpLib.RedumpInfo.Client();
|
||||
_orgClient = new SabreTools.RedumpLib.RedumpOrg.Client();
|
||||
}
|
||||
|
||||
#region Helpers
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Disc path
|
||||
Add(DiscIdInput);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.RedumpInfo;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
@@ -37,6 +38,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Specific
|
||||
Add(SubfoldersInput);
|
||||
@@ -53,6 +55,7 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// Get specific values
|
||||
bool useSubfolders = SubfoldersInput.Value;
|
||||
@@ -61,24 +64,49 @@ namespace RedumpTool.Features
|
||||
if (!ValidateAndCreateOutputDirectory(outDir))
|
||||
return false;
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
// If connecting to redump.org
|
||||
if (oldSite)
|
||||
{
|
||||
// Update redump.org client properties
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
// Login to redump.org, if necessary
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
var processingTask = _client.DownloadAllPacks(outDir, useSubfolders);
|
||||
// Start the processing
|
||||
var processingTask = _orgClient.DownloadAllPacks(outDir, useSubfolders);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
return processingTask.Result;
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
return processingTask.Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update redump.info client properties
|
||||
_infoClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_infoClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_infoClient.Overwrite = forceDownload;
|
||||
_infoClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to redump.info, if necessary
|
||||
_infoClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
var processingTask = _infoClient.DownloadAllPacks(outDir, useSubfolders);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
return processingTask.Result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using SabreTools.RedumpLib.RedumpInfo;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
@@ -52,6 +53,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Specific
|
||||
Add(QueryInput);
|
||||
@@ -72,6 +74,7 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// Get specific values
|
||||
bool onlyList = ListInput.Value;
|
||||
@@ -81,11 +84,19 @@ namespace RedumpTool.Features
|
||||
bool onlyFiles = OnlyFilesInput.Value;
|
||||
|
||||
// Build the disc subpaths
|
||||
DiscSubpath[]? discSubpaths = Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = Constants.DiscFilesOnly;
|
||||
DiscSubpath[]? discSubpaths;
|
||||
if (oldSite)
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscFilesOnly;
|
||||
}
|
||||
else
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpInfo.Constants.AllDiscSubpaths;
|
||||
}
|
||||
|
||||
// Output directory validation
|
||||
if (!onlyList && !ValidateAndCreateOutputDirectory(outDir))
|
||||
@@ -98,31 +109,63 @@ namespace RedumpTool.Features
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
// If connecting to redump.org
|
||||
if (oldSite)
|
||||
{
|
||||
// Update redump.org client properties
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
// Login to redump.org, if necessary
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _client.ListDiscsResults(quicksearch: query, limit: limit);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _orgClient.ListDiscsResults(quicksearch: query, limit: limit);
|
||||
else
|
||||
processingTask = _orgClient.DownloadDiscsResults(outDir, quicksearch: query, limit: limit, discSubpaths: discSubpaths);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
else
|
||||
processingTask = _client.DownloadDiscsResults(outDir, quicksearch: query, limit: limit, discSubpaths: discSubpaths);
|
||||
{
|
||||
// Update redump.info client properties
|
||||
_infoClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_infoClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_infoClient.Overwrite = forceDownload;
|
||||
_infoClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
// Login to edump.info, if necessary
|
||||
_infoClient.Login(username, password).Wait();
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _infoClient.ListDiscsResults(quicksearch: query, limit: limit);
|
||||
else
|
||||
processingTask = _infoClient.DownloadDiscsResults(outDir, quicksearch: query, limit: limit, discSubpaths: discSubpaths);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using SabreTools.RedumpLib.RedumpInfo;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
@@ -55,6 +56,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Discs Path
|
||||
Add(AntiModchipInput);
|
||||
@@ -102,6 +104,7 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// Get discs path values
|
||||
bool? antimodchip = AntiModchipInput.Value;
|
||||
@@ -154,11 +157,19 @@ namespace RedumpTool.Features
|
||||
bool onlyFiles = OnlyFilesInput.Value;
|
||||
|
||||
// Build the disc subpaths
|
||||
DiscSubpath[]? discSubpaths = Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = Constants.DiscFilesOnly;
|
||||
DiscSubpath[]? discSubpaths;
|
||||
if (oldSite)
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscFilesOnly;
|
||||
}
|
||||
else
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpInfo.Constants.AllDiscSubpaths;
|
||||
}
|
||||
|
||||
// Override individual flags if shorthand flags used
|
||||
if (onlyNew)
|
||||
@@ -171,61 +182,109 @@ namespace RedumpTool.Features
|
||||
if (!ValidateAndCreateOutputDirectory(outDir))
|
||||
return false;
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (minId >= 0 && maxId >= 0)
|
||||
// If connecting to redump.org
|
||||
if (oldSite)
|
||||
{
|
||||
processingTask = _client.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
|
||||
// Update redump.org client properties
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to redump.org, if necessary
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (minId >= 0 && maxId >= 0)
|
||||
{
|
||||
processingTask = _orgClient.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
|
||||
}
|
||||
else
|
||||
{
|
||||
processingTask = _orgClient.DownloadDiscsResults(outDir,
|
||||
antimodchip,
|
||||
barcode,
|
||||
category,
|
||||
mediaType,
|
||||
dumper,
|
||||
edc,
|
||||
edition,
|
||||
errors,
|
||||
language,
|
||||
letter,
|
||||
libcrypt,
|
||||
media,
|
||||
offset,
|
||||
quicksearch,
|
||||
region,
|
||||
ringcode,
|
||||
sort,
|
||||
sortDir,
|
||||
status,
|
||||
system,
|
||||
tracks,
|
||||
comments,
|
||||
contents,
|
||||
protection,
|
||||
limit,
|
||||
discSubpaths: discSubpaths);
|
||||
}
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
processingTask = _client.DownloadDiscsResults(outDir,
|
||||
antimodchip,
|
||||
barcode,
|
||||
category,
|
||||
mediaType,
|
||||
dumper,
|
||||
edc,
|
||||
edition,
|
||||
errors,
|
||||
language,
|
||||
letter,
|
||||
libcrypt,
|
||||
media,
|
||||
offset,
|
||||
quicksearch,
|
||||
region,
|
||||
ringcode,
|
||||
sort,
|
||||
sortDir,
|
||||
status,
|
||||
system,
|
||||
tracks,
|
||||
comments,
|
||||
contents,
|
||||
protection,
|
||||
limit,
|
||||
discSubpaths: discSubpaths);
|
||||
// Update redump.info client properties
|
||||
_infoClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_infoClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_infoClient.Overwrite = forceDownload;
|
||||
_infoClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to redump.info, if necessary
|
||||
_infoClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (minId >= 0 && maxId >= 0)
|
||||
{
|
||||
processingTask = _infoClient.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
|
||||
}
|
||||
else
|
||||
{
|
||||
processingTask = _infoClient.DownloadDiscsResults(outDir,
|
||||
comments ? quicksearch : null,
|
||||
dumper,
|
||||
edition,
|
||||
letter,
|
||||
comments ? null : quicksearch,
|
||||
region,
|
||||
sort,
|
||||
sortDir,
|
||||
status,
|
||||
system,
|
||||
limit,
|
||||
discSubpaths: discSubpaths);
|
||||
}
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -42,25 +43,30 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// None of this is valid for redump.info
|
||||
if (!oldSite)
|
||||
return false;
|
||||
|
||||
// Output directory validation
|
||||
if (!ValidateAndCreateOutputDirectory(outDir))
|
||||
return false;
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<bool> processingTask = _client.DownloadStatisticsPage(outDir);
|
||||
Task<bool> processingTask = _orgClient.DownloadStatisticsPage(outDir);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using SabreTools.RedumpLib.RedumpInfo;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
@@ -52,6 +53,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Specific
|
||||
Add(OnlyNewInput);
|
||||
@@ -72,6 +74,7 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// Get specific values
|
||||
bool onlyNew = OnlyNewInput.Value;
|
||||
@@ -81,43 +84,85 @@ namespace RedumpTool.Features
|
||||
bool onlyFiles = OnlyFilesInput.Value;
|
||||
|
||||
// Build the disc subpaths
|
||||
DiscSubpath[]? discSubpaths = Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = Constants.DiscFilesOnly;
|
||||
DiscSubpath[]? discSubpaths;
|
||||
if (oldSite)
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.AllDiscSubpaths;
|
||||
if (onlyPages)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscSubPagesOnly;
|
||||
else if (onlyFiles)
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpOrg.Constants.DiscFilesOnly;
|
||||
}
|
||||
else
|
||||
{
|
||||
discSubpaths = SabreTools.RedumpLib.RedumpInfo.Constants.AllDiscSubpaths;
|
||||
}
|
||||
|
||||
// Output directory validation
|
||||
if (!onlyList && !ValidateAndCreateOutputDirectory(outDir))
|
||||
return false;
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
// If connecting to redump.org
|
||||
if (oldSite)
|
||||
{
|
||||
// Update redump.org client properties
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
// Login to redump.org, if necessary
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _client.ListDiscsResults(dumper: username, limit: limit);
|
||||
else if (onlyNew)
|
||||
processingTask = _client.DownloadDiscsResults(outDir, dumper: username, sort: SortCategory.Modified, sortDir: SortDirection.Descending, limit: limit, discSubpaths: discSubpaths);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _orgClient.ListDiscsResults(dumper: username, limit: limit);
|
||||
else if (onlyNew)
|
||||
processingTask = _orgClient.DownloadDiscsResults(outDir, dumper: username, sort: SortCategory.Modified, sortDir: SortDirection.Descending, limit: limit, discSubpaths: discSubpaths);
|
||||
else
|
||||
processingTask = _orgClient.DownloadDiscsResults(outDir, dumper: username, limit: limit, discSubpaths: discSubpaths);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
else
|
||||
processingTask = _client.DownloadDiscsResults(outDir, dumper: username, limit: limit, discSubpaths: discSubpaths);
|
||||
{
|
||||
// Update redump.info client properties
|
||||
_infoClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_infoClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_infoClient.Overwrite = forceDownload;
|
||||
_infoClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
// Login to redump.info, if necessary
|
||||
_infoClient.Login(username, password).Wait();
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyList)
|
||||
processingTask = _infoClient.ListDiscsResults(dumper: username, limit: limit);
|
||||
else if (onlyNew)
|
||||
processingTask = _infoClient.DownloadDiscsResults(outDir, dumper: username, sort: SortCategory.Modified, sortDir: SortDirection.Descending, limit: limit, discSubpaths: discSubpaths);
|
||||
else
|
||||
processingTask = _infoClient.DownloadDiscsResults(outDir, dumper: username, limit: limit, discSubpaths: discSubpaths);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.CommandLine.Inputs;
|
||||
using SabreTools.RedumpLib.RedumpInfo;
|
||||
using SabreTools.RedumpLib.RedumpOrg;
|
||||
|
||||
namespace RedumpTool.Features
|
||||
@@ -45,6 +46,7 @@ namespace RedumpTool.Features
|
||||
Add(TimeoutInput);
|
||||
Add(ForceDownloadInput);
|
||||
Add(ForceContinueInput);
|
||||
Add(OldSiteInput);
|
||||
|
||||
// Specific
|
||||
Add(MinimumInput);
|
||||
@@ -63,6 +65,7 @@ namespace RedumpTool.Features
|
||||
int? timeout = TimeoutInput.Value;
|
||||
bool forceDownload = ForceDownloadInput.Value;
|
||||
bool forceContinue = ForceContinueInput.Value;
|
||||
bool oldSite = OldSiteInput.Value;
|
||||
|
||||
// Get specific values
|
||||
int minId = MinimumInput.Value ?? -1;
|
||||
@@ -80,31 +83,63 @@ namespace RedumpTool.Features
|
||||
return false;
|
||||
}
|
||||
|
||||
// Update client properties
|
||||
_client.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_client.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_client.Overwrite = forceDownload;
|
||||
_client.IgnoreErrors = forceContinue;
|
||||
// If connecting to redump.org
|
||||
if (oldSite)
|
||||
{
|
||||
// Update redump.org properties
|
||||
_orgClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_orgClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_orgClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_orgClient.Overwrite = forceDownload;
|
||||
_orgClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Login to Redump, if necessary
|
||||
_client.Login(username, password).Wait();
|
||||
// Login to redump.org, if necessary
|
||||
_orgClient.Login(username, password).Wait();
|
||||
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyNew)
|
||||
processingTask = _client.DownloadLastSubmitted(outDir);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyNew)
|
||||
processingTask = _orgClient.DownloadLastSubmitted(outDir);
|
||||
else
|
||||
processingTask = _orgClient.DownloadWIPRange(outDir, minId, maxId);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
else
|
||||
processingTask = _client.DownloadWIPRange(outDir, minId, maxId);
|
||||
{
|
||||
// Update redump.info properties
|
||||
_infoClient.Debug = DebugInput.Value;
|
||||
if (attemptCount != null && attemptCount > 0)
|
||||
_infoClient.AttemptCount = attemptCount.Value;
|
||||
if (timeout != null && timeout > 0)
|
||||
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
|
||||
_infoClient.Overwrite = forceDownload;
|
||||
_infoClient.IgnoreErrors = forceContinue;
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
// Login to redump.info, if necessary
|
||||
_infoClient.Login(username, password).Wait();
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
// Start the processing
|
||||
Task<List<int>> processingTask;
|
||||
if (onlyNew)
|
||||
processingTask = _infoClient.DownloadLastSubmitted(outDir);
|
||||
else
|
||||
processingTask = _infoClient.DownloadQueueRange(outDir, minId, maxId);
|
||||
|
||||
// Retrieve the result
|
||||
processingTask.Wait();
|
||||
var processedIds = processingTask.Result;
|
||||
|
||||
// Display the processed IDs
|
||||
return PrintProcessedIds(processedIds);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
|
||||
/// <returns>All disc IDs for the given query, empty on error</returns>
|
||||
public static async Task<List<int>> DownloadDiscsResults(this Client client,
|
||||
string? outDir,
|
||||
string? comments,
|
||||
string? comments = null,
|
||||
string? dumper = null,
|
||||
string? edition = null,
|
||||
char? letter = null,
|
||||
|
||||
Reference in New Issue
Block a user