diff --git a/CHANGELIST.md b/CHANGELIST.md index f0ab2dbc..f5f62d0b 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -5,6 +5,7 @@ - Fix commented out code - Make missing hash data clearer - Get BD PIC Identifier for redumper (Deterous) +- Support redumper skeleton and hash files (Deterous) ### 3.0.3 (2023-12-04) diff --git a/MPF.Core/MPF.Core.csproj b/MPF.Core/MPF.Core.csproj index e6e34904..fbfbeea9 100644 --- a/MPF.Core/MPF.Core.csproj +++ b/MPF.Core/MPF.Core.csproj @@ -57,7 +57,7 @@ - + diff --git a/MPF.Core/Modules/Redumper/Parameters.cs b/MPF.Core/Modules/Redumper/Parameters.cs index 6ff97d2a..90261083 100644 --- a/MPF.Core/Modules/Redumper/Parameters.cs +++ b/MPF.Core/Modules/Redumper/Parameters.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using MPF.Core.Converters; using MPF.Core.Data; +using SabreTools.Models.CueSheets; using SabreTools.RedumpLib; using SabreTools.RedumpLib.Data; @@ -206,8 +207,12 @@ namespace MPF.Core.Modules.Redumper // missingFiles.Add($"{basePath}.cdtext"); // // // Not available in all versions + // if (!File.Exists($"{basePath}.hash")) + // missingFiles.Add($"{basePath}.hash"); + // // Also: "{basePath} (Track X).hash" (get from cuesheet) // if (!File.Exists($"{basePath}.skeleton")) // missingFiles.Add($"{basePath}.skeleton"); + // // Also: "{basePath} (Track X).skeleton" (get from cuesheet) //} break; @@ -230,6 +235,8 @@ namespace MPF.Core.Modules.Redumper // Removed or inconsistent files //{ // // Not available in all versions + // if (!File.Exists($"{basePath}.hash")) + // missingFiles.Add($"{basePath}.hash"); // if (!File.Exists($"{basePath}.skeleton")) // missingFiles.Add($"{basePath}.skeleton"); //} @@ -253,6 +260,8 @@ namespace MPF.Core.Modules.Redumper // Removed or inconsistent files //{ // // Not available in all versions + // if (!File.Exists($"{basePath}.hash")) + // missingFiles.Add($"{basePath}.hash"); // if (!File.Exists($"{basePath}.skeleton")) // missingFiles.Add($"{basePath}.skeleton"); //} @@ -510,6 +519,9 @@ namespace MPF.Core.Modules.Redumper info.Artifacts["cue"] = GetBase64(GetFullFile($"{basePath}.cue")) ?? string.Empty; if (File.Exists($"{basePath}.fulltoc")) info.Artifacts["fulltoc"] = GetBase64(GetFullFile($"{basePath}.fulltoc")) ?? string.Empty; + if (File.Exists($"{basePath}.hash")) + info.Artifacts["hash"] = GetBase64(GetFullFile($"{basePath}.hash")) ?? string.Empty; + // TODO: "{basePath} (Track X).hash" (get from cuesheet) if (File.Exists($"{basePath}.log")) info.Artifacts["log"] = GetBase64(GetFullFile($"{basePath}.log")) ?? string.Empty; if (File.Exists($"{basePath}.manufacturer")) @@ -526,6 +538,7 @@ namespace MPF.Core.Modules.Redumper info.Artifacts["physical2"] = GetBase64(GetFullFile($"{basePath}.2.physical")) ?? string.Empty; // if (File.Exists($"{basePath}.skeleton")) // info.Artifacts["skeleton"] = GetBase64(GetFullFile($"{basePath}.skeleton")) ?? string.Empty; + // // Also: "{basePath} (Track X).skeleton" (get from cuesheet) // if (File.Exists($"{basePath}.scram")) // info.Artifacts["scram"] = GetBase64(GetFullFile($"{basePath}.scram")) ?? string.Empty; // if (File.Exists($"{basePath}.scrap")) @@ -857,17 +870,44 @@ namespace MPF.Core.Modules.Redumper logFiles.Add($"{basePath}.fulltoc"); if (File.Exists($"{basePath}.log")) logFiles.Add($"{basePath}.log"); - if (File.Exists($"{basePath}.skeleton")) - logFiles.Add($"{basePath}.skeleton"); if (File.Exists($"{basePath}.state")) logFiles.Add($"{basePath}.state"); if (File.Exists($"{basePath}.subcode")) logFiles.Add($"{basePath}.subcode"); if (File.Exists($"{basePath}.toc")) logFiles.Add($"{basePath}.toc"); + + // Include .hash and .skeleton for all files in cuesheet + var cueSheet = new SabreTools.Serialization.Files.CueSheet().Deserialize($"{basePath}.cue"); + string? baseDir = Path.GetDirectoryName(basePath); + if (cueSheet?.Files != null && baseDir != null) + { + foreach (CueFile? file in cueSheet.Files) + { + string? trackName = Path.GetFileNameWithoutExtension(file?.FileName); + if (trackName == null) + continue; + + string trackPath = Path.Combine(baseDir, trackName); + if (File.Exists($"{trackPath}.hash")) + logFiles.Add($"{trackPath}.hash"); + if (File.Exists($"{trackPath}.skeleton")) + logFiles.Add($"{trackPath}.skeleton"); + } + } + else + { + if (File.Exists($"{basePath}.hash")) + logFiles.Add($"{basePath}.hash"); + if (File.Exists($"{basePath}.skeleton")) + logFiles.Add($"{basePath}.skeleton"); + } + break; case MediaType.DVD: + if (File.Exists($"{basePath}.hash")) + logFiles.Add($"{basePath}.hash"); if (File.Exists($"{basePath}.log")) logFiles.Add($"{basePath}.log"); if (File.Exists($"{basePath}.manufacturer")) @@ -890,6 +930,8 @@ namespace MPF.Core.Modules.Redumper case MediaType.HDDVD: // TODO: Confirm that this information outputs case MediaType.BluRay: + if (File.Exists($"{basePath}.hash")) + logFiles.Add($"{basePath}.hash"); if (File.Exists($"{basePath}.log")) logFiles.Add($"{basePath}.log"); if (File.Exists($"{basePath}.physical"))