|
a/upmpd/upmpdutils.cxx |
|
b/upmpd/upmpdutils.cxx |
|
... |
|
... |
44 |
#include <vector> // for vector
|
44 |
#include <vector> // for vector
|
45 |
|
45 |
|
46 |
#include "libupnpp/log.hxx" // for LOGERR
|
46 |
#include "libupnpp/log.hxx" // for LOGERR
|
47 |
#include "libupnpp/soaphelp.hxx" // for xmlQuote
|
47 |
#include "libupnpp/soaphelp.hxx" // for xmlQuote
|
48 |
#include "libupnpp/upnpavutils.hxx" // for upnpduration
|
48 |
#include "libupnpp/upnpavutils.hxx" // for upnpduration
|
|
|
49 |
#include "libupnpp/control/cdircontent.hxx"
|
49 |
|
50 |
|
50 |
#include "mpdcli.hxx" // for UpSong
|
51 |
#include "mpdcli.hxx" // for UpSong
|
51 |
|
52 |
|
52 |
using namespace std;
|
53 |
using namespace std;
|
53 |
using namespace UPnPP;
|
54 |
using namespace UPnPP;
|
|
|
55 |
using namespace UPnPClient;
|
54 |
|
56 |
|
55 |
// Append system error string to input string
|
57 |
// Append system error string to input string
|
56 |
void catstrerror(string *reason, const char *what, int _errno)
|
58 |
void catstrerror(string *reason, const char *what, int _errno)
|
57 |
{
|
59 |
{
|
58 |
if (!reason)
|
60 |
if (!reason)
|
|
... |
|
... |
393 |
<< "</res>"
|
395 |
<< "</res>"
|
394 |
<< "</item></DIDL-Lite>";
|
396 |
<< "</item></DIDL-Lite>";
|
395 |
return ss.str();
|
397 |
return ss.str();
|
396 |
}
|
398 |
}
|
397 |
|
399 |
|
|
|
400 |
bool uMetaToUpSong(const string& metadata, UpSong *ups)
|
|
|
401 |
{
|
|
|
402 |
if (ups == 0)
|
|
|
403 |
return false;
|
|
|
404 |
|
|
|
405 |
UPnPDirContent dirc;
|
|
|
406 |
if (!dirc.parse(metadata) && dirc.m_items.size() == 0) {
|
|
|
407 |
return false;
|
|
|
408 |
}
|
|
|
409 |
UPnPDirObject& dobj = *dirc.m_items.begin();
|
|
|
410 |
|
|
|
411 |
ups->artist = dobj.f2s("upnp:artist", false);
|
|
|
412 |
ups->album = dobj.f2s("upnp:album", false);
|
|
|
413 |
ups->title = dobj.m_title;
|
|
|
414 |
string stmp = dobj.f2s("duration", true);
|
|
|
415 |
if (!stmp.empty()) {
|
|
|
416 |
ups->duration_secs = upnpdurationtos(stmp);
|
|
|
417 |
} else {
|
|
|
418 |
ups->duration_secs = 0;
|
|
|
419 |
}
|
|
|
420 |
ups->tracknum = dobj.f2s("upnp:originalTrackNumber", false);
|
|
|
421 |
return true;
|
|
|
422 |
}
|
|
|
423 |
|
398 |
// Substitute regular expression
|
424 |
// Substitute regular expression
|
399 |
// The c++11 regex package does not seem really ready from prime time
|
425 |
// The c++11 regex package does not seem really ready from prime time
|
400 |
// (Tried on gcc + libstdc++ 4.7.2-5 on Debian, with little
|
426 |
// (Tried on gcc + libstdc++ 4.7.2-5 on Debian, with little
|
401 |
// joy). So...:
|
427 |
// joy). So...:
|
402 |
string regsub1(const string& sexp, const string& input, const string& repl)
|
428 |
string regsub1(const string& sexp, const string& input, const string& repl)
|