new feature: command line switch for displaying now playing song
This commit is contained in:
15
src/song.cpp
15
src/song.cpp
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user