From 4c557b930f0b4fdfcea06bd22a84322d358cc982 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Sun, 7 Dec 2025 20:53:45 +0900 Subject: [PATCH] types/tag: make orderable --- src/common/types/tag.rs | 95 ++++++++++++++++++++++------------------- 1 file changed, 52 insertions(+), 43 deletions(-) diff --git a/src/common/types/tag.rs b/src/common/types/tag.rs index 2e5c48c..4125a5c 100644 --- a/src/common/types/tag.rs +++ b/src/common/types/tag.rs @@ -1,78 +1,87 @@ use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)] pub enum Tag { - /// The artist name. Its meaning is not well-defined; see “composer” and “performer” for more specific tags. - Artist(String), - /// Same as artist, but for sorting. This usually omits prefixes such as “The”. - ArtistSort(String), /// The album name. Album(String), /// Same as album, but for sorting. AlbumSort(String), + /// On multi-artist albums, this is the artist name which shall be used for the whole album. The exact meaning of this tag is not well-defined. AlbumArtist(String), /// Same as albumartist, but for sorting. AlbumArtistSort(String), - /// The song title. - Title(String), - /// Same as title, but for sorting. - TitleSort(String), - /// The decimal track number within the album. - Track(String), - /// A name for this song. This is not the song title. The exact meaning of this tag is not well-defined. It is often used by badly configured internet radio stations with broken tags to squeeze both the artist name and the song title in one tag. - Name(String), - /// The music genre. - Genre(String), - /// The mood of the audio with a few keywords. - Mood(String), - /// The song's release date. This is usually a 4-digit year. - Date(String), - /// The song's original release date. - OriginalDate(String), + + /// The artist name. Its meaning is not well-defined; see “composer” and “performer” for more specific tags. + Artist(String), + /// Same as artist, but for sorting. This usually omits prefixes such as “The”. + ArtistSort(String), + + /// A human-readable comment about this song. The exact meaning of this tag is not well-defined. + Comment(String), + /// The artist who composed the song. Composer(String), /// Same as composer, but for sorting. ComposerSort(String), - /// The artist who performed the song. - Performer(String), + /// The conductor who conducted the song. Conductor(String), - /// “a work is a distinct intellectual or artistic creation, which can be expressed in the form of one or more audio recordings” - Work(String), + /// The song's release date. This is usually a 4-digit year. + Date(String), + /// The decimal disc number in a multi-disc album. + Disc(String), /// The ensemble performing this song, e.g. “Wiener Philharmoniker”. Ensemble(String), + /// The music genre. + Genre(String), + /// “used if the sound belongs to a larger category of sounds/music” (from the IDv2.4.0 TIT1 description). + Grouping(String), + /// The name of the label or publisher. + Label(String), + /// Location of the recording, e.g. “Royal Albert Hall”. + Location(String), + /// The mood of the audio with a few keywords. + Mood(String), /// Name of the movement, e.g. “Andante con moto”. Movement(String), /// Movement number, e.g. “2” or “II”. MovementNumber(String), - /// If this tag is set to “1” players supporting this tag will display the work, movement, and movementnumber` instead of the track title. - ShowMovement(String), - /// Location of the recording, e.g. “Royal Albert Hall”. - Location(String), - /// “used if the sound belongs to a larger category of sounds/music” (from the IDv2.4.0 TIT1 description). - Grouping(String), - /// A human-readable comment about this song. The exact meaning of this tag is not well-defined. - Comment(String), - /// The decimal disc number in a multi-disc album. - Disc(String), - /// The name of the label or publisher. - Label(String), - /// The artist id in the MusicBrainz database. - MusicBrainzArtistId(String), - /// The album id in the MusicBrainz database. - MusicBrainzAlbumId(String), + /// The album artist id in the MusicBrainz database. MusicBrainzAlbumArtistId(String), - /// The track id in the MusicBrainz database. - MusicBrainzTrackId(String), + /// The album id in the MusicBrainz database. + MusicBrainzAlbumId(String), + /// The artist id in the MusicBrainz database. + MusicBrainzArtistId(String), /// The release group id in the MusicBrainz database. MusicBrainzReleaseGroupId(String), /// The release track id in the MusicBrainz database. MusicBrainzReleaseTrackId(String), + /// The track id in the MusicBrainz database. + MusicBrainzTrackId(String), /// The work id in the MusicBrainz database. MusicBrainzWorkId(String), + /// A name for this song. This is not the song title. The exact meaning of this tag is not well-defined. It is often used by badly configured internet radio stations with broken tags to squeeze both the artist name and the song title in one tag. + Name(String), + /// The song's original release date. + OriginalDate(String), + /// The artist who performed the song. + Performer(String), + /// If this tag is set to “1” players supporting this tag will display the work, movement, and movementnumber` instead of the track title. + ShowMovement(String), + + /// The song title. + Title(String), + /// Same as title, but for sorting. + TitleSort(String), + + /// The decimal track number within the album. + Track(String), + /// “a work is a distinct intellectual or artistic creation, which can be expressed in the form of one or more audio recordings” + Work(String), + /// Other tags not covered by the above Other(String, String), }