song: a few tweaks
This commit is contained in:
10
src/song.cpp
10
src/song.cpp
@@ -199,12 +199,10 @@ std::string Song::getPriority(unsigned idx) const
|
|||||||
assert(pimpl);
|
assert(pimpl);
|
||||||
if (idx > 0)
|
if (idx > 0)
|
||||||
return "";
|
return "";
|
||||||
char buf[10];
|
return unsignedIntTo<std::string>::apply(getPrio());
|
||||||
snprintf(buf, sizeof(buf), "%d", getPrio());
|
|
||||||
return buf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MPD::Song::getTags(GetFunction f, const std::string tag_separator) const
|
std::string MPD::Song::getTags(GetFunction f, const std::string &tag_separator) const
|
||||||
{
|
{
|
||||||
assert(pimpl);
|
assert(pimpl);
|
||||||
unsigned idx = 0;
|
unsigned idx = 0;
|
||||||
@@ -287,7 +285,7 @@ std::string Song::ShowTime(unsigned length)
|
|||||||
length -= minutes*60;
|
length -= minutes*60;
|
||||||
int seconds = length;
|
int seconds = length;
|
||||||
|
|
||||||
char buf[10];
|
char buf[32];
|
||||||
if (hours > 0)
|
if (hours > 0)
|
||||||
snprintf(buf, sizeof(buf), "%d:%02d:%02d", hours, minutes, seconds);
|
snprintf(buf, sizeof(buf), "%d:%02d:%02d", hours, minutes, seconds);
|
||||||
else
|
else
|
||||||
@@ -307,7 +305,7 @@ bool MPD::Song::isFormatOk(const std::string &type, const std::string &fmt)
|
|||||||
}
|
}
|
||||||
if (braces)
|
if (braces)
|
||||||
{
|
{
|
||||||
std::cerr << type << ": number of opening and closing braces does not equal!\n";
|
std::cerr << type << ": number of opening and closing braces does not equal\n";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ struct Song
|
|||||||
std::string getLength(unsigned idx = 0) const;
|
std::string getLength(unsigned idx = 0) const;
|
||||||
std::string getPriority(unsigned idx = 0) const;
|
std::string getPriority(unsigned idx = 0) const;
|
||||||
|
|
||||||
std::string getTags(GetFunction f, const std::string tag_separator = ", ") const;
|
std::string getTags(GetFunction f, const std::string &tag_separator = ", ") const;
|
||||||
|
|
||||||
unsigned getHash() const;
|
unsigned getHash() const;
|
||||||
unsigned getDuration() const;
|
unsigned getDuration() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user