mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-11-15 17:01:37 +00:00
Add LSD support
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace SabreTools.RedumpLib.Data
|
||||
DiscSubpath.Edit,
|
||||
DiscSubpath.History,
|
||||
DiscSubpath.SBI,
|
||||
DiscSubpath.LSD,
|
||||
];
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -58,6 +58,9 @@ namespace SabreTools.RedumpLib.Data
|
||||
|
||||
[HumanReadable(LongName = "SBI", ShortName = "sbi")]
|
||||
SBI = 4,
|
||||
|
||||
[HumanReadable(LongName = "LSD", ShortName = "lsd")]
|
||||
LSD = 5,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user