From dd5b5d4c7d74400cbd20c2a9af6830a908d69c2c Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 25 Jun 2024 16:32:41 -0400 Subject: [PATCH] Use speed for CLI from configuration --- CHANGELIST.md | 1 + MPF.CLI/Program.cs | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index bba492fc..28bf52c4 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -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) diff --git a/MPF.CLI/Program.cs b/MPF.CLI/Program.cs index 874a7355..fbccb29f 100644 --- a/MPF.CLI/Program.cs +++ b/MPF.CLI/Program.cs @@ -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 [custom-params]"); + Console.WriteLine("MPF.CLI [custom-params]"); Console.WriteLine(); Console.WriteLine("Standalone Options:"); Console.WriteLine("-h, -? Show this help text");