diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/ArtworkStatus.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/ArtworkStatus.cs deleted file mode 100644 index 4337752e..00000000 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/ArtworkStatus.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Lumina.Domain.SharedKernel.Common.Enums.BookLibrary; - -/// -/// Enumeration for the status of the artwork enrichment of a book artwork. -/// -public enum ArtworkStatus -{ - /// - /// The artwork of the book has not been resolved yet. - /// - Pending, - - /// - /// The artwork of the book has been successfully resolved. - /// - Enriched, - - /// - /// The artwork resolution of the book failed. - /// - Failed -} diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/MetadataStatus.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/MetadataStatus.cs deleted file mode 100644 index 0f3cf283..00000000 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/BookLibrary/MetadataStatus.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Lumina.Domain.SharedKernel.Common.Enums.BookLibrary; - -/// -/// Enumeration for the status of the metadata enrichment of a book. -/// -public enum MetadataStatus -{ - /// - /// The metadata of the book has not been enriched yet. - /// - Pending, - - /// - /// The metadata of the book has been successfully enriched. - /// - Enriched, - - /// - /// The metadata enrichment of the book failed. - /// - Failed -} diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/Common/ReleaseCountry.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/Common/ReleaseCountry.cs index b8bd644f..f9b1bbab 100644 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/Common/ReleaseCountry.cs +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/Common/ReleaseCountry.cs @@ -5,7 +5,7 @@ using System.Diagnostics; namespace Lumina.Domain.SharedKernel.Common.Enums.Common; /// -/// Enumeration for the country of a media release, using the ISO 3166-1 alpha-2 country codes. +/// Enumeration for the country of a media release, using the ISO 3166-1 alpha-2 country codes, together with the MusicBrainz special codes for releases issued across Europe or worldwide. /// [DebuggerDisplay("{ToString()}")] public enum ReleaseCountry @@ -988,5 +988,20 @@ public enum ReleaseCountry /// /// The ISO 3166-1 alpha-2 code of Zimbabwe. /// - ZW + ZW, + + /// + /// The ISO 3166-1 alpha-2 code of the Netherlands Antilles, withdrawn in 2010. + /// + AN, + + /// + /// The MusicBrainz code for a release issued across Europe. + /// + XE, + + /// + /// The MusicBrainz code for a release issued worldwide. + /// + XW } diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaContributors/MediaContributorRole.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaContributors/MediaContributorRole.cs index 00d63b55..316873c7 100644 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaContributors/MediaContributorRole.cs +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaContributors/MediaContributorRole.cs @@ -176,5 +176,10 @@ public enum MediaContributorRole /// /// The contributor orchestrated the music of the media item. /// - Orchestrator + Orchestrator, + + /// + /// The contributor performed the media item, without a more specific role being known. + /// + Performer } diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkStatus.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkStatus.cs new file mode 100644 index 00000000..53ad160e --- /dev/null +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkStatus.cs @@ -0,0 +1,32 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; + +/// +/// Enumeration for the status of the artwork enrichment of a media library item. +/// +[DebuggerDisplay("{ToString()}")] +public enum ArtworkStatus +{ + /// + /// The artwork of the media library item has not been resolved yet. + /// + Pending, + + /// + /// The artwork of the media library item has been successfully resolved. + /// + Enriched, + + /// + /// The artwork of the media library item was searched for, and no artwork exists for it. + /// + NotAvailable, + + /// + /// The artwork resolution of the media library item failed, because an error prevented the artwork from being retrieved. + /// + Failed +} diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkType.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkType.cs index eef84f22..acad1c48 100644 --- a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkType.cs +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/ArtworkType.cs @@ -16,5 +16,85 @@ public enum ArtworkType /// /// The main artwork of the media library item, like the cover of a book. /// - Cover + Cover, + + /// + /// The front of the artwork of the media library item, when it is stored separately from the cover. + /// + Front, + + /// + /// The back of the artwork of the media library item. + /// + Back, + + /// + /// A page of the booklet of the media library item. + /// + Booklet, + + /// + /// The artwork printed on the medium of the media library item, like a disc label. + /// + Medium, + + /// + /// The artwork printed on the tray of the media library item. + /// + Tray, + + /// + /// The artwork printed on the spine of the media library item. + /// + Spine, + + /// + /// The obi strip of the media library item. + /// + Obi, + + /// + /// The sticker of the media library item. + /// + Sticker, + + /// + /// The poster of the media library item. + /// + Poster, + + /// + /// The liner notes of the media library item. + /// + Liner, + + /// + /// A watermark carried by the artwork of the media library item. + /// + Watermark, + + /// + /// The backdrop, or fanart, of the media library item. + /// + Backdrop, + + /// + /// The banner of the media library item. + /// + Banner, + + /// + /// The logo of the media library item. + /// + Logo, + + /// + /// The thumbnail of the media library item. + /// + Thumb, + + /// + /// Any other artwork of the media library item. + /// + Other } diff --git a/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/MetadataStatus.cs b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/MetadataStatus.cs new file mode 100644 index 00000000..596f5e08 --- /dev/null +++ b/src/Lumina.Domain.SharedKernel/Common/Enums/MediaLibrary/MetadataStatus.cs @@ -0,0 +1,27 @@ +#region ========================================================================= USING ===================================================================================== +using System.Diagnostics; +#endregion + +namespace Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; + +/// +/// Enumeration for the status of the metadata enrichment of a media library item. +/// +[DebuggerDisplay("{ToString()}")] +public enum MetadataStatus +{ + /// + /// The metadata of the media library item has not been enriched yet. + /// + Pending, + + /// + /// The metadata of the media library item has been successfully enriched. + /// + Enriched, + + /// + /// The metadata enrichment of the media library item failed. + /// + Failed +} diff --git a/src/Lumina.Infrastructure/Common/Utilities/ImageTypeUtilities.cs b/src/Lumina.Infrastructure/Common/Utilities/ImageTypeUtilities.cs new file mode 100644 index 00000000..5916b6c4 --- /dev/null +++ b/src/Lumina.Infrastructure/Common/Utilities/ImageTypeUtilities.cs @@ -0,0 +1,37 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.PhotoLibrary; +#endregion + +namespace Lumina.Infrastructure.Common.Utilities; + +/// +/// Provides helpers for the enumeration. +/// +public static class ImageTypeUtilities +{ + /// + /// Gets the conventional file extension of the provided , without the leading dot. + /// + /// The image type whose file extension is resolved. + /// The file extension of the image type, or bin when the type is not a recognized image. + public static string ToFileExtension(this ImageType imageType) + { + return imageType switch + { + ImageType.BMP => "bmp", + ImageType.GIF => "gif", + ImageType.PNG => "png", + ImageType.TIFF => "tiff", + ImageType.JPEG or ImageType.JPEG_CANON or ImageType.JPEG_UNKNOWN => "jpg", + ImageType.PICT => "pct", + ImageType.ICO => "ico", + ImageType.PSD => "psd", + ImageType.JPEG2000 => "jp2", + ImageType.AVIF => "avif", + ImageType.WEBP => "webp", + ImageType.TGA => "tga", + ImageType.SVG => "svg", + _ => "bin" + }; + } +} diff --git a/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/ArtworkStatusTests.cs b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/ArtworkStatusTests.cs new file mode 100644 index 00000000..0592e1e8 --- /dev/null +++ b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/ArtworkStatusTests.cs @@ -0,0 +1,25 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +#endregion + +namespace Lumina.Domain.SharedKernel.UnitTests.Common.Enums.MediaLibrary; + +/// +/// Contains unit tests for the enumeration. +/// +[ExcludeFromCodeCoverage] +public class ArtworkStatusTests +{ + [Fact] + public void ArtworkStatus_WhenEnumeratingValues_ShouldHaveNoDuplicateValues() + { + // Act + ArtworkStatus[] values = Enum.GetValues(); + + // Assert + Assert.Equal(values.Length, values.Distinct().Count()); + } +} diff --git a/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/BookLibrary/MetadataStatusTests.cs b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/MetadataStatusTests.cs similarity index 83% rename from tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/BookLibrary/MetadataStatusTests.cs rename to tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/MetadataStatusTests.cs index 5c52d627..9b536e97 100644 --- a/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/BookLibrary/MetadataStatusTests.cs +++ b/tests/UnitTests/Lumina.Domain.SharedKernel.UnitTests/Common/Enums/MediaLibrary/MetadataStatusTests.cs @@ -1,11 +1,11 @@ #region ========================================================================= USING ===================================================================================== -using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary; +using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary; using System; using System.Diagnostics.CodeAnalysis; using System.Linq; #endregion -namespace Lumina.Domain.SharedKernel.UnitTests.Common.Enums.BookLibrary; +namespace Lumina.Domain.SharedKernel.UnitTests.Common.Enums.MediaLibrary; /// /// Contains unit tests for the enumeration. diff --git a/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs new file mode 100644 index 00000000..8ce853ee --- /dev/null +++ b/tests/UnitTests/Lumina.Infrastructure.UnitTests/Common/Utilities/ImageTypeUtilitiesTests.cs @@ -0,0 +1,59 @@ +#region ========================================================================= USING ===================================================================================== +using Lumina.Domain.SharedKernel.Common.Enums.PhotoLibrary; +using Lumina.Infrastructure.Common.Utilities; +using System.Diagnostics.CodeAnalysis; +#endregion + +namespace Lumina.Infrastructure.UnitTests.Common.Utilities; + +/// +/// Contains unit tests for the class. +/// +[ExcludeFromCodeCoverage] +public class ImageTypeUtilitiesTests +{ + [Theory] + [InlineData(ImageType.BMP, "bmp")] // bitmap image + [InlineData(ImageType.GIF, "gif")] // graphics interchange format + [InlineData(ImageType.PNG, "png")] // portable network graphics + [InlineData(ImageType.TIFF, "tiff")] // tagged image file format + [InlineData(ImageType.PICT, "pct")] // macintosh picture + [InlineData(ImageType.ICO, "ico")] // icon format + [InlineData(ImageType.PSD, "psd")] // photoshop document + [InlineData(ImageType.JPEG2000, "jp2")] // jpeg 2000 + [InlineData(ImageType.AVIF, "avif")] // av1 image file format + [InlineData(ImageType.WEBP, "webp")] // web picture format + [InlineData(ImageType.TGA, "tga")] // truevision tga + [InlineData(ImageType.SVG, "svg")] // scalable vector graphics + public void ToFileExtension_WhenTypeIsRecognized_ShouldReturnConventionalExtension(ImageType imageType, string expectedExtension) + { + // Act + string result = imageType.ToFileExtension(); + + // Assert + Assert.Equal(expectedExtension, result); + } + + [Theory] + [InlineData(ImageType.JPEG)] // joint photographic experts group + [InlineData(ImageType.JPEG_CANON)] // canon-specific jpeg + [InlineData(ImageType.JPEG_UNKNOWN)] // unknown jpeg + public void ToFileExtension_WhenTypeIsAnyJpeg_ShouldReturnJpg(ImageType imageType) + { + // Act + string result = imageType.ToFileExtension(); + + // Assert + Assert.Equal("jpg", result); + } + + [Fact] + public void ToFileExtension_WhenTypeIsNotARecognizedImage_ShouldReturnBin() + { + // Act + string result = ImageType.None.ToFileExtension(); + + // Assert + Assert.Equal("bin", result); + } +}