Use speed for CLI from configuration

This commit is contained in:
Matt Nadareski
2024-06-25 16:32:41 -04:00
parent bc5e73d371
commit dd5b5d4c7d
2 changed files with 25 additions and 5 deletions

View File

@@ -27,6 +27,7 @@
- Add CLI status output on runtime
- Ensure tracks are assigned in Aaru
- Custom theme colors
- Use speed for CLI from configuration
### 3.2.0 (2024-06-20)

View File

@@ -101,10 +101,29 @@ namespace MPF.CLI
// Get the explicit output options
string path = args[2].Trim('"');
string speedStr = args[3].Trim('"');
if (!int.TryParse(speedStr, out int speed))
speed = 8; // Reasonable default for most media types
string filepath = args[4].Trim('"');
string filepath = args[3].Trim('"');
// Get the speed from the options
int speed = mediaType switch
{
// CD dump speed
MediaType.CDROM => options.PreferredDumpSpeedCD,
MediaType.GDROM => options.PreferredDumpSpeedCD,
// DVD dump speed
MediaType.DVD => options.PreferredDumpSpeedDVD,
MediaType.NintendoGameCubeGameDisc => options.PreferredDumpSpeedDVD,
MediaType.NintendoWiiOpticalDisc => options.PreferredDumpSpeedDVD,
// HD-DVD dump speed
MediaType.HDDVD => options.PreferredDumpSpeedHDDVD,
// BD dump speed
MediaType.BluRay => options.PreferredDumpSpeedBD,
// Default
_ => options.PreferredDumpSpeedCD,
};
// Now populate an environment
var drive = Drive.Create(null, path);
@@ -161,7 +180,7 @@ namespace MPF.CLI
Console.WriteLine(error);
Console.WriteLine("Usage:");
Console.WriteLine("MPF.CLI <mediatype> <system> <drivepath> <speed> </path/to/output.cue/iso> [custom-params]");
Console.WriteLine("MPF.CLI <mediatype> <system> <drivepath> </path/to/output.cue/iso> [custom-params]");
Console.WriteLine();
Console.WriteLine("Standalone Options:");
Console.WriteLine("-h, -? Show this help text");