rename YEAR tag to DATE tag (as it should've been from the beginning)

This commit is contained in:
Andrzej Rybczak
2012-07-16 00:42:40 +02:00
parent a22e875473
commit 8b2fd356b7
12 changed files with 27 additions and 33 deletions

View File

@@ -129,7 +129,7 @@
## %A - album artist
## %t - title
## %b - album
## %y - year
## %y - date
## %n - track number (01/12 -> 01)
## %N - full track info (01/12 -> 01/12)
## %g - genre

View File

@@ -405,7 +405,7 @@ For song format you can use:
%A - album artist
%t - title
%b - album
%y - year
%y - date
%n - track number (01/12 -> 01)
%N - full track info (01/12 -> 01/12)
%g - genre

View File

@@ -57,7 +57,7 @@ std::string IntoStr(mpd_tag_type tag) // this is only for left column's title in
case MPD_TAG_GENRE:
return "Genre";
case MPD_TAG_DATE:
return "Year";
return "Date";
case MPD_TAG_COMPOSER:
return "Composer";
case MPD_TAG_PERFORMER:

View File

@@ -49,7 +49,7 @@ namespace
case 'b':
return U("Album");
case 'y':
return U("Year");
return U("Date");
case 'n':
case 'N':
return U("Track");

View File

@@ -44,7 +44,7 @@ size_t MediaLibrary::itsRightColWidth;
size_t MediaLibrary::itsRightColStartX;
// this string marks the position in middle column that works as "All tracks" option. it's
// assigned to Year in SearchConstraint class since date normally cannot contain other chars
// assigned to Date in SearchConstraint class since date normally cannot contain other chars
// than ciphers and -'s (0x7f is interpreted as backspace keycode, so it's quite safe to assume
// that it won't appear in any tag, let alone date).
const char MediaLibrary::AllTracksMarker[] = "\x7f";
@@ -280,14 +280,14 @@ void MediaLibrary::Update()
{
if (Config.media_lib_primary_tag != MPD_TAG_DATE)
{
MPD::TagList years;
MPD::TagList dates;
Mpd.StartFieldSearch(MPD_TAG_DATE);
Mpd.AddSearch(Config.media_lib_primary_tag, *i);
Mpd.AddSearch(MPD_TAG_ALBUM, *j);
Mpd.CommitSearch(years);
Mpd.CommitSearch(dates);
utf_to_locale(*i);
utf_to_locale(*j);
for (MPD::TagList::iterator k = years.begin(); k != years.end(); ++k)
for (MPD::TagList::iterator k = dates.begin(); k != dates.end(); ++k)
{
utf_to_locale(*k);
Albums->AddOption(SearchConstraints(*i, *j, *k));
@@ -335,17 +335,17 @@ void MediaLibrary::Update()
}
else
{
if (Albums->Current().Year != AllTracksMarker)
if (Albums->Current().Date != AllTracksMarker)
{
Mpd.AddSearch(MPD_TAG_ALBUM, locale_to_utf_cpy(Albums->Current().Album));
if (Config.media_library_display_date)
Mpd.AddSearch(MPD_TAG_DATE, locale_to_utf_cpy(Albums->Current().Year));
Mpd.AddSearch(MPD_TAG_DATE, locale_to_utf_cpy(Albums->Current().Date));
}
}
Mpd.CommitSearch(list);
if (!Albums->Empty()) // for compatibility with mpd < 0.14
sort(list.begin(), list.end(), Albums->Current().Year == AllTracksMarker ? SortAllTracks : SortSongsByTrack);
sort(list.begin(), list.end(), Albums->Current().Date == AllTracksMarker ? SortAllTracks : SortSongsByTrack);
bool bold = 0;
for (MPD::SongList::const_iterator it = list.begin(); it != list.end(); ++it)
@@ -379,7 +379,7 @@ void MediaLibrary::SpacePressed()
}
else if (w == Albums)
{
if (Albums->Current().Year != AllTracksMarker)
if (Albums->Current().Date != AllTracksMarker)
{
Albums->Select(Albums->Choice(), !Albums->isSelected());
Songs->Clear();
@@ -530,7 +530,7 @@ void MediaLibrary::GetSelectedSongs(MPD::SongList &v)
? Albums->at(*it).PrimaryTag
: locale_to_utf_cpy(Artists->Current()));
Mpd.AddSearch(MPD_TAG_ALBUM, Albums->at(*it).Album);
Mpd.AddSearch(MPD_TAG_DATE, Albums->at(*it).Year);
Mpd.AddSearch(MPD_TAG_DATE, Albums->at(*it).Date);
Mpd.CommitSearch(list);
for (MPD::SongList::const_iterator sIt = list.begin(); sIt != list.end(); ++sIt)
v.push_back(new MPD::Song(**sIt));
@@ -672,13 +672,13 @@ void MediaLibrary::LocateSong(const MPD::Song &s)
std::string date = s.GetDate();
if ((hasTwoColumns && Albums->Current().PrimaryTag != primary_tag)
|| album != Albums->Current().Album
|| date != Albums->Current().Year)
|| date != Albums->Current().Date)
{
for (size_t i = 0; i < Albums->Size(); ++i)
{
if ((!hasTwoColumns || (*Albums)[i].PrimaryTag == primary_tag)
&& album == (*Albums)[i].Album
&& date == (*Albums)[i].Year)
&& date == (*Albums)[i].Date)
{
Albums->Highlight(i);
Songs->Clear();
@@ -722,7 +722,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
if (myPlaylist->Add(list, add_n_play))
{
if ((!Artists->Empty() && w == Artists)
|| (w == Albums && Albums->Current().Year == AllTracksMarker))
|| (w == Albums && Albums->Current().Date == AllTracksMarker))
{
std::string tag_type = IntoStr(Config.media_lib_primary_tag);
ToLower(tag_type);
@@ -753,13 +753,13 @@ std::string MediaLibrary::SongToString(const MPD::Song &s, void *)
std::string MediaLibrary::AlbumToString(const SearchConstraints &sc, void *ptr)
{
if (sc.Year == AllTracksMarker)
if (sc.Date == AllTracksMarker)
return "All tracks";
std::string result;
if (static_cast<MediaLibrary *>(ptr)->hasTwoColumns)
(result += sc.PrimaryTag.empty() ? Config.empty_tag : sc.PrimaryTag) += " - ";
if ((!static_cast<MediaLibrary *>(ptr)->hasTwoColumns || Config.media_lib_primary_tag != MPD_TAG_DATE) && !sc.Year.empty())
((result += "(") += sc.Year) += ") ";
if ((!static_cast<MediaLibrary *>(ptr)->hasTwoColumns || Config.media_lib_primary_tag != MPD_TAG_DATE) && !sc.Date.empty())
((result += "(") += sc.Date) += ") ";
result += sc.Album.empty() ? "<no album>" : sc.Album;
return result;
}
@@ -781,7 +781,7 @@ bool MediaLibrary::SearchConstraintsSorting::operator()(const SearchConstraints
result = cmp(a.PrimaryTag, b.PrimaryTag);
if (result != 0)
return result < 0;
result = cmp(a.Year, b.Year);
result = cmp(a.Date, b.Date);
return (result == 0 ? cmp(a.Album, b.Album) : result) < 0;
}

View File

@@ -28,12 +28,12 @@ class MediaLibrary : public Screen<Window>
{
struct SearchConstraints
{
SearchConstraints(const std::string &tag, const std::string &album, const std::string &year) : PrimaryTag(tag), Album(album), Year(year) { }
SearchConstraints(const std::string &album, const std::string &year) : Album(album), Year(year) { }
SearchConstraints(const std::string &tag, const std::string &album, const std::string &date) : PrimaryTag(tag), Album(album), Date(date) { }
SearchConstraints(const std::string &album, const std::string &date) : Album(album), Date(date) { }
std::string PrimaryTag;
std::string Album;
std::string Year;
std::string Date;
};
struct SearchConstraintsSorting

View File

@@ -74,7 +74,7 @@ void Playlist::Init()
SortDialog->AddOption(std::make_pair("Disc", &MPD::Song::GetDisc));
SortDialog->AddOption(std::make_pair("Track", &MPD::Song::GetTrack));
SortDialog->AddOption(std::make_pair("Genre", &MPD::Song::GetGenre));
SortDialog->AddOption(std::make_pair("Year", &MPD::Song::GetDate));
SortDialog->AddOption(std::make_pair("Date", &MPD::Song::GetDate));
SortDialog->AddOption(std::make_pair("Composer", &MPD::Song::GetComposer));
SortDialog->AddOption(std::make_pair("Performer", &MPD::Song::GetPerformer));
SortDialog->AddOption(std::make_pair("Title", &MPD::Song::GetTitle));

View File

@@ -44,7 +44,7 @@ const char *SearchEngine::ConstraintsNames[] =
"Composer:",
"Performer:",
"Genre:",
"Year:",
"Date:",
"Comment:"
};

View File

@@ -290,11 +290,6 @@ void MPD::Song::SetDate(const std::string &str, unsigned pos)
SetTag(MPD_TAG_DATE, pos, str);
}
void MPD::Song::SetDate(unsigned year, unsigned pos)
{
SetTag(MPD_TAG_DATE, pos, IntoStr(year));
}
void MPD::Song::SetGenre(const std::string &str, unsigned pos)
{
SetTag(MPD_TAG_GENRE, pos, str);

View File

@@ -74,7 +74,6 @@ namespace MPD
void SetTrack(const std::string &, unsigned = 0);
void SetTrack(unsigned, unsigned = 0);
void SetDate(const std::string &, unsigned = 0);
void SetDate(unsigned, unsigned = 0);
void SetGenre(const std::string &, unsigned = 0);
void SetComposer(const std::string &, unsigned = 0);
void SetPerformer(const std::string &, unsigned = 0);

View File

@@ -33,7 +33,7 @@ const SongInfo::Metadata SongInfo::Tags[] =
{ "Artist", &MPD::Song::GetArtist, &MPD::Song::SetArtist },
{ "Album Artist", &MPD::Song::GetAlbumArtist, &MPD::Song::SetAlbumArtist },
{ "Album", &MPD::Song::GetAlbum, &MPD::Song::SetAlbum },
{ "Year", &MPD::Song::GetDate, &MPD::Song::SetDate },
{ "Date", &MPD::Song::GetDate, &MPD::Song::SetDate },
{ "Track", &MPD::Song::GetTrack, &MPD::Song::SetTrack },
{ "Genre", &MPD::Song::GetGenre, &MPD::Song::SetGenre },
{ "Composer", &MPD::Song::GetComposer, &MPD::Song::SetComposer },

View File

@@ -372,7 +372,7 @@ void TagEditor::EnterPressed()
*FParserLegend << "%A - album artist\n";
*FParserLegend << "%t - title\n";
*FParserLegend << "%b - album\n";
*FParserLegend << "%y - year\n";
*FParserLegend << "%y - date\n";
*FParserLegend << "%n - track number\n";
*FParserLegend << "%g - genre\n";
*FParserLegend << "%c - composer\n";