Make info web client default

This commit is contained in:
Matt Nadareski
2026-06-21 22:37:54 -04:00
parent a59cf981a9
commit 0c78886e03
10 changed files with 49 additions and 47 deletions

View File

@@ -123,7 +123,7 @@ namespace RedumpTool.Features
/// <summary>
/// redump.info client to use for external connections
/// </summary>
protected SabreTools.RedumpLib.RedumpInfo.Client _infoClient;
protected SabreTools.RedumpLib.Web.Client _client;
/// <summary>
/// redump.org client to use for external connections
@@ -135,7 +135,7 @@ namespace RedumpTool.Features
public BaseFeature(string name, string[] flags, string description, string? detailed = null)
: base(name, flags, description, detailed)
{
_infoClient = new SabreTools.RedumpLib.RedumpInfo.Client();
_client = new SabreTools.RedumpLib.Web.Client();
_orgClient = new SabreTools.RedumpLib.RedumpOrg.Client();
}

View File

@@ -89,19 +89,19 @@ namespace RedumpTool.Features
else
{
// Update redump.info client properties
_infoClient.Debug = DebugInput.Value;
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
_infoClient.AttemptCount = attemptCount.Value;
_client.AttemptCount = attemptCount.Value;
if (timeout != null && timeout > 0)
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
_infoClient.Overwrite = forceDownload;
_infoClient.IgnoreErrors = forceContinue;
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
_client.Overwrite = forceDownload;
_client.IgnoreErrors = forceContinue;
// Login to redump.info, if necessary
_infoClient.Login(username, password).Wait();
_client.Login(username, password).Wait();
// Start the processing
var processingTask = _infoClient.DownloadAllPacks(outDir, useSubfolders);
var processingTask = _client.DownloadAllPacks(outDir, useSubfolders);
// Retrieve the result
processingTask.Wait();

View File

@@ -141,23 +141,23 @@ namespace RedumpTool.Features
else
{
// Update redump.info client properties
_infoClient.Debug = DebugInput.Value;
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
_infoClient.AttemptCount = attemptCount.Value;
_client.AttemptCount = attemptCount.Value;
if (timeout != null && timeout > 0)
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
_infoClient.Overwrite = forceDownload;
_infoClient.IgnoreErrors = forceContinue;
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
_client.Overwrite = forceDownload;
_client.IgnoreErrors = forceContinue;
// Login to edump.info, if necessary
_infoClient.Login(username, password).Wait();
_client.Login(username, password).Wait();
// Start the processing
Task<List<int>> processingTask;
if (onlyList)
processingTask = _infoClient.ListDiscsResults(quicksearch: query, limit: limit);
processingTask = _client.ListDiscsResults(quicksearch: query, limit: limit);
else
processingTask = _infoClient.DownloadDiscsResults(outDir, quicksearch: query, limit: limit, discSubpaths: discSubpaths);
processingTask = _client.DownloadDiscsResults(outDir, quicksearch: query, limit: limit, discSubpaths: discSubpaths);
// Retrieve the result
processingTask.Wait();

View File

@@ -244,26 +244,26 @@ namespace RedumpTool.Features
else
{
// Update redump.info client properties
_infoClient.Debug = DebugInput.Value;
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
_infoClient.AttemptCount = attemptCount.Value;
_client.AttemptCount = attemptCount.Value;
if (timeout != null && timeout > 0)
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
_infoClient.Overwrite = forceDownload;
_infoClient.IgnoreErrors = forceContinue;
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
_client.Overwrite = forceDownload;
_client.IgnoreErrors = forceContinue;
// Login to redump.info, if necessary
_infoClient.Login(username, password).Wait();
_client.Login(username, password).Wait();
// Start the processing
Task<List<int>> processingTask;
if (minId >= 0 && maxId >= 0)
{
processingTask = _infoClient.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
processingTask = _client.DownloadSiteRange(outDir, minId, maxId, discSubpaths: discSubpaths);
}
else
{
processingTask = _infoClient.DownloadDiscsResults(outDir,
processingTask = _client.DownloadDiscsResults(outDir,
comments ? quicksearch : null,
dumper,
edition,

View File

@@ -136,25 +136,25 @@ namespace RedumpTool.Features
else
{
// Update redump.info client properties
_infoClient.Debug = DebugInput.Value;
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
_infoClient.AttemptCount = attemptCount.Value;
_client.AttemptCount = attemptCount.Value;
if (timeout != null && timeout > 0)
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
_infoClient.Overwrite = forceDownload;
_infoClient.IgnoreErrors = forceContinue;
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
_client.Overwrite = forceDownload;
_client.IgnoreErrors = forceContinue;
// Login to redump.info, if necessary
_infoClient.Login(username, password).Wait();
_client.Login(username, password).Wait();
// Start the processing
Task<List<int>> processingTask;
if (onlyList)
processingTask = _infoClient.ListDiscsResults(dumper: username, limit: limit);
processingTask = _client.ListDiscsResults(dumper: username, limit: limit);
else if (onlyNew)
processingTask = _infoClient.DownloadDiscsResults(outDir, dumper: username, sort: SortCategory.Modified, sortDir: SortDirection.Descending, limit: limit, discSubpaths: discSubpaths);
processingTask = _client.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);
processingTask = _client.DownloadDiscsResults(outDir, dumper: username, limit: limit, discSubpaths: discSubpaths);
// Retrieve the result
processingTask.Wait();

View File

@@ -115,23 +115,23 @@ namespace RedumpTool.Features
else
{
// Update redump.info properties
_infoClient.Debug = DebugInput.Value;
_client.Debug = DebugInput.Value;
if (attemptCount != null && attemptCount > 0)
_infoClient.AttemptCount = attemptCount.Value;
_client.AttemptCount = attemptCount.Value;
if (timeout != null && timeout > 0)
_infoClient.Timeout = TimeSpan.FromSeconds(timeout.Value);
_infoClient.Overwrite = forceDownload;
_infoClient.IgnoreErrors = forceContinue;
_client.Timeout = TimeSpan.FromSeconds(timeout.Value);
_client.Overwrite = forceDownload;
_client.IgnoreErrors = forceContinue;
// Login to redump.info, if necessary
_infoClient.Login(username, password).Wait();
_client.Login(username, password).Wait();
// Start the processing
Task<List<int>> processingTask;
if (onlyNew)
processingTask = _infoClient.DownloadLastSubmitted(outDir);
processingTask = _client.DownloadLastSubmitted(outDir);
else
processingTask = _infoClient.DownloadQueueRange(outDir, minId, maxId);
processingTask = _client.DownloadQueueRange(outDir, minId, maxId);
// Retrieve the result
processingTask.Wait();

View File

@@ -252,12 +252,12 @@ namespace SabreTools.RedumpLib
/// <summary>
/// Fill out an existing SubmissionInfo object based on a disc page
/// </summary>
/// <param name="client">RedumpClient for making the connection</param>
/// <param name="client">Client for making the connection</param>
/// <param name="info">Existing SubmissionInfo object to fill</param>
/// <param name="id">Redump disc ID to retrieve</param>
/// <param name="includeAllData">True to include all pullable information, false to do bare minimum</param>
/// TODO: Validate that this code is working
public static async Task<bool> FillFromId(RedumpInfo.Client client, SubmissionInfo info, int id, bool includeAllData)
public static async Task<bool> FillFromId(Web.Client client, SubmissionInfo info, int id, bool includeAllData)
{
var discData = await client.DownloadSingleDiscPage(id);
if (string.IsNullOrEmpty(discData))

View File

@@ -1,6 +1,7 @@
using System;
using System.Threading.Tasks;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;
namespace SabreTools.RedumpLib.RedumpInfo
{

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;
using SubmissionInfo = SabreTools.RedumpLib.RedumpOrg.SubmissionInfo;
namespace SabreTools.RedumpLib.RedumpInfo
@@ -16,7 +17,7 @@ namespace SabreTools.RedumpLib.RedumpInfo
/// <returns>List of found values, if possible</returns>
public static async Task<List<int>?> ValidateSingleTrack(Client client, SubmissionInfo info, string? sha1)
{
// Get all matching IDs for the track
// Get all matching IDs for the trackClient
var newIds = await client.ListDiscsResults(quicksearch: sha1);
// If we got null back, there was an error

View File

@@ -10,9 +10,9 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using SabreTools.RedumpLib.Data;
using SabreTools.RedumpLib.Web;
using SabreTools.RedumpLib.RedumpInfo;
namespace SabreTools.RedumpLib.RedumpInfo
namespace SabreTools.RedumpLib.Web
{
// TODO: Nearly every method here needs to be validated
#pragma warning disable SYSLIB1045 // Convert to 'GeneratedRegexAttribute'.