rename MPD::Song::{Get,Set}Year to {Get,Set}Date
This commit is contained in:
@@ -130,7 +130,7 @@ void Display::SongsInColumns(const MPD::Song &s, void *s_template, Menu<MPD::Son
|
||||
get = &MPD::Song::GetAlbum;
|
||||
break;
|
||||
case 'y':
|
||||
get = &MPD::Song::GetYear;
|
||||
get = &MPD::Song::GetDate;
|
||||
break;
|
||||
case 'n':
|
||||
get = &MPD::Song::GetTrack;
|
||||
@@ -213,7 +213,7 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
get = &MPD::Song::GetAlbum;
|
||||
break;
|
||||
case 'y':
|
||||
get = &MPD::Song::GetYear;
|
||||
get = &MPD::Song::GetDate;
|
||||
break;
|
||||
case 'n':
|
||||
get = &MPD::Song::GetTrack;
|
||||
@@ -329,9 +329,9 @@ void Display::Songs(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
break;
|
||||
case 'y':
|
||||
if (!right)
|
||||
*menu << s.GetYear();
|
||||
*menu << s.GetDate();
|
||||
else
|
||||
buf << TO_WSTRING(s.GetYear());
|
||||
buf << TO_WSTRING(s.GetDate());
|
||||
break;
|
||||
case 'n':
|
||||
if (!right)
|
||||
@@ -412,7 +412,7 @@ void Display::Tags(const MPD::Song &s, void *data, Menu<MPD::Song> *menu)
|
||||
*menu << ShowTag(s.GetAlbum());
|
||||
return;
|
||||
case 3:
|
||||
*menu << ShowTag(s.GetYear());
|
||||
*menu << ShowTag(s.GetDate());
|
||||
return;
|
||||
case 4:
|
||||
*menu << ShowTag(s.GetTrack());
|
||||
|
||||
@@ -359,7 +359,7 @@ void Info::PrepareSong(MPD::Song &s)
|
||||
*w << fmtBold << "\nTitle: " << fmtBoldEnd << ShowTag(s.GetTitle());
|
||||
*w << fmtBold << "\nArtist: " << fmtBoldEnd << ShowTag(s.GetArtist());
|
||||
*w << fmtBold << "\nAlbum: " << fmtBoldEnd << ShowTag(s.GetAlbum());
|
||||
*w << fmtBold << "\nYear: " << fmtBoldEnd << ShowTag(s.GetYear());
|
||||
*w << fmtBold << "\nYear: " << fmtBoldEnd << ShowTag(s.GetDate());
|
||||
*w << fmtBold << "\nTrack: " << fmtBoldEnd << ShowTag(s.GetTrack());
|
||||
*w << fmtBold << "\nGenre: " << fmtBoldEnd << ShowTag(s.GetGenre());
|
||||
*w << fmtBold << "\nComposer: " << fmtBoldEnd << ShowTag(s.GetComposer());
|
||||
|
||||
@@ -588,7 +588,7 @@ std::string MediaLibrary::SongToString(const MPD::Song &s, void *)
|
||||
|
||||
bool MediaLibrary::SortSongsByYear(Song *a, Song *b)
|
||||
{
|
||||
return a->GetYear() < b->GetYear();
|
||||
return a->GetDate() < b->GetDate();
|
||||
}
|
||||
|
||||
bool MediaLibrary::SortSongsByTrack(Song *a, Song *b)
|
||||
|
||||
@@ -161,7 +161,7 @@ MPD::Song::SetFunction IntoSetFunction(mpd_TagItems tag)
|
||||
case MPD_TAG_ITEM_GENRE:
|
||||
return &MPD::Song::SetGenre;
|
||||
case MPD_TAG_ITEM_DATE:
|
||||
return &MPD::Song::SetYear;
|
||||
return &MPD::Song::SetDate;
|
||||
case MPD_TAG_ITEM_COMPOSER:
|
||||
return &MPD::Song::SetComposer;
|
||||
case MPD_TAG_ITEM_PERFORMER:
|
||||
|
||||
@@ -70,7 +70,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::GetYear));
|
||||
SortDialog->AddOption(std::make_pair("Year", &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));
|
||||
|
||||
@@ -157,8 +157,8 @@ void SearchEngine::EnterPressed()
|
||||
case 8:
|
||||
{
|
||||
Statusbar() << fmtBold << "Year: " << fmtBoldEnd;
|
||||
itsPattern.SetYear(wFooter->GetString(itsPattern.GetYear()));
|
||||
*w->Current().first << fmtBold << "Year: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetYear());
|
||||
itsPattern.SetDate(wFooter->GetString(itsPattern.GetDate()));
|
||||
*w->Current().first << fmtBold << "Year: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetDate());
|
||||
break;
|
||||
}
|
||||
case 9:
|
||||
@@ -400,7 +400,7 @@ void SearchEngine::Prepare()
|
||||
*w->at(5).first << fmtBold << "Composer: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetComposer());
|
||||
*w->at(6).first << fmtBold << "Performer:" << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetPerformer());
|
||||
*w->at(7).first << fmtBold << "Genre: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetGenre());
|
||||
*w->at(8).first << fmtBold << "Year: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetYear());
|
||||
*w->at(8).first << fmtBold << "Year: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetDate());
|
||||
*w->at(9).first << fmtBold << "Comment: " << fmtBoldEnd << ' ' << ShowTag(itsPattern.GetComment());
|
||||
|
||||
*w->at(11).first << fmtBold << "Search in:" << fmtBoldEnd << ' ' << (Config.search_in_db ? "Database" : "Current playlist");
|
||||
@@ -528,7 +528,7 @@ void SearchEngine::Search()
|
||||
|| regexec(&rx, copy.GetComposer().c_str(), 0, 0, 0) == 0
|
||||
|| regexec(&rx, copy.GetPerformer().c_str(), 0, 0, 0) == 0
|
||||
|| regexec(&rx, copy.GetGenre().c_str(), 0, 0, 0) == 0
|
||||
|| regexec(&rx, copy.GetYear().c_str(), 0, 0, 0) == 0
|
||||
|| regexec(&rx, copy.GetDate().c_str(), 0, 0, 0) == 0
|
||||
|| regexec(&rx, copy.GetComment().c_str(), 0, 0, 0) == 0;
|
||||
}
|
||||
regfree(&rx);
|
||||
@@ -576,10 +576,10 @@ void SearchEngine::Search()
|
||||
found = regexec(&rx, copy.GetGenre().c_str(), 0, 0, 0) == 0;
|
||||
regfree(&rx);
|
||||
}
|
||||
if (found && !s.GetYear().empty())
|
||||
if (found && !s.GetDate().empty())
|
||||
{
|
||||
if (regcomp(&rx, s.GetYear().c_str(), CaseSensitive | Config.regex_type) == 0)
|
||||
found = regexec(&rx, copy.GetYear().c_str(), 0, 0, 0) == 0;
|
||||
if (regcomp(&rx, s.GetDate().c_str(), CaseSensitive | Config.regex_type) == 0)
|
||||
found = regexec(&rx, copy.GetDate().c_str(), 0, 0, 0) == 0;
|
||||
regfree(&rx);
|
||||
}
|
||||
if (found && !s.GetComment().empty())
|
||||
@@ -600,7 +600,7 @@ void SearchEngine::Search()
|
||||
|| copy.GetComposer() == s.Any()
|
||||
|| copy.GetPerformer() == s.Any()
|
||||
|| copy.GetGenre() == s.Any()
|
||||
|| copy.GetYear() == s.Any()
|
||||
|| copy.GetDate() == s.Any()
|
||||
|| copy.GetComment() == s.Any();
|
||||
|
||||
if (found && !s.GetArtist().empty())
|
||||
@@ -617,8 +617,8 @@ void SearchEngine::Search()
|
||||
found = copy.GetPerformer() == s.GetPerformer();
|
||||
if (found && !s.GetGenre().empty())
|
||||
found = copy.GetGenre() == s.GetGenre();
|
||||
if (found && !s.GetYear().empty())
|
||||
found = copy.GetYear() == s.GetYear();
|
||||
if (found && !s.GetDate().empty())
|
||||
found = copy.GetDate() == s.GetDate();
|
||||
if (found && !s.GetComment().empty())
|
||||
found = copy.GetComment() == s.GetComment();
|
||||
}
|
||||
|
||||
10
src/song.cpp
10
src/song.cpp
@@ -162,7 +162,7 @@ std::string MPD::Song::GetTrack() const
|
||||
return itsSong->track;
|
||||
}
|
||||
|
||||
std::string MPD::Song::GetYear() const
|
||||
std::string MPD::Song::GetDate() const
|
||||
{
|
||||
return !itsSong->date ? "" : itsSong->date;
|
||||
}
|
||||
@@ -235,14 +235,14 @@ void MPD::Song::SetTrack(int track)
|
||||
itsSong->track = str_pool_get(IntoStr(track).c_str());
|
||||
}
|
||||
|
||||
void MPD::Song::SetYear(const std::string &str)
|
||||
void MPD::Song::SetDate(const std::string &str)
|
||||
{
|
||||
if (itsSong->date)
|
||||
str_pool_put(itsSong->date);
|
||||
itsSong->date = str.empty() ? 0 : str_pool_get(str.c_str());
|
||||
}
|
||||
|
||||
void MPD::Song::SetYear(int year)
|
||||
void MPD::Song::SetDate(int year)
|
||||
{
|
||||
if (itsSong->date)
|
||||
str_pool_put(itsSong->date);
|
||||
@@ -323,7 +323,7 @@ std::string MPD::Song::toString(const std::string &format) const
|
||||
get = &Song::GetAlbum;
|
||||
break;
|
||||
case 'y':
|
||||
get = &Song::GetYear;
|
||||
get = &Song::GetDate;
|
||||
break;
|
||||
case 'n':
|
||||
get = &Song::GetTrack;
|
||||
@@ -420,7 +420,7 @@ std::string MPD::Song::toString(const std::string &format) const
|
||||
result += GetAlbum();
|
||||
break;
|
||||
case 'y':
|
||||
result += GetYear();
|
||||
result += GetDate();
|
||||
break;
|
||||
case 'n':
|
||||
result += GetTrack();
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace MPD
|
||||
std::string GetTitle() const;
|
||||
std::string GetAlbum() const;
|
||||
std::string GetTrack() const;
|
||||
std::string GetYear() const;
|
||||
std::string GetDate() const;
|
||||
std::string GetGenre() const;
|
||||
std::string GetComposer() const;
|
||||
std::string GetPerformer() const;
|
||||
@@ -65,8 +65,8 @@ namespace MPD
|
||||
void SetAlbum(const std::string &);
|
||||
void SetTrack(const std::string &);
|
||||
void SetTrack(int);
|
||||
void SetYear(const std::string &);
|
||||
void SetYear(int);
|
||||
void SetDate(const std::string &);
|
||||
void SetDate(int);
|
||||
void SetGenre(const std::string &);
|
||||
void SetComposer(const std::string &);
|
||||
void SetPerformer(const std::string &);
|
||||
|
||||
@@ -127,8 +127,8 @@ void TinyTagEditor::EnterPressed()
|
||||
case 4:
|
||||
{
|
||||
Statusbar() << fmtBold << "Year: " << fmtBoldEnd;
|
||||
s.SetYear(wFooter->GetString(s.GetYear(), 4));
|
||||
w->at(option) << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear());
|
||||
s.SetDate(wFooter->GetString(s.GetDate(), 4));
|
||||
w->at(option) << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetDate());
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
@@ -290,7 +290,7 @@ bool TinyTagEditor::GetTags()
|
||||
w->at(8) << fmtBold << "Title:" << fmtBoldEnd << ' ' << ShowTag(s.GetTitle());
|
||||
w->at(9) << fmtBold << "Artist:" << fmtBoldEnd << ' ' << ShowTag(s.GetArtist());
|
||||
w->at(10) << fmtBold << "Album:" << fmtBoldEnd << ' ' << ShowTag(s.GetAlbum());
|
||||
w->at(11) << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetYear());
|
||||
w->at(11) << fmtBold << "Year:" << fmtBoldEnd << ' ' << ShowTag(s.GetDate());
|
||||
w->at(12) << fmtBold << "Track:" << fmtBoldEnd << ' ' << ShowTag(s.GetTrack());
|
||||
w->at(13) << fmtBold << "Genre:" << fmtBoldEnd << ' ' << ShowTag(s.GetGenre());
|
||||
w->at(14) << fmtBold << "Composer:" << fmtBoldEnd << ' ' << ShowTag(s.GetComposer());
|
||||
@@ -583,8 +583,8 @@ void TagEditor::EnterPressed()
|
||||
set = &Song::SetAlbum;
|
||||
break;
|
||||
case 3:
|
||||
get = &Song::GetYear;
|
||||
set = &Song::SetYear;
|
||||
get = &Song::GetDate;
|
||||
set = &Song::SetDate;
|
||||
break;
|
||||
case 4:
|
||||
get = &Song::GetTrack;
|
||||
@@ -929,7 +929,7 @@ bool TagEditor::WriteTags(Song &s)
|
||||
f.tag()->setTitle(ToWString(s.GetTitle()));
|
||||
f.tag()->setArtist(ToWString(s.GetArtist()));
|
||||
f.tag()->setAlbum(ToWString(s.GetAlbum()));
|
||||
f.tag()->setYear(StrToInt(s.GetYear()));
|
||||
f.tag()->setYear(StrToInt(s.GetDate()));
|
||||
f.tag()->setTrack(StrToInt(s.GetTrack()));
|
||||
f.tag()->setGenre(ToWString(s.GetGenre()));
|
||||
f.tag()->setComment(ToWString(s.GetComment()));
|
||||
@@ -1095,7 +1095,7 @@ std::string TagEditor::TagToString(const MPD::Song &s, void *data)
|
||||
result = s.GetAlbum();
|
||||
break;
|
||||
case 3:
|
||||
result = s.GetYear();
|
||||
result = s.GetDate();
|
||||
break;
|
||||
case 4:
|
||||
result = s.GetTrack();
|
||||
@@ -1167,7 +1167,7 @@ Song::SetFunction TagEditor::IntoSetFunction(char c)
|
||||
case 'b':
|
||||
return &Song::SetAlbum;
|
||||
case 'y':
|
||||
return &Song::SetYear;
|
||||
return &Song::SetDate;
|
||||
case 'n':
|
||||
return &Song::SetTrack;
|
||||
case 'g':
|
||||
|
||||
Reference in New Issue
Block a user