Split file to fix compilation

This commit is contained in:
emeric
2024-05-24 22:21:00 +02:00
parent 87222f9e9d
commit 50c8a33653
3 changed files with 144 additions and 110 deletions
+11 -9
View File
@@ -22,6 +22,8 @@
#include <chrono> #include <chrono>
#include <functional> #include <functional>
#include "metadata/Types.hpp"
namespace lms::metadata namespace lms::metadata
{ {
// using picard internal names // using picard internal names
@@ -48,11 +50,11 @@ namespace lms::metadata
Compilation, Compilation,
Composer, Composer,
ComposerSortOrder, ComposerSortOrder,
Composers, // non standard Composers, // non standard
ComposersSortOrder, // non standard ComposersSortOrder, // non standard
Conductor, Conductor,
ConductorSortOrder, // non standard ConductorSortOrder, // non standard
Conductors, // non standard Conductors, // non standard
ConductorsSortOrder, // non standard ConductorsSortOrder, // non standard
Copyright, Copyright,
CopyrightURL, // non standard CopyrightURL, // non standard
@@ -71,15 +73,15 @@ namespace lms::metadata
Language, Language,
License, License,
Lyricist, Lyricist,
LyricistSortOrder, // non standard LyricistSortOrder, // non standard
Lyricists, // non standard Lyricists, // non standard
LyricistsSortOrder, // non standard LyricistsSortOrder, // non standard
Lyrics, Lyrics,
Media, Media,
MixDJ, MixDJ,
Mixer, Mixer,
MixerSortOrder, // non standard MixerSortOrder, // non standard
Mixers, // non standard Mixers, // non standard
MixersSortOrder, // non standard MixersSortOrder, // non standard
Mood, Mood,
Movement, Movement,
@@ -105,8 +107,8 @@ namespace lms::metadata
Podcast, Podcast,
PodcastURL, PodcastURL,
Producer, Producer,
ProducerSortOrder, // non standard ProducerSortOrder, // non standard
Producers, // non standard Producers, // non standard
ProducersSortOrder, // non standard ProducersSortOrder, // non standard
Rating, Rating,
RecordLabel, RecordLabel,
+2 -101
View File
@@ -19,113 +19,14 @@
#pragma once #pragma once
#include <chrono>
#include <filesystem> #include <filesystem>
#include <map> #include <memory>
#include <optional>
#include <span> #include <span>
#include <string>
#include <string_view>
#include <vector>
#include <Wt/WDate.h> #include "metadata/Types.hpp"
#include "core/UUID.hpp"
namespace lms::metadata namespace lms::metadata
{ {
using Tags = std::map<std::string /* type */, std::vector<std::string> /* values */>;
// Very simplified version of https://musicbrainz.org/doc/MusicBrainz_Database/Schema
struct Artist
{
std::optional<core::UUID> mbid;
std::string name;
std::optional<std::string> sortName;
Artist(std::string_view _name) : name{ _name } {}
Artist(std::optional<core::UUID> _mbid, std::string_view _name, std::optional<std::string> _sortName) : mbid{ std::move(_mbid) }, name{ _name }, sortName{ std::move(_sortName) } {}
auto operator<=>(const Artist&) const = default;
};
using PerformerContainer = std::map<std::string /*role*/, std::vector<Artist>>;
struct Release
{
std::optional<core::UUID> mbid;
std::optional<core::UUID> groupMBID;
std::string name;
std::string sortName;
std::string artistDisplayName;
std::vector<Artist> artists;
std::optional<std::size_t> mediumCount;
std::vector<std::string> releaseTypes;
auto operator<=>(const Release&) const = default;
};
struct Medium
{
std::string media; // CD, etc.
std::string name;
std::optional<Release> release;
std::optional<std::size_t> position; // in release
std::optional<std::size_t> trackCount;
std::optional<float> 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<core::UUID> mbid;
std::optional<core::UUID> recordingMBID;
std::string title;
std::optional<Medium> medium;
std::optional<std::size_t> position; // in medium
std::vector<std::string> groupings;
std::vector<std::string> genres;
std::vector<std::string> moods;
std::vector<std::string> labels;
std::vector<std::string> languages;
Tags userExtraTags;
std::optional<int> year{};
Wt::WDate date;
std::optional<int> originalYear{};
Wt::WDate originalDate;
bool hasCover{};
std::optional<core::UUID> acoustID;
std::string copyright;
std::string copyrightURL;
std::optional<float> replayGain;
std::string artistDisplayName;
std::vector<Artist> artists;
std::vector<Artist> conductorArtists;
std::vector<Artist> composerArtists;
std::vector<Artist> lyricistArtists;
std::vector<Artist> mixerArtists;
PerformerContainer performerArtists;
std::vector<Artist> producerArtists;
std::vector<Artist> remixerArtists;
};
class IParser class IParser
{ {
public: public:
@@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <chrono>
#include <map>
#include <optional>
#include <string>
#include <string_view>
#include <vector>
#include <Wt/WDate.h>
#include "core/UUID.hpp"
namespace lms::metadata
{
using Tags = std::map<std::string /* type */, std::vector<std::string> /* values */>;
// Very simplified version of https://musicbrainz.org/doc/MusicBrainz_Database/Schema
struct Artist
{
std::optional<core::UUID> mbid;
std::string name;
std::optional<std::string> sortName;
Artist(std::string_view _name)
: name{ _name } {}
Artist(std::optional<core::UUID> _mbid, std::string_view _name, std::optional<std::string> _sortName)
: mbid{ std::move(_mbid) }
, name{ _name }
, sortName{ std::move(_sortName) } {}
auto operator<=>(const Artist&) const = default;
};
using PerformerContainer = std::map<std::string /*role*/, std::vector<Artist>>;
struct Release
{
std::optional<core::UUID> mbid;
std::optional<core::UUID> groupMBID;
std::string name;
std::string sortName;
std::string artistDisplayName;
std::vector<Artist> artists;
std::optional<std::size_t> mediumCount;
std::vector<std::string> releaseTypes;
auto operator<=>(const Release&) const = default;
};
struct Medium
{
std::string media; // CD, etc.
std::string name;
std::optional<Release> release;
std::optional<std::size_t> position; // in release
std::optional<std::size_t> trackCount;
std::optional<float> 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<core::UUID> mbid;
std::optional<core::UUID> recordingMBID;
std::string title;
std::optional<Medium> medium;
std::optional<std::size_t> position; // in medium
std::vector<std::string> groupings;
std::vector<std::string> genres;
std::vector<std::string> moods;
std::vector<std::string> labels;
std::vector<std::string> languages;
Tags userExtraTags;
std::optional<int> year{};
Wt::WDate date;
std::optional<int> originalYear{};
Wt::WDate originalDate;
bool hasCover{};
std::optional<core::UUID> acoustID;
std::string copyright;
std::string copyrightURL;
std::optional<float> replayGain;
std::string artistDisplayName;
std::vector<Artist> artists;
std::vector<Artist> conductorArtists;
std::vector<Artist> composerArtists;
std::vector<Artist> lyricistArtists;
std::vector<Artist> mixerArtists;
PerformerContainer performerArtists;
std::vector<Artist> producerArtists;
std::vector<Artist> remixerArtists;
};
} // namespace lms::metadata