diff --git a/src/core/song.cpp b/src/core/song.cpp index d1ce021cf..e21a3a561 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -68,9 +68,13 @@ using namespace Qt::Literals::StringLiterals; const QStringList Song::kColumns = QStringList() << u"title"_s + << u"titlesort"_s << u"album"_s + << u"albumsort"_s << u"artist"_s + << u"artistsort"_s << u"albumartist"_s + << u"albumartistsort"_s << u"track"_s << u"disc"_s << u"year"_s @@ -78,7 +82,9 @@ const QStringList Song::kColumns = QStringList() << u"title"_s << u"genre"_s << u"compilation"_s << u"composer"_s + << u"composersort"_s << u"performer"_s + << u"performersort"_s << u"grouping"_s << u"comment"_s << u"lyrics"_s @@ -261,9 +267,13 @@ struct Song::Private : public QSharedData { bool valid_; QString title_; + QString titlesort_; QString album_; + QString albumsort_; QString artist_; + QString artistsort_; QString albumartist_; + QString albumartistsort_; int track_; int disc_; int year_; @@ -271,7 +281,9 @@ struct Song::Private : public QSharedData { QString genre_; bool compilation_; // From the file tag QString composer_; + QString composersort_; QString performer_; + QString performersort_; QString grouping_; QString comment_; QString lyrics_; @@ -411,9 +423,13 @@ int Song::id() const { return d->id_; } bool Song::is_valid() const { return d->valid_; } const QString &Song::title() const { return d->title_; } +const QString &Song::titlesort() const { return d->titlesort_; } const QString &Song::album() const { return d->album_; } +const QString &Song::albumsort() const { return d->albumsort_; } const QString &Song::artist() const { return d->artist_; } +const QString &Song::artistsort() const { return d->artistsort_; } const QString &Song::albumartist() const { return d->albumartist_; } +const QString &Song::albumartistsort() const { return d->albumartistsort_; } int Song::track() const { return d->track_; } int Song::disc() const { return d->disc_; } int Song::year() const { return d->year_; } @@ -421,7 +437,9 @@ int Song::originalyear() const { return d->originalyear_; } const QString &Song::genre() const { return d->genre_; } bool Song::compilation() const { return d->compilation_; } const QString &Song::composer() const { return d->composer_; } +const QString &Song::composersort() const { return d->composersort_; } const QString &Song::performer() const { return d->performer_; } +const QString &Song::performersort() const { return d->performersort_; } const QString &Song::grouping() const { return d->grouping_; } const QString &Song::comment() const { return d->comment_; } const QString &Song::lyrics() const { return d->lyrics_; } @@ -522,9 +540,13 @@ void Song::set_id(const int id) { d->id_ = id; } void Song::set_valid(const bool v) { d->valid_ = v; } void Song::set_title(const QString &v) { d->title_sortable_ = sortable(v); d->title_ = v; } +void Song::set_titlesort(const QString &v) { d->titlesort_ = v; } void Song::set_album(const QString &v) { d->album_sortable_ = sortable(v); d->album_ = v; } +void Song::set_albumsort(const QString &v) { d->albumsort_ = v; } void Song::set_artist(const QString &v) { d->artist_sortable_ = sortable(v); d->artist_ = v; } +void Song::set_artistsort(const QString &v) { d->artistsort_ = v; } void Song::set_albumartist(const QString &v) { d->albumartist_sortable_ = sortable(v); d->albumartist_ = v; } +void Song::set_albumartistsort(const QString &v) { d->albumartistsort_ = v; } void Song::set_track(const int v) { d->track_ = v; } void Song::set_disc(const int v) { d->disc_ = v; } void Song::set_year(const int v) { d->year_ = v; } @@ -532,7 +554,9 @@ void Song::set_originalyear(const int v) { d->originalyear_ = v; } void Song::set_genre(const QString &v) { d->genre_ = v; } void Song::set_compilation(const bool v) { d->compilation_ = v; } void Song::set_composer(const QString &v) { d->composer_ = v; } +void Song::set_composersort(const QString &v) { d->composersort_ = v; } void Song::set_performer(const QString &v) { d->performer_ = v; } +void Song::set_performersort(const QString &v) { d->performersort_ = v; } void Song::set_grouping(const QString &v) { d->grouping_ = v; } void Song::set_comment(const QString &v) { d->comment_ = v; } void Song::set_lyrics(const QString &v) { d->lyrics_ = v; } @@ -608,6 +632,8 @@ void Song::set_title(const TagLib::String &v) { } +void Song::set_titlesort(const TagLib::String &v) { d->titlesort_ = TagLibStringToQString(v); } + void Song::set_album(const TagLib::String &v) { const QString album = TagLibStringToQString(v); @@ -615,6 +641,9 @@ void Song::set_album(const TagLib::String &v) { d->album_ = album; } + +void Song::set_albumsort(const TagLib::String &v) { d->albumsort_ = TagLibStringToQString(v); } + void Song::set_artist(const TagLib::String &v) { const QString artist = TagLibStringToQString(v); @@ -623,6 +652,8 @@ void Song::set_artist(const TagLib::String &v) { } +void Song::set_artistsort(const TagLib::String &v) { d->artistsort_ = TagLibStringToQString(v); } + void Song::set_albumartist(const TagLib::String &v) { const QString albumartist = TagLibStringToQString(v); @@ -631,9 +662,12 @@ void Song::set_albumartist(const TagLib::String &v) { } +void Song::set_albumartistsort(const TagLib::String &v) { d->albumartistsort_ = TagLibStringToQString(v); } void Song::set_genre(const TagLib::String &v) { d->genre_ = TagLibStringToQString(v); } void Song::set_composer(const TagLib::String &v) { d->composer_ = TagLibStringToQString(v); } +void Song::set_composersort(const TagLib::String &v) { d->composersort_ = TagLibStringToQString(v); } void Song::set_performer(const TagLib::String &v) { d->performer_ = TagLibStringToQString(v); } +void Song::set_performersort(const TagLib::String &v) { d->performersort_ = TagLibStringToQString(v); } void Song::set_grouping(const TagLib::String &v) { d->grouping_ = TagLibStringToQString(v); } void Song::set_comment(const TagLib::String &v) { d->comment_ = TagLibStringToQString(v); } void Song::set_lyrics(const TagLib::String &v) { d->lyrics_ = TagLibStringToQString(v); } @@ -1498,9 +1532,13 @@ void Song::InitFromQuery(const QSqlRecord &r, const bool reliable_metadata, cons d->id_ = SqlHelper::ValueToInt(r, ColumnIndex(u"ROWID"_s) + col); set_title(SqlHelper::ValueToString(r, ColumnIndex(u"title"_s) + col)); + set_titlesort(SqlHelper::ValueToString(r, ColumnIndex(u"titlesort"_s) + col)); set_album(SqlHelper::ValueToString(r, ColumnIndex(u"album"_s) + col)); + set_albumsort(SqlHelper::ValueToString(r, ColumnIndex(u"albumsort"_s) + col)); set_artist(SqlHelper::ValueToString(r, ColumnIndex(u"artist"_s) + col)); + set_artistsort(SqlHelper::ValueToString(r, ColumnIndex(u"artistsort"_s) + col)); set_albumartist(SqlHelper::ValueToString(r, ColumnIndex(u"albumartist"_s) + col)); + set_albumartistsort(SqlHelper::ValueToString(r, ColumnIndex(u"albumartistsort"_s) + col)); d->track_ = SqlHelper::ValueToInt(r, ColumnIndex(u"track"_s) + col); d->disc_ = SqlHelper::ValueToInt(r, ColumnIndex(u"disc"_s) + col); d->year_ = SqlHelper::ValueToInt(r, ColumnIndex(u"year"_s) + col); @@ -1508,7 +1546,9 @@ void Song::InitFromQuery(const QSqlRecord &r, const bool reliable_metadata, cons d->genre_ = SqlHelper::ValueToString(r, ColumnIndex(u"genre"_s) + col); d->compilation_ = r.value(ColumnIndex(u"compilation"_s) + col).toBool(); d->composer_ = SqlHelper::ValueToString(r, ColumnIndex(u"composer"_s) + col); + d->composersort_ = SqlHelper::ValueToString(r, ColumnIndex(u"composersort"_s) + col); d->performer_ = SqlHelper::ValueToString(r, ColumnIndex(u"performer"_s) + col); + d->performersort_ = SqlHelper::ValueToString(r, ColumnIndex(u"performersort"_s) + col); d->grouping_ = SqlHelper::ValueToString(r, ColumnIndex(u"grouping"_s) + col); d->comment_ = SqlHelper::ValueToString(r, ColumnIndex(u"comment"_s) + col); d->lyrics_ = SqlHelper::ValueToString(r, ColumnIndex(u"lyrics"_s) + col); @@ -1816,9 +1856,13 @@ void Song::BindToQuery(SqlQuery *query) const { // Remember to bind these in the same order as kBindSpec query->BindStringValue(u":title"_s, d->title_); + query->BindStringValue(u":titlesort"_s, d->titlesort_); query->BindStringValue(u":album"_s, d->album_); + query->BindStringValue(u":albumsort"_s, d->albumsort_); query->BindStringValue(u":artist"_s, d->artist_); + query->BindStringValue(u":artistsort"_s, d->artistsort_); query->BindStringValue(u":albumartist"_s, d->albumartist_); + query->BindStringValue(u":albumartistsort"_s, d->albumartistsort_); query->BindIntValue(u":track"_s, d->track_); query->BindIntValue(u":disc"_s, d->disc_); query->BindIntValue(u":year"_s, d->year_); @@ -1826,7 +1870,9 @@ void Song::BindToQuery(SqlQuery *query) const { query->BindStringValue(u":genre"_s, d->genre_); query->BindBoolValue(u":compilation"_s, d->compilation_); query->BindStringValue(u":composer"_s, d->composer_); + query->BindStringValue(u":composersort"_s, d->composersort_); query->BindStringValue(u":performer"_s, d->performer_); + query->BindStringValue(u":performersort"_s, d->performersort_); query->BindStringValue(u":grouping"_s, d->grouping_); query->BindStringValue(u":comment"_s, d->comment_); query->BindStringValue(u":lyrics"_s, d->lyrics_); diff --git a/src/core/song.h b/src/core/song.h index 0ebdb99e8..091e46613 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -150,9 +150,13 @@ class Song { bool is_valid() const; const QString &title() const; + const QString &titlesort() const; const QString &album() const; + const QString &albumsort() const; const QString &artist() const; + const QString &artistsort() const; const QString &albumartist() const; + const QString &albumartistsort() const; int track() const; int disc() const; int year() const; @@ -160,7 +164,9 @@ class Song { const QString &genre() const; bool compilation() const; const QString &composer() const; + const QString &composersort() const; const QString &performer() const; + const QString &performersort() const; const QString &grouping() const; const QString &comment() const; const QString &lyrics() const; @@ -262,9 +268,13 @@ class Song { void set_valid(const bool v); void set_title(const QString &v); + void set_titlesort(const QString &v); void set_album(const QString &v); + void set_albumsort(const QString &v); void set_artist(const QString &v); + void set_artistsort(const QString &v); void set_albumartist(const QString &v); + void set_albumartistsort(const QString &v); void set_track(const int v); void set_disc(const int v); void set_year(const int v); @@ -272,7 +282,9 @@ class Song { void set_genre(const QString &v); void set_compilation(bool v); void set_composer(const QString &v); + void set_composersort(const QString &v); void set_performer(const QString &v); + void set_performersort(const QString &v); void set_grouping(const QString &v); void set_comment(const QString &v); void set_lyrics(const QString &v); @@ -341,12 +353,18 @@ class Song { void set_stream_url(const QUrl &v); void set_title(const TagLib::String &v); + void set_titlesort(const TagLib::String &v); void set_album(const TagLib::String &v); + void set_albumsort(const TagLib::String &v); void set_artist(const TagLib::String &v); + void set_artistsort(const TagLib::String &v); void set_albumartist(const TagLib::String &v); + void set_albumartistsort(const TagLib::String &v); void set_genre(const TagLib::String &v); void set_composer(const TagLib::String &v); + void set_composersort(const TagLib::String &v); void set_performer(const TagLib::String &v); + void set_performersort(const TagLib::String &v); void set_grouping(const TagLib::String &v); void set_comment(const TagLib::String &v); void set_lyrics(const TagLib::String &v); diff --git a/src/tagreader/tagreadertaglib.cpp b/src/tagreader/tagreadertaglib.cpp index e34da385a..36a87f959 100644 --- a/src/tagreader/tagreadertaglib.cpp +++ b/src/tagreader/tagreadertaglib.cpp @@ -114,8 +114,13 @@ using namespace Qt::Literals::StringLiterals; namespace { constexpr char kID3v2_AlbumArtist[] = "TPE2"; +constexpr char kID3v2_AlbumArtistSort[] = "TSO2"; +constexpr char kID3v2_AlbumSort[] = "TSOA"; +constexpr char kID3v2_ArtistSort[] = "TSOP"; +constexpr char kID3v2_TitleSort[] = "TSOT"; constexpr char kID3v2_Disc[] = "TPOS"; constexpr char kID3v2_Composer[] = "TCOM"; +constexpr char kID3v2_ComposerSort[] = "TSOC"; constexpr char kID3v2_Performer[] = "TOPE"; constexpr char kID3v2_Grouping[] = "TIT1"; constexpr char kID3v2_Compilation[] = "TCMP"; @@ -143,8 +148,14 @@ constexpr char kID3v2_MusicBrainz_WorkId[] = "MusicBrainz Work Id"; constexpr char kVorbisComment_AlbumArtist1[] = "ALBUMARTIST"; constexpr char kVorbisComment_AlbumArtist2[] = "ALBUM ARTIST"; +constexpr char kVorbisComment_AlbumArtistSort[] = "ALBUMARTISTSORT"; +constexpr char kVorbisComment_AlbumSort[] = "ALBUMSORT"; +constexpr char kVorbisComment_ArtistSort[] = "ARTISTSORT"; +constexpr char kVorbisComment_TitleSort[] = "TITLESORT"; constexpr char kVorbisComment_Composer[] = "COMPOSER"; +constexpr char kVorbisComment_ComposerSort[] = "COMPOSERSORT"; constexpr char kVorbisComment_Performer[] = "PERFORMER"; +constexpr char kVorbisComment_PerformerSort[] = "PERFORMERSORT"; constexpr char kVorbisComment_Grouping1[] = "GROUPING"; constexpr char kVorbisComment_Grouping2[] = "CONTENT GROUP"; constexpr char kVorbisComment_OriginalYear1[] = "ORIGINALDATE"; @@ -589,6 +600,7 @@ void TagReaderTagLib::ParseID3v2Tags(TagLib::ID3v2::Tag *tag, QString *disc, QSt if (map.contains(kID3v2_Disc)) *disc = TagLibStringToQString(map[kID3v2_Disc].front()->toString()).trimmed(); if (map.contains(kID3v2_Composer)) song->set_composer(map[kID3v2_Composer].front()->toString()); + if (map.contains(kID3v2_ComposerSort)) song->set_composersort(map[kID3v2_ComposerSort].front()->toString()); // content group if (map.contains(kID3v2_Grouping)) song->set_grouping(map[kID3v2_Grouping].front()->toString()); @@ -601,6 +613,11 @@ void TagReaderTagLib::ParseID3v2Tags(TagLib::ID3v2::Tag *tag, QString *disc, QSt // non-standard: Apple, Microsoft if (map.contains(kID3v2_AlbumArtist)) song->set_albumartist(map[kID3v2_AlbumArtist].front()->toString()); + if (map.contains(kID3v2_AlbumArtistSort)) song->set_albumartistsort(map[kID3v2_AlbumArtistSort].front()->toString()); + if (map.contains(kID3v2_AlbumSort)) song->set_albumsort(map[kID3v2_AlbumSort].front()->toString()); + if (map.contains(kID3v2_ArtistSort)) song->set_artistsort(map[kID3v2_ArtistSort].front()->toString()); + if (map.contains(kID3v2_TitleSort)) song->set_titlesort(map[kID3v2_TitleSort].front()->toString()); + if (map.contains(kID3v2_Compilation)) *compilation = TagLibStringToQString(map[kID3v2_Compilation].front()->toString()).trimmed(); if (map.contains(kID3v2_OriginalReleaseTime)) { @@ -706,13 +723,20 @@ void TagReaderTagLib::ParseID3v2Tags(TagLib::ID3v2::Tag *tag, QString *disc, QSt void TagReaderTagLib::ParseVorbisComments(const TagLib::Ogg::FieldListMap &map, QString *disc, QString *compilation, Song *song) const { if (map.contains(kVorbisComment_Composer)) song->set_composer(map[kVorbisComment_Composer].front()); + if (map.contains(kVorbisComment_ComposerSort)) song->set_composersort(map[kVorbisComment_ComposerSort].front()); if (map.contains(kVorbisComment_Performer)) song->set_performer(map[kVorbisComment_Performer].front()); + if (map.contains(kVorbisComment_PerformerSort)) song->set_performersort(map[kVorbisComment_PerformerSort].front()); if (map.contains(kVorbisComment_Grouping2)) song->set_grouping(map[kVorbisComment_Grouping2].front()); if (map.contains(kVorbisComment_Grouping1)) song->set_grouping(map[kVorbisComment_Grouping1].front()); if (map.contains(kVorbisComment_AlbumArtist1)) song->set_albumartist(map[kVorbisComment_AlbumArtist1].front()); else if (map.contains(kVorbisComment_AlbumArtist2)) song->set_albumartist(map[kVorbisComment_AlbumArtist2].front()); + if (map.contains(kVorbisComment_AlbumArtistSort)) song->set_albumartistsort(map[kVorbisComment_AlbumArtistSort].front()); + if (map.contains(kVorbisComment_AlbumSort)) song->set_albumsort(map[kVorbisComment_AlbumSort].front()); + if (map.contains(kVorbisComment_ArtistSort)) song->set_artistsort(map[kVorbisComment_ArtistSort].front()); + if (map.contains(kVorbisComment_TitleSort)) song->set_titlesort(map[kVorbisComment_TitleSort].front()); + if (map.contains(kVorbisComment_OriginalYear1)) song->set_originalyear(TagLibStringToQString(map[kVorbisComment_OriginalYear1].front()).left(4).toInt()); else if (map.contains(kVorbisComment_OriginalYear2)) song->set_originalyear(TagLibStringToQString(map[kVorbisComment_OriginalYear2].front()).toInt()); @@ -1227,10 +1251,15 @@ void TagReaderTagLib::SetID3v2Tag(TagLib::ID3v2::Tag *tag, const Song &song) con SetTextFrame(kID3v2_Disc, song.disc() <= 0 ? QString() : QString::number(song.disc()), tag); SetTextFrame(kID3v2_Composer, song.composer().isEmpty() ? QString() : song.composer(), tag); + SetTextFrame(kID3v2_ComposerSort, song.composersort().isEmpty() ? QString() : song.composersort(), tag); SetTextFrame(kID3v2_Grouping, song.grouping().isEmpty() ? QString() : song.grouping(), tag); SetTextFrame(kID3v2_Performer, song.performer().isEmpty() ? QString() : song.performer(), tag); // Skip TPE1 (which is the artist) here because we already set it SetTextFrame(kID3v2_AlbumArtist, song.albumartist().isEmpty() ? QString() : song.albumartist(), tag); + SetTextFrame(kID3v2_AlbumArtistSort, song.albumartistsort().isEmpty() ? QString() : song.albumartistsort(), tag); + SetTextFrame(kID3v2_AlbumSort, song.albumsort().isEmpty() ? QString() : song.albumsort(), tag); + SetTextFrame(kID3v2_ArtistSort, song.artistsort().isEmpty() ? QString() : song.artistsort(), tag); + SetTextFrame(kID3v2_TitleSort, song.titlesort().isEmpty() ? QString() : song.titlesort(), tag); SetTextFrame(kID3v2_Compilation, song.compilation() ? QString::number(1) : QString(), tag); SetUnsyncLyricsFrame(song.lyrics().isEmpty() ? QString() : song.lyrics(), tag); @@ -1318,7 +1347,9 @@ void TagReaderTagLib::SetUnsyncLyricsFrame(const QString &value, TagLib::ID3v2:: void TagReaderTagLib::SetVorbisComments(TagLib::Ogg::XiphComment *vorbis_comment, const Song &song) const { vorbis_comment->addField(kVorbisComment_Composer, QStringToTagLibString(song.composer()), true); + vorbis_comment->addField(kVorbisComment_ComposerSort, QStringToTagLibString(song.composersort()), true); vorbis_comment->addField(kVorbisComment_Performer, QStringToTagLibString(song.performer()), true); + vorbis_comment->addField(kVorbisComment_PerformerSort, QStringToTagLibString(song.performersort()), true); vorbis_comment->addField(kVorbisComment_Grouping1, QStringToTagLibString(song.grouping()), true); vorbis_comment->addField(kVorbisComment_Disc, QStringToTagLibString(song.disc() <= 0 ? QString() : QString::number(song.disc())), true); vorbis_comment->addField(kVorbisComment_Compilation, QStringToTagLibString(song.compilation() ? u"1"_s : QString()), true); @@ -1327,6 +1358,10 @@ void TagReaderTagLib::SetVorbisComments(TagLib::Ogg::XiphComment *vorbis_comment vorbis_comment->addField(kVorbisComment_AlbumArtist1, QStringToTagLibString(song.albumartist()), true); vorbis_comment->removeFields(kVorbisComment_AlbumArtist2); + vorbis_comment->addField(kVorbisComment_AlbumArtistSort, QStringToTagLibString(song.albumartistsort()), true); + vorbis_comment->addField(kVorbisComment_AlbumSort, QStringToTagLibString(song.albumsort()), true); + vorbis_comment->addField(kVorbisComment_ArtistSort, QStringToTagLibString(song.artistsort()), true); + vorbis_comment->addField(kVorbisComment_TitleSort, QStringToTagLibString(song.titlesort()), true); vorbis_comment->addField(kVorbisComment_Lyrics, QStringToTagLibString(song.lyrics()), true); vorbis_comment->removeFields(kVorbisComment_UnsyncedLyrics); diff --git a/tests/src/tagreader_test.cpp b/tests/src/tagreader_test.cpp index 9ef9c3ff0..ef2a17c04 100644 --- a/tests/src/tagreader_test.cpp +++ b/tests/src/tagreader_test.cpp @@ -185,11 +185,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Write tags Song song; song.set_title(u"strawberry title"_s); + song.set_titlesort(u"strawberry title sort"_s); song.set_artist(u"strawberry artist"_s); + song.set_artistsort(u"strawberry artist sort"_s); song.set_album(u"strawberry album"_s); + song.set_albumsort(u"strawberry album sort"_s); song.set_albumartist(u"strawberry album artist"_s); + song.set_albumartistsort(u"strawberry album artist sort"_s); song.set_composer(u"strawberry composer"_s); + song.set_composersort(u"strawberry composer sort"_s); song.set_performer(u"strawberry performer"_s); + song.set_performersort(u"strawberry performer sort"_s); song.set_grouping(u"strawberry grouping"_s); song.set_genre(u"strawberry genre"_s); song.set_comment(u"strawberry comment"_s); @@ -208,11 +214,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Read tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"strawberry title"_s, song.title()); + EXPECT_EQ(u"strawberry title sort"_s, song.titlesort()); EXPECT_EQ(u"strawberry artist"_s, song.artist()); + EXPECT_EQ(u"strawberry artist sort"_s, song.artistsort()); EXPECT_EQ(u"strawberry album"_s, song.album()); + EXPECT_EQ(u"strawberry album sort"_s, song.albumsort()); EXPECT_EQ(u"strawberry album artist"_s, song.albumartist()); + EXPECT_EQ(u"strawberry album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"strawberry composer"_s, song.composer()); + EXPECT_EQ(u"strawberry composer sort"_s, song.composersort()); EXPECT_EQ(u"strawberry performer"_s, song.performer()); + EXPECT_EQ(u"strawberry performer sort"_s, song.performersort()); EXPECT_EQ(u"strawberry grouping"_s, song.grouping()); EXPECT_EQ(u"strawberry genre"_s, song.genre()); EXPECT_EQ(u"strawberry comment"_s, song.comment()); @@ -226,11 +238,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Write new tags Song song; song.set_title(u"new title"_s); + song.set_titlesort(u"new title sort"_s); song.set_artist(u"new artist"_s); + song.set_artistsort(u"new artist sort"_s); song.set_album(u"new album"_s); + song.set_albumsort(u"new album sort"_s); song.set_albumartist(u"new album artist"_s); + song.set_albumartistsort(u"new album artist sort"_s); song.set_composer(u"new composer"_s); + song.set_composersort(u"new composer sort"_s); song.set_performer(u"new performer"_s); + song.set_performersort(u"new performer sort"_s); song.set_grouping(u"new grouping"_s); song.set_genre(u"new genre"_s); song.set_comment(u"new comment"_s); @@ -245,11 +263,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Read new tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"new title"_s, song.title()); + EXPECT_EQ(u"new title sort"_s, song.titlesort()); EXPECT_EQ(u"new artist"_s, song.artist()); + EXPECT_EQ(u"new artist sort"_s, song.artistsort()); EXPECT_EQ(u"new album"_s, song.album()); + EXPECT_EQ(u"new album sort"_s, song.albumsort()); EXPECT_EQ(u"new album artist"_s, song.albumartist()); + EXPECT_EQ(u"new album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"new composer"_s, song.composer()); + EXPECT_EQ(u"new composer sort"_s, song.composersort()); EXPECT_EQ(u"new performer"_s, song.performer()); + EXPECT_EQ(u"new performer sort"_s, song.performersort()); EXPECT_EQ(u"new grouping"_s, song.grouping()); EXPECT_EQ(u"new genre"_s, song.genre()); EXPECT_EQ(u"new comment"_s, song.comment()); @@ -263,11 +287,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Write original tags Song song; song.set_title(u"strawberry title"_s); + song.set_titlesort(u"strawberry title sort"_s); song.set_artist(u"strawberry artist"_s); + song.set_artistsort(u"strawberry artist sort"_s); song.set_album(u"strawberry album"_s); + song.set_albumsort(u"strawberry album sort"_s); song.set_albumartist(u"strawberry album artist"_s); + song.set_albumartistsort(u"strawberry album artist sort"_s); song.set_composer(u"strawberry composer"_s); + song.set_composersort(u"strawberry composer sort"_s); song.set_performer(u"strawberry performer"_s); + song.set_performersort(u"strawberry performer sort"_s); song.set_grouping(u"strawberry grouping"_s); song.set_genre(u"strawberry genre"_s); song.set_comment(u"strawberry comment"_s); @@ -282,11 +312,17 @@ TEST_F(TagReaderTest, TestFLACAudioFileTagging) { { // Read original tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"strawberry title"_s, song.title()); + EXPECT_EQ(u"strawberry title sort"_s, song.titlesort()); EXPECT_EQ(u"strawberry artist"_s, song.artist()); + EXPECT_EQ(u"strawberry artist sort"_s, song.artistsort()); EXPECT_EQ(u"strawberry album"_s, song.album()); + EXPECT_EQ(u"strawberry album sort"_s, song.albumsort()); EXPECT_EQ(u"strawberry album artist"_s, song.albumartist()); + EXPECT_EQ(u"strawberry album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"strawberry composer"_s, song.composer()); + EXPECT_EQ(u"strawberry composer sort"_s, song.composersort()); EXPECT_EQ(u"strawberry performer"_s, song.performer()); + EXPECT_EQ(u"strawberry performer sort"_s, song.performersort()); EXPECT_EQ(u"strawberry grouping"_s, song.grouping()); EXPECT_EQ(u"strawberry genre"_s, song.genre()); EXPECT_EQ(u"strawberry comment"_s, song.comment()); @@ -1505,10 +1541,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Write tags Song song; song.set_title(u"strawberry title"_s); + song.set_titlesort(u"strawberry title sort"_s); song.set_artist(u"strawberry artist"_s); + song.set_artistsort(u"strawberry artist sort"_s); song.set_album(u"strawberry album"_s); + song.set_albumsort(u"strawberry album sort"_s); song.set_albumartist(u"strawberry album artist"_s); + song.set_albumartistsort(u"strawberry album artist sort"_s); song.set_composer(u"strawberry composer"_s); + song.set_composersort(u"strawberry composer sort"_s); song.set_performer(u"strawberry performer"_s); song.set_grouping(u"strawberry grouping"_s); song.set_genre(u"strawberry genre"_s); @@ -1528,10 +1569,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Read tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"strawberry title"_s, song.title()); + EXPECT_EQ(u"strawberry title sort"_s, song.titlesort()); EXPECT_EQ(u"strawberry artist"_s, song.artist()); + EXPECT_EQ(u"strawberry artist sort"_s, song.artistsort()); EXPECT_EQ(u"strawberry album"_s, song.album()); + EXPECT_EQ(u"strawberry album sort"_s, song.albumsort()); EXPECT_EQ(u"strawberry album artist"_s, song.albumartist()); + EXPECT_EQ(u"strawberry album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"strawberry composer"_s, song.composer()); + EXPECT_EQ(u"strawberry composer sort"_s, song.composersort()); EXPECT_EQ(u"strawberry performer"_s, song.performer()); EXPECT_EQ(u"strawberry grouping"_s, song.grouping()); EXPECT_EQ(u"strawberry genre"_s, song.genre()); @@ -1546,10 +1592,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Write new tags Song song; song.set_title(u"new title"_s); + song.set_titlesort(u"new title sort"_s); song.set_artist(u"new artist"_s); + song.set_artistsort(u"new artist sort"_s); song.set_album(u"new album"_s); + song.set_albumsort(u"new album sort"_s); song.set_albumartist(u"new album artist"_s); + song.set_albumartistsort(u"new album artist sort"_s); song.set_composer(u"new composer"_s); + song.set_composersort(u"new composer sort"_s); song.set_performer(u"new performer"_s); song.set_grouping(u"new grouping"_s); song.set_genre(u"new genre"_s); @@ -1565,10 +1616,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Read new tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"new title"_s, song.title()); + EXPECT_EQ(u"new title sort"_s, song.titlesort()); EXPECT_EQ(u"new artist"_s, song.artist()); + EXPECT_EQ(u"new artist sort"_s, song.artistsort()); EXPECT_EQ(u"new album"_s, song.album()); + EXPECT_EQ(u"new album sort"_s, song.albumsort()); EXPECT_EQ(u"new album artist"_s, song.albumartist()); + EXPECT_EQ(u"new album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"new composer"_s, song.composer()); + EXPECT_EQ(u"new composer sort"_s, song.composersort()); EXPECT_EQ(u"new performer"_s, song.performer()); EXPECT_EQ(u"new grouping"_s, song.grouping()); EXPECT_EQ(4321, song.disc()); @@ -1583,10 +1639,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Write original tags Song song; song.set_title(u"strawberry title"_s); + song.set_titlesort(u"strawberry title sort"_s); song.set_artist(u"strawberry artist"_s); + song.set_artistsort(u"strawberry artist sort"_s); song.set_album(u"strawberry album"_s); + song.set_albumsort(u"strawberry album sort"_s); song.set_albumartist(u"strawberry album artist"_s); + song.set_albumartistsort(u"strawberry album artist sort"_s); song.set_composer(u"strawberry composer"_s); + song.set_composersort(u"strawberry composer sort"_s); song.set_performer(u"strawberry performer"_s); song.set_grouping(u"strawberry grouping"_s); song.set_genre(u"strawberry genre"_s); @@ -1602,10 +1663,15 @@ TEST_F(TagReaderTest, TestMP3AudioFileTagging) { { // Read original tags Song song = ReadSongFromFile(r.fileName()); EXPECT_EQ(u"strawberry title"_s, song.title()); + EXPECT_EQ(u"strawberry title sort"_s, song.titlesort()); EXPECT_EQ(u"strawberry artist"_s, song.artist()); + EXPECT_EQ(u"strawberry artist sort"_s, song.artistsort()); EXPECT_EQ(u"strawberry album"_s, song.album()); + EXPECT_EQ(u"strawberry album sort"_s, song.albumsort()); EXPECT_EQ(u"strawberry album artist"_s, song.albumartist()); + EXPECT_EQ(u"strawberry album artist sort"_s, song.albumartistsort()); EXPECT_EQ(u"strawberry composer"_s, song.composer()); + EXPECT_EQ(u"strawberry composer sort"_s, song.composersort()); EXPECT_EQ(u"strawberry performer"_s, song.performer()); EXPECT_EQ(u"strawberry grouping"_s, song.grouping()); EXPECT_EQ(u"strawberry genre"_s, song.genre());