From debd89f97ae68458d85972ed6eaee348e17909e0 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Thu, 18 Jun 2026 11:47:58 -0400 Subject: [PATCH] Make redump.info the default, add flag for old site --- RedumpTool/Features/BaseFeature.cs | 16 ++- RedumpTool/Features/BuildUrlFeature.cs | 1 + RedumpTool/Features/PacksFeature.cs | 58 ++++++-- RedumpTool/Features/QueryFeature.cs | 93 +++++++++---- RedumpTool/Features/SiteFeature.cs | 169 +++++++++++++++-------- RedumpTool/Features/StatsFeature.cs | 20 ++- RedumpTool/Features/UserFeature.cs | 99 +++++++++---- RedumpTool/Features/WIPFeature.cs | 75 +++++++--- SabreTools.RedumpLib/RedumpInfo/Discs.cs | 2 +- 9 files changed, 379 insertions(+), 154 deletions(-) diff --git a/RedumpTool/Features/BaseFeature.cs b/RedumpTool/Features/BaseFeature.cs index f0c9df9..37e1f70 100644 --- a/RedumpTool/Features/BaseFeature.cs +++ b/RedumpTool/Features/BaseFeature.cs @@ -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 /// - /// Client to use for external connections + /// redump.info client to use for external connections /// - protected Client _client; + protected SabreTools.RedumpLib.RedumpInfo.Client _infoClient; + + /// + /// redump.org client to use for external connections + /// + 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 diff --git a/RedumpTool/Features/BuildUrlFeature.cs b/RedumpTool/Features/BuildUrlFeature.cs index b5dc614..c6ef049 100644 --- a/RedumpTool/Features/BuildUrlFeature.cs +++ b/RedumpTool/Features/BuildUrlFeature.cs @@ -53,6 +53,7 @@ namespace RedumpTool.Features Add(TimeoutInput); Add(ForceDownloadInput); Add(ForceContinueInput); + Add(OldSiteInput); // Disc path Add(DiscIdInput); diff --git a/RedumpTool/Features/PacksFeature.cs b/RedumpTool/Features/PacksFeature.cs index 42c65f7..7259a0b 100644 --- a/RedumpTool/Features/PacksFeature.cs +++ b/RedumpTool/Features/PacksFeature.cs @@ -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; + } } /// diff --git a/RedumpTool/Features/QueryFeature.cs b/RedumpTool/Features/QueryFeature.cs index 3b83f7e..1fc932a 100644 --- a/RedumpTool/Features/QueryFeature.cs +++ b/RedumpTool/Features/QueryFeature.cs @@ -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> processingTask; - if (onlyList) - processingTask = _client.ListDiscsResults(quicksearch: query, limit: limit); + // Start the processing + Task> 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> 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); + } } /// diff --git a/RedumpTool/Features/SiteFeature.cs b/RedumpTool/Features/SiteFeature.cs index cb3b456..ca56557 100644 --- a/RedumpTool/Features/SiteFeature.cs +++ b/RedumpTool/Features/SiteFeature.cs @@ -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> 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> 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> 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); } /// diff --git a/RedumpTool/Features/StatsFeature.cs b/RedumpTool/Features/StatsFeature.cs index a4b06d4..fb6d353 100644 --- a/RedumpTool/Features/StatsFeature.cs +++ b/RedumpTool/Features/StatsFeature.cs @@ -29,6 +29,7 @@ namespace RedumpTool.Features Add(TimeoutInput); Add(ForceDownloadInput); Add(ForceContinueInput); + Add(OldSiteInput); } /// @@ -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 processingTask = _client.DownloadStatisticsPage(outDir); + Task processingTask = _orgClient.DownloadStatisticsPage(outDir); // Retrieve the result processingTask.Wait(); diff --git a/RedumpTool/Features/UserFeature.cs b/RedumpTool/Features/UserFeature.cs index dce2ebf..f704ecc 100644 --- a/RedumpTool/Features/UserFeature.cs +++ b/RedumpTool/Features/UserFeature.cs @@ -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> 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> 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> 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); + } } /// diff --git a/RedumpTool/Features/WIPFeature.cs b/RedumpTool/Features/WIPFeature.cs index aa36ae0..4d5d6bb 100644 --- a/RedumpTool/Features/WIPFeature.cs +++ b/RedumpTool/Features/WIPFeature.cs @@ -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> processingTask; - if (onlyNew) - processingTask = _client.DownloadLastSubmitted(outDir); + // Start the processing + Task> 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> 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); + } } /// diff --git a/SabreTools.RedumpLib/RedumpInfo/Discs.cs b/SabreTools.RedumpLib/RedumpInfo/Discs.cs index daa5107..df9cb5a 100644 --- a/SabreTools.RedumpLib/RedumpInfo/Discs.cs +++ b/SabreTools.RedumpLib/RedumpInfo/Discs.cs @@ -31,7 +31,7 @@ namespace SabreTools.RedumpLib.RedumpInfo /// All disc IDs for the given query, empty on error public static async Task> DownloadDiscsResults(this Client client, string? outDir, - string? comments, + string? comments = null, string? dumper = null, string? edition = null, char? letter = null,