mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-07-08 18:16:25 +00:00
Make info web client default
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using SabreTools.RedumpLib.Data;
|
||||
using SabreTools.RedumpLib.Web;
|
||||
|
||||
namespace SabreTools.RedumpLib.RedumpInfo
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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'.
|
||||
Reference in New Issue
Block a user