Use dated default output filenames

This commit is contained in:
Matt Nadareski
2025-11-09 20:03:46 -05:00
parent 5637cf5201
commit 2665c29918
6 changed files with 27 additions and 19 deletions

View File

@@ -63,6 +63,7 @@
- Pre-compress all skeletons for multi-track CDs - Pre-compress all skeletons for multi-track CDs
- Add DVD-Video to list of copy protection scanning systems - Add DVD-Video to list of copy protection scanning systems
- Update Redumper to build 660 - Update Redumper to build 660
- Use dated default output filenames
### 3.5.0 (2025-10-10) ### 3.5.0 (2025-10-10)

View File

@@ -146,9 +146,9 @@ namespace MPF.CLI.Features
} }
// Ensure we have the values we need // Ensure we have the values we need
if (CustomParams == null && (DevicePath == null || FilePath == null)) if (CustomParams == null && DevicePath == null)
{ {
Console.Error.WriteLine("Both a device path and file path need to be supplied, exiting..."); Console.Error.WriteLine("Either custom parameters or a device path need to be provided, exiting...");
return false; return false;
} }
if (Options.InternalProgram == InternalProgram.DiscImageCreator if (Options.InternalProgram == InternalProgram.DiscImageCreator
@@ -160,6 +160,12 @@ namespace MPF.CLI.Features
} }
// Normalize the file path // Normalize the file path
if (DevicePath != null && FilePath == null)
{
FilePath = $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin";
if (Options.DefaultOutputPath != null)
FilePath = Path.Combine(Options.DefaultOutputPath, FilePath);
}
if (FilePath != null) if (FilePath != null)
FilePath = FrontendTool.NormalizeOutputPaths(FilePath, getFullPath: true); FilePath = FrontendTool.NormalizeOutputPaths(FilePath, getFullPath: true);
@@ -247,7 +253,7 @@ namespace MPF.CLI.Features
Console.WriteLine("-t, --mediatype <mediatype> Set media type for dumping (Required for DIC)"); Console.WriteLine("-t, --mediatype <mediatype> Set media type for dumping (Required for DIC)");
Console.WriteLine("-d, --device <devicepath> Physical drive path (Required if no custom parameters set)"); Console.WriteLine("-d, --device <devicepath> Physical drive path (Required if no custom parameters set)");
Console.WriteLine("-m, --mounted <dirpath> Mounted filesystem path for additional checks"); Console.WriteLine("-m, --mounted <dirpath> Mounted filesystem path for additional checks");
Console.WriteLine("-f, --file \"<filepath>\" Output file path (Required if no custom parameters set)"); Console.WriteLine("-f, --file \"<filepath>\" Output file path (Recommended, uses defaults otherwise)");
Console.WriteLine("-s, --speed <speed> Override default dumping speed"); Console.WriteLine("-s, --speed <speed> Override default dumping speed");
Console.WriteLine("-c, --custom \"<params>\" Custom parameters to use"); Console.WriteLine("-c, --custom \"<params>\" Custom parameters to use");
Console.WriteLine(); Console.WriteLine();
@@ -259,7 +265,7 @@ namespace MPF.CLI.Features
Console.WriteLine("Custom dumping parameters, if used, will fully replace the default parameters."); Console.WriteLine("Custom dumping parameters, if used, will fully replace the default parameters.");
Console.WriteLine("All dumping parameters need to be supplied if doing this."); Console.WriteLine("All dumping parameters need to be supplied if doing this.");
Console.WriteLine("Otherwise, both a drive path and output file path are required."); Console.WriteLine("Otherwise, a drive path is required.");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("Mounted filesystem path is only recommended on OSes that require block"); Console.WriteLine("Mounted filesystem path is only recommended on OSes that require block");

View File

@@ -38,7 +38,7 @@ namespace MPF.CLI.Features
// Create return values // Create return values
MediaType = SabreTools.RedumpLib.Data.MediaType.NONE; MediaType = SabreTools.RedumpLib.Data.MediaType.NONE;
FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", "track.bin"); FilePath = Path.Combine(Options.DefaultOutputPath ?? "ISO", $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
System = Options.DefaultSystem; System = Options.DefaultSystem;
// Create state values // Create state values

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
@@ -502,7 +503,7 @@ namespace MPF.ExecutionContexts.Redumper
// If the image name was not set, set it with a default value // If the image name was not set, set it with a default value
if (string.IsNullOrEmpty((_inputs[FlagStrings.ImageName] as StringInput)?.Value)) if (string.IsNullOrEmpty((_inputs[FlagStrings.ImageName] as StringInput)?.Value))
(_inputs[FlagStrings.ImageName] as StringInput)?.SetValue("track"); (_inputs[FlagStrings.ImageName] as StringInput)?.SetValue($"track_{DateTime.Now:yyyyMMdd-HHmm}");
return true; return true;
} }

View File

@@ -1392,9 +1392,9 @@ namespace MPF.Frontend.ViewModels
string programShort = program == "DiscImageCreator" ? "DIC" : program; string programShort = program == "DiscImageCreator" ? "DIC" : program;
if (string.IsNullOrEmpty(programShort)) if (string.IsNullOrEmpty(programShort))
programShort = "Unknown Program"; programShort = "Unknown Program";
string label = GetFormattedVolumeLabel(_currentDrive) ?? "track"; string label = GetFormattedVolumeLabel(_currentDrive) ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
if (string.IsNullOrEmpty(label)) if (string.IsNullOrEmpty(label))
label = "track"; label = $"track_{DateTime.Now:yyyyMMdd-HHmm}";
string date = DateTime.Today.ToString("yyyyMMdd"); string date = DateTime.Today.ToString("yyyyMMdd");
if (string.IsNullOrEmpty(date)) if (string.IsNullOrEmpty(date))
date = "UNKNOWN"; date = "UNKNOWN";
@@ -1429,7 +1429,7 @@ namespace MPF.Frontend.ViewModels
// Get path pieces that are used in all branches // Get path pieces that are used in all branches
string defaultOutputPath = Options.DefaultOutputPath ?? "ISO"; string defaultOutputPath = Options.DefaultOutputPath ?? "ISO";
string extension = _environment?.GetDefaultExtension(CurrentMediaType) ?? ".bin"; string extension = _environment?.GetDefaultExtension(CurrentMediaType) ?? ".bin";
string label = GetFormattedVolumeLabel(CurrentDrive) ?? CurrentSystem.LongName() ?? "track"; string label = GetFormattedVolumeLabel(CurrentDrive) ?? CurrentSystem.LongName() ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
string defaultFilename = $"{label}{extension}"; string defaultFilename = $"{label}{extension}";
// If no path exists, set one using default values // If no path exists, set one using default values
@@ -1997,7 +1997,7 @@ namespace MPF.Frontend.ViewModels
/// <summary> /// <summary>
/// Media label as read by Windows, formatted to avoid odd outputs /// Media label as read by Windows, formatted to avoid odd outputs
/// If no volume label present, use PSX or PS2 serial if valid /// If no volume label present, use PSX or PS2 serial if valid
/// Otherwise, use "track" as volume label /// Otherwise, use "track" with current datetime as volume label
/// </summary> /// </summary>
private static string? GetFormattedVolumeLabel(Drive? drive) private static string? GetFormattedVolumeLabel(Drive? drive)
{ {
@@ -2016,7 +2016,7 @@ namespace MPF.Frontend.ViewModels
case RedumpSystem.SonyPlayStation: case RedumpSystem.SonyPlayStation:
case RedumpSystem.SonyPlayStation2: case RedumpSystem.SonyPlayStation2:
string? ps12Serial = PhysicalTool.GetPlayStationSerial(drive); string? ps12Serial = PhysicalTool.GetPlayStationSerial(drive);
volumeLabel ??= ps12Serial ?? "track"; volumeLabel ??= ps12Serial ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
break; break;
case RedumpSystem.SonyPlayStation3: case RedumpSystem.SonyPlayStation3:
@@ -2024,7 +2024,7 @@ namespace MPF.Frontend.ViewModels
if (volumeLabel == "PS3VOLUME") if (volumeLabel == "PS3VOLUME")
volumeLabel = ps3Serial ?? volumeLabel; volumeLabel = ps3Serial ?? volumeLabel;
else else
volumeLabel ??= ps3Serial ?? "track"; volumeLabel ??= ps3Serial ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
break; break;
case RedumpSystem.SonyPlayStation4: case RedumpSystem.SonyPlayStation4:
@@ -2032,7 +2032,7 @@ namespace MPF.Frontend.ViewModels
if (volumeLabel == "PS4VOLUME") if (volumeLabel == "PS4VOLUME")
volumeLabel = ps4Serial ?? volumeLabel; volumeLabel = ps4Serial ?? volumeLabel;
else else
volumeLabel ??= ps4Serial ?? "track"; volumeLabel ??= ps4Serial ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
break; break;
case RedumpSystem.SonyPlayStation5: case RedumpSystem.SonyPlayStation5:
@@ -2040,11 +2040,11 @@ namespace MPF.Frontend.ViewModels
if (volumeLabel == "PS5VOLUME") if (volumeLabel == "PS5VOLUME")
volumeLabel = ps5Serial ?? volumeLabel; volumeLabel = ps5Serial ?? volumeLabel;
else else
volumeLabel ??= ps5Serial ?? "track"; volumeLabel ??= ps5Serial ?? $"track_{DateTime.Now:yyyyMMdd-HHmm}";
break; break;
default: default:
volumeLabel ??= "track"; volumeLabel ??= $"track_{DateTime.Now:yyyyMMdd-HHmm}";
break; break;
} }

View File

@@ -312,11 +312,11 @@ namespace MPF.UI.Windows
// Get the current path, if possible // Get the current path, if possible
string currentPath = MainViewModel.OutputPath; string currentPath = MainViewModel.OutputPath;
if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(MainViewModel.Options.DefaultOutputPath)) if (string.IsNullOrEmpty(currentPath) && !string.IsNullOrEmpty(MainViewModel.Options.DefaultOutputPath))
currentPath = Path.Combine(MainViewModel.Options.DefaultOutputPath, "track.bin"); currentPath = Path.Combine(MainViewModel.Options.DefaultOutputPath, $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
else if (string.IsNullOrEmpty(currentPath)) else if (string.IsNullOrEmpty(currentPath))
currentPath = "track.bin"; currentPath = $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin";
if (string.IsNullOrEmpty(currentPath)) if (string.IsNullOrEmpty(currentPath))
currentPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory!, "track.bin"); currentPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory!, $"track_{DateTime.Now:yyyyMMdd-HHmm}.bin");
// Get the full path // Get the full path
currentPath = Path.GetFullPath(currentPath); currentPath = Path.GetFullPath(currentPath);
@@ -588,7 +588,7 @@ namespace MPF.UI.Windows
} }
/// <summary> /// <summary>
/// Build the about text /// Build the about text
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public string CreateAboutText() public string CreateAboutText()