perform one more check on song formats

it detects something like this: %. (where . doesn't stand for a valid tag type).
This commit is contained in:
Andrzej Rybczak
2010-08-23 10:51:26 +02:00
parent 523164dd74
commit 638fab8535
4 changed files with 35 additions and 24 deletions

View File

@@ -147,13 +147,15 @@ void ParseArgv(int argc, char **argv)
{
if (argc > ++i)
{
// apply additional pair of braces
now_playing_format = "{";
now_playing_format += argv[i];
now_playing_format += "}";
Replace(now_playing_format, "\\n", "\n");
Replace(now_playing_format, "\\t", "\t");
MPD::Song::ValidateFormat("now-playing format", now_playing_format);
if (MPD::Song::isFormatOk("now-playing format", now_playing_format))
{
// apply additional pair of braces
now_playing_format = "{";
now_playing_format += argv[i];
now_playing_format += "}";
Replace(now_playing_format, "\\n", "\n");
Replace(now_playing_format, "\\t", "\t");
}
}
std::cout << utf_to_locale_cpy(Mpd.GetCurrentSong().toString(now_playing_format)) << "\n";
}