Add LSD support

This commit is contained in:
Matt Nadareski
2026-10-12 09:08:29 -04:00
parent 826643c063
commit 0d62e784a8
5 changed files with 23 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ namespace SabreTools.RedumpLib.Test.Endpoints
[InlineData(DiscSubpath.Cuesheet, "https://redump.info/disc/1/cue")]
[InlineData(DiscSubpath.Edit, "https://redump.info/disc/1/edit")]
[InlineData(DiscSubpath.SBI, "https://redump.info/disc/1/sbi")]
[InlineData(DiscSubpath.LSD, "https://redump.info/disc/1/lsd")]
public void BuildUrl_Subpath_Builds(DiscSubpath? subpath, string expected)
{
var endpoint = new RedumpLib.Endpoints.Disc

View File

@@ -147,6 +147,7 @@ namespace SabreTools.RedumpLib.Data
DiscSubpath.Edit,
DiscSubpath.History,
DiscSubpath.SBI,
DiscSubpath.LSD,
];
#endregion

View File

@@ -58,6 +58,9 @@ namespace SabreTools.RedumpLib.Data
[HumanReadable(LongName = "SBI", ShortName = "sbi")]
SBI = 4,
[HumanReadable(LongName = "LSD", ShortName = "lsd")]
LSD = 5,
}
/// <summary>

View File

@@ -31,6 +31,7 @@ namespace SabreTools.RedumpLib.Endpoints
case DiscSubpath.Cuesheet:
case DiscSubpath.Edit:
case DiscSubpath.SBI:
case DiscSubpath.LSD:
ub.Path += $"/{Subpath.ShortName()}";
break;

View File

@@ -1161,6 +1161,23 @@ namespace SabreTools.RedumpLib.Web
}
}
// LSD
if ((discSubpaths is null || Array.Exists(discSubpaths, s => s is DiscSubpath.LSD)) && discPage.Contains($"<a href=\"/disc/{id}/lsd\""))
{
var subEndpoint = new Endpoints.Disc
{
Id = id,
Subpath = DiscSubpath.LSD,
};
string uri = endpoint.BuildUrl();
string? remoteName = await DownloadFile(uri, Path.Combine(paddedIdDir, $"{paddedId}.lsd"));
if (!IgnoreErrors && remoteName is null)
{
if (Debug) Console.Error.WriteLine($"DEBUG: Downloading LSD for {id} failed!");
return false;
}
}
#endregion
// HTML (Last in case of errors)