new feature: command line switch for displaying now playing song

This commit is contained in:
Andrzej Rybczak
2009-08-23 22:38:05 +02:00
parent 56fd7bd7fc
commit b885c4f3a2
4 changed files with 45 additions and 23 deletions

View File

@@ -25,6 +25,7 @@
#include <cstring>
#include <iomanip>
#include <sstream>
#include <stdexcept>
#include "charset.h"
#include "misc.h"
@@ -446,6 +447,20 @@ std::string MPD::Song::ShowTime(int length)
return ss.str();
}
void MPD::Song::ValidateFormat(const std::string &type, const std::string &s)
{
int braces = 0;
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it)
{
if (*it == '{')
++braces;
else if (*it == '}')
--braces;
}
if (braces)
throw std::runtime_error(type + ": number of opening and closing braces does not equal!");
}
void MPD::Song::SetHashAndSlash()
{
if (!itsSong->file)