mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Fix other media type method
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
/// </summary>
|
||||
/// <param name="mediaType">MediaType to get the proper name for</param>
|
||||
/// <param name="picIdentifier">PIC identifier string (BD only)</param>
|
||||
/// <param name="size">Size of the current media</param>
|
||||
/// <param name="layerbreak">First layerbreak value, as applicable</param>
|
||||
/// <param name="layerbreak2">Second layerbreak value, as applicable</param>
|
||||
/// <param name="layerbreak3">Third layerbreak value, as applicable</param>
|
||||
/// <returns>String representation of the media, including layer specification</returns>
|
||||
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";
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user