From 50c8a33653194000414942a0347852fef6ab6951 Mon Sep 17 00:00:00 2001 From: emeric Date: Fri, 24 May 2024 22:21:00 +0200 Subject: [PATCH] Split file to fix compilation --- src/libs/metadata/impl/ITagReader.hpp | 20 +-- .../metadata/include/metadata/IParser.hpp | 103 +------------- src/libs/metadata/include/metadata/Types.hpp | 131 ++++++++++++++++++ 3 files changed, 144 insertions(+), 110 deletions(-) create mode 100644 src/libs/metadata/include/metadata/Types.hpp diff --git a/src/libs/metadata/impl/ITagReader.hpp b/src/libs/metadata/impl/ITagReader.hpp index ee80933a..da1a0d8b 100644 --- a/src/libs/metadata/impl/ITagReader.hpp +++ b/src/libs/metadata/impl/ITagReader.hpp @@ -22,6 +22,8 @@ #include #include +#include "metadata/Types.hpp" + namespace lms::metadata { // using picard internal names @@ -48,11 +50,11 @@ namespace lms::metadata Compilation, Composer, ComposerSortOrder, - Composers, // non standard + Composers, // non standard ComposersSortOrder, // non standard Conductor, - ConductorSortOrder, // non standard - Conductors, // non standard + ConductorSortOrder, // non standard + Conductors, // non standard ConductorsSortOrder, // non standard Copyright, CopyrightURL, // non standard @@ -71,15 +73,15 @@ namespace lms::metadata Language, License, Lyricist, - LyricistSortOrder, // non standard - Lyricists, // non standard + LyricistSortOrder, // non standard + Lyricists, // non standard LyricistsSortOrder, // non standard Lyrics, Media, MixDJ, Mixer, - MixerSortOrder, // non standard - Mixers, // non standard + MixerSortOrder, // non standard + Mixers, // non standard MixersSortOrder, // non standard Mood, Movement, @@ -105,8 +107,8 @@ namespace lms::metadata Podcast, PodcastURL, Producer, - ProducerSortOrder, // non standard - Producers, // non standard + ProducerSortOrder, // non standard + Producers, // non standard ProducersSortOrder, // non standard Rating, RecordLabel, diff --git a/src/libs/metadata/include/metadata/IParser.hpp b/src/libs/metadata/include/metadata/IParser.hpp index 821b99a9..47b6c908 100644 --- a/src/libs/metadata/include/metadata/IParser.hpp +++ b/src/libs/metadata/include/metadata/IParser.hpp @@ -19,113 +19,14 @@ #pragma once -#include #include -#include -#include +#include #include -#include -#include -#include -#include -#include "core/UUID.hpp" +#include "metadata/Types.hpp" namespace lms::metadata { - using Tags = std::map /* values */>; - - // Very simplified version of https://musicbrainz.org/doc/MusicBrainz_Database/Schema - - struct Artist - { - std::optional mbid; - std::string name; - std::optional sortName; - - Artist(std::string_view _name) : name{ _name } {} - Artist(std::optional _mbid, std::string_view _name, std::optional _sortName) : mbid{ std::move(_mbid) }, name{ _name }, sortName{ std::move(_sortName) } {} - - auto operator<=>(const Artist&) const = default; - }; - - using PerformerContainer = std::map>; - - struct Release - { - std::optional mbid; - std::optional groupMBID; - std::string name; - std::string sortName; - std::string artistDisplayName; - std::vector artists; - std::optional mediumCount; - std::vector releaseTypes; - - auto operator<=>(const Release&) const = default; - }; - - struct Medium - { - std::string media; // CD, etc. - std::string name; - std::optional release; - std::optional position; // in release - std::optional trackCount; - std::optional replayGain; - - auto operator<=>(const Medium&) const = default; - - bool isDefault() const - { - static Medium defaultMedium; - return *this == defaultMedium; - } - }; - - struct AudioProperties - { - std::size_t bitrate{}; - std::size_t bitsPerSample{}; - std::size_t channelCount{}; - std::chrono::milliseconds duration{}; - std::size_t sampleRate{}; - }; - - struct Track - { - AudioProperties audioProperties; - std::optional mbid; - std::optional recordingMBID; - std::string title; - std::optional medium; - std::optional position; // in medium - std::vector groupings; - std::vector genres; - std::vector moods; - std::vector labels; - std::vector languages; - Tags userExtraTags; - std::optional year{}; - Wt::WDate date; - std::optional originalYear{}; - Wt::WDate originalDate; - bool hasCover{}; - std::optional acoustID; - std::string copyright; - std::string copyrightURL; - std::optional replayGain; - std::string artistDisplayName; - std::vector artists; - std::vector conductorArtists; - std::vector composerArtists; - std::vector lyricistArtists; - std::vector mixerArtists; - PerformerContainer performerArtists; - std::vector producerArtists; - std::vector remixerArtists; - }; - class IParser { public: diff --git a/src/libs/metadata/include/metadata/Types.hpp b/src/libs/metadata/include/metadata/Types.hpp new file mode 100644 index 00000000..9f69fb19 --- /dev/null +++ b/src/libs/metadata/include/metadata/Types.hpp @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2024 Emeric Poupon + * + * This file is part of LMS. + * + * LMS is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * LMS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with LMS. If not, see . + */ + +#pragma once + +#include +#include +#include +#include +#include +#include + +#include + +#include "core/UUID.hpp" + +namespace lms::metadata +{ + using Tags = std::map /* values */>; + + // Very simplified version of https://musicbrainz.org/doc/MusicBrainz_Database/Schema + + struct Artist + { + std::optional mbid; + std::string name; + std::optional sortName; + + Artist(std::string_view _name) + : name{ _name } {} + Artist(std::optional _mbid, std::string_view _name, std::optional _sortName) + : mbid{ std::move(_mbid) } + , name{ _name } + , sortName{ std::move(_sortName) } {} + + auto operator<=>(const Artist&) const = default; + }; + + using PerformerContainer = std::map>; + + struct Release + { + std::optional mbid; + std::optional groupMBID; + std::string name; + std::string sortName; + std::string artistDisplayName; + std::vector artists; + std::optional mediumCount; + std::vector releaseTypes; + + auto operator<=>(const Release&) const = default; + }; + + struct Medium + { + std::string media; // CD, etc. + std::string name; + std::optional release; + std::optional position; // in release + std::optional trackCount; + std::optional replayGain; + + auto operator<=>(const Medium&) const = default; + + bool isDefault() const + { + static Medium defaultMedium; + return *this == defaultMedium; + } + }; + + struct AudioProperties + { + std::size_t bitrate{}; + std::size_t bitsPerSample{}; + std::size_t channelCount{}; + std::chrono::milliseconds duration{}; + std::size_t sampleRate{}; + }; + + struct Track + { + AudioProperties audioProperties; + std::optional mbid; + std::optional recordingMBID; + std::string title; + std::optional medium; + std::optional position; // in medium + std::vector groupings; + std::vector genres; + std::vector moods; + std::vector labels; + std::vector languages; + Tags userExtraTags; + std::optional year{}; + Wt::WDate date; + std::optional originalYear{}; + Wt::WDate originalDate; + bool hasCover{}; + std::optional acoustID; + std::string copyright; + std::string copyrightURL; + std::optional replayGain; + std::string artistDisplayName; + std::vector artists; + std::vector conductorArtists; + std::vector composerArtists; + std::vector lyricistArtists; + std::vector mixerArtists; + PerformerContainer performerArtists; + std::vector producerArtists; + std::vector remixerArtists; + }; +} // namespace lms::metadata \ No newline at end of file