From 1ecf0ad1fafccd87ccb71ac5ffa457f2b8299b9f Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 26 Apr 2023 16:00:20 -0400 Subject: [PATCH] Fix other media type method --- CHANGELIST.md | 1 + MPF.Library/InfoTool.cs | 17 ++++++++++++----- MPF.Test/Library/InfoToolTests.cs | 7 ++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index 6fad2189..2986eb64 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -48,6 +48,7 @@ - Truncate PIC data for PS4/PS5 - Add internal theme support with class - Add PIC identifier to SubmissionInfo +- Fix other media type method ### 2.5 (2023-03-12) diff --git a/MPF.Library/InfoTool.cs b/MPF.Library/InfoTool.cs index feeb28fc..f1cc69cc 100644 --- a/MPF.Library/InfoTool.cs +++ b/MPF.Library/InfoTool.cs @@ -657,6 +657,7 @@ namespace MPF.Library AddIfExists(output, Template.SystemField, info.CommonDiscInfo.System.LongName(), 1); AddIfExists(output, Template.MediaTypeField, GetFixedMediaType( info.CommonDiscInfo.Media.ToMediaType(), + info.SizeAndChecksums.PICIdentifier, info.SizeAndChecksums.Size, info.SizeAndChecksums.Layerbreak, info.SizeAndChecksums.Layerbreak2, @@ -873,12 +874,14 @@ namespace MPF.Library /// Get the adjusted name of the media based on layers, if applicable /// /// MediaType to get the proper name for + /// PIC identifier string (BD only) /// Size of the current media /// First layerbreak value, as applicable /// Second layerbreak value, as applicable /// Third layerbreak value, as applicable /// String representation of the media, including layer specification - public static string GetFixedMediaType(MediaType? mediaType, long size, long layerbreak, long layerbreak2, long layerbreak3) + /// TODO: Figure out why we have this and NormalizeDiscType as well + public static string GetFixedMediaType(MediaType? mediaType, string picIdentifier, long size, long layerbreak, long layerbreak2, long layerbreak3) { switch (mediaType) { @@ -893,12 +896,16 @@ namespace MPF.Library return $"{mediaType.LongName()}-128"; else if (layerbreak2 != default) return $"{mediaType.LongName()}-100"; - //else if (layerbreak != default && size > 53_687_063_712) - // return $"{mediaType.LongName()}-66"; + else if (layerbreak != default && picIdentifier == PICDiscInformationUnit.DiscTypeIdentifierROMUltra) + return $"{mediaType.LongName()}-66"; + else if (layerbreak != default && size > 53_687_063_712) + return $"{mediaType.LongName()}-66"; else if (layerbreak != default) return $"{mediaType.LongName()}-50"; - //else if (size > 26_843_531_856) - // return $"{mediaType.LongName()}-33"; + else if (picIdentifier == PICDiscInformationUnit.DiscTypeIdentifierROMUltra) + return $"{mediaType.LongName()}-33"; + else if (size > 26_843_531_856) + return $"{mediaType.LongName()}-33"; else return $"{mediaType.LongName()}-25"; diff --git a/MPF.Test/Library/InfoToolTests.cs b/MPF.Test/Library/InfoToolTests.cs index 28775bf1..ce88dfe4 100644 --- a/MPF.Test/Library/InfoToolTests.cs +++ b/MPF.Test/Library/InfoToolTests.cs @@ -26,9 +26,9 @@ namespace MPF.Test.Library [InlineData(MediaType.DVD, 12345, 1, 2, 3, "DVD-ROM-9")] [InlineData(MediaType.BluRay, 0, 0, 0, 0, "BD-ROM-25")] [InlineData(MediaType.BluRay, 12345, 0, 0, 0, "BD-ROM-25")] - //[InlineData(MediaType.BluRay, 26_843_531_857, 0, 0, 0, "BD-ROM-33")] + [InlineData(MediaType.BluRay, 26_843_531_857, 0, 0, 0, "BD-ROM-33")] [InlineData(MediaType.BluRay, 12345, 1, 0, 0, "BD-ROM-50")] - //[InlineData(MediaType.BluRay, 53_687_063_713, 1, 0, 0, "BD-ROM-66")] + [InlineData(MediaType.BluRay, 53_687_063_713, 1, 0, 0, "BD-ROM-66")] [InlineData(MediaType.BluRay, 12345, 1, 2, 0, "BD-ROM-100")] [InlineData(MediaType.BluRay, 12345, 1, 2, 3, "BD-ROM-128")] [InlineData(MediaType.UMD, 0, 0, 0, 0, "UMD-SL")] @@ -44,7 +44,8 @@ namespace MPF.Test.Library long layerbreak3, string expected) { - string actual = InfoTool.GetFixedMediaType(mediaType, size, layerbreak, layerbreak2, layerbreak3); + // TODO: Add tests around BDU + string actual = InfoTool.GetFixedMediaType(mediaType, null, size, layerbreak, layerbreak2, layerbreak3); Assert.Equal(expected, actual); }