tag editor: add options "Capitalize First Letters" and "lower all letters"
This commit is contained in:
@@ -1693,6 +1693,22 @@ int main(int argc, char *argv[])
|
|||||||
mEditorTags->Clear(0);
|
mEditorTags->Clear(0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
case 13: // capitalize first letters
|
||||||
|
{
|
||||||
|
ShowMessage("Processing...");
|
||||||
|
for (SongList::iterator it = list.begin(); it != list.end(); it++)
|
||||||
|
CapitalizeFirstLetters(**it);
|
||||||
|
ShowMessage("Done!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 14: // lower all letters
|
||||||
|
{
|
||||||
|
ShowMessage("Processing...");
|
||||||
|
for (SongList::iterator it = list.begin(); it != list.end(); it++)
|
||||||
|
LowerAllLetters(**it);
|
||||||
|
ShowMessage("Done!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3671,8 +3687,9 @@ int main(int argc, char *argv[])
|
|||||||
mEditorTagTypes->AddSeparator();
|
mEditorTagTypes->AddSeparator();
|
||||||
mEditorTagTypes->AddOption("Reset");
|
mEditorTagTypes->AddOption("Reset");
|
||||||
mEditorTagTypes->AddOption("Save");
|
mEditorTagTypes->AddOption("Save");
|
||||||
/*mEditorTagTypes->AddSeparator();
|
mEditorTagTypes->AddSeparator();
|
||||||
mEditorTagTypes->AddOption("Capitalize first letters");*/
|
mEditorTagTypes->AddOption("Capitalize First Letters");
|
||||||
|
mEditorTagTypes->AddOption("lower all letters");
|
||||||
}
|
}
|
||||||
|
|
||||||
wCurrent = mEditorLeftCol;
|
wCurrent = mEditorLeftCol;
|
||||||
|
|||||||
@@ -161,6 +161,21 @@ namespace
|
|||||||
}
|
}
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string tag_capitalize_first_letters(const string &s)
|
||||||
|
{
|
||||||
|
if (s.empty())
|
||||||
|
return "";
|
||||||
|
string result = s;
|
||||||
|
if (isalpha(result[0]))
|
||||||
|
result[0] = toupper(result[0]);
|
||||||
|
for (string::iterator it = result.begin()+1; it != result.end(); it++)
|
||||||
|
{
|
||||||
|
if (isalpha(*it) && *(it-1) == ' ')
|
||||||
|
*it = toupper(*it);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SongSetFunction IntoSetFunction(mpd_TagItems tag)
|
SongSetFunction IntoSetFunction(mpd_TagItems tag)
|
||||||
@@ -684,5 +699,52 @@ void __deal_with_filenames(SongList &v)
|
|||||||
delete Preview;
|
delete Preview;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CapitalizeFirstLetters(Song &s)
|
||||||
|
{
|
||||||
|
s.SetTitle(tag_capitalize_first_letters(s.GetTitle()));
|
||||||
|
s.SetArtist(tag_capitalize_first_letters(s.GetArtist()));
|
||||||
|
s.SetAlbum(tag_capitalize_first_letters(s.GetAlbum()));
|
||||||
|
s.SetGenre(tag_capitalize_first_letters(s.GetGenre()));
|
||||||
|
s.SetComposer(tag_capitalize_first_letters(s.GetComposer()));
|
||||||
|
s.SetPerformer(tag_capitalize_first_letters(s.GetPerformer()));
|
||||||
|
s.SetDisc(tag_capitalize_first_letters(s.GetDisc()));
|
||||||
|
s.SetComment(tag_capitalize_first_letters(s.GetComment()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LowerAllLetters(Song &s)
|
||||||
|
{
|
||||||
|
string conv = s.GetTitle();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetTitle(conv);
|
||||||
|
|
||||||
|
conv = s.GetArtist();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetArtist(conv);
|
||||||
|
|
||||||
|
conv = s.GetAlbum();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetAlbum(conv);
|
||||||
|
|
||||||
|
conv = s.GetGenre();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetGenre(conv);
|
||||||
|
|
||||||
|
conv = s.GetComposer();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetComposer(conv);
|
||||||
|
|
||||||
|
conv = s.GetPerformer();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetPerformer(conv);
|
||||||
|
|
||||||
|
conv = s.GetDisc();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetDisc(conv);
|
||||||
|
|
||||||
|
conv = s.GetComment();
|
||||||
|
ToLower(conv);
|
||||||
|
s.SetComment(conv);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,9 @@ bool WriteTags(Song &);
|
|||||||
|
|
||||||
void __deal_with_filenames(MPD::SongList &);
|
void __deal_with_filenames(MPD::SongList &);
|
||||||
|
|
||||||
|
void CapitalizeFirstLetters(Song &);
|
||||||
|
void LowerAllLetters(Song &);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user