|
a/src/upmpd.cxx |
|
b/src/upmpd.cxx |
|
... |
|
... |
18 |
#include "upmpd.hxx"
|
18 |
#include "upmpd.hxx"
|
19 |
|
19 |
|
20 |
#include "libupnpp/device/device.hxx" // for UpnpDevice, UpnpService
|
20 |
#include "libupnpp/device/device.hxx" // for UpnpDevice, UpnpService
|
21 |
#include "libupnpp/log.hxx" // for LOGFAT, LOGERR, Logger, etc
|
21 |
#include "libupnpp/log.hxx" // for LOGFAT, LOGERR, Logger, etc
|
22 |
#include "libupnpp/upnpplib.hxx" // for LibUPnP
|
22 |
#include "libupnpp/upnpplib.hxx" // for LibUPnP
|
|
|
23 |
#include "libupnpp/control/cdircontent.hxx"
|
23 |
|
24 |
|
|
|
25 |
#include "smallut.h"
|
24 |
#include "avtransport.hxx"
|
26 |
#include "avtransport.hxx"
|
25 |
#include "conman.hxx"
|
27 |
#include "conman.hxx"
|
26 |
#include "mpdcli.hxx"
|
28 |
#include "mpdcli.hxx"
|
27 |
#include "ohinfo.hxx"
|
29 |
#include "ohinfo.hxx"
|
28 |
#include "ohplaylist.hxx"
|
30 |
#include "ohplaylist.hxx"
|
|
... |
|
... |
143 |
const MpdStatus& UpMpd::getMpdStatus()
|
145 |
const MpdStatus& UpMpd::getMpdStatus()
|
144 |
{
|
146 |
{
|
145 |
m_mpds = &m_mpdcli->getStatus();
|
147 |
m_mpds = &m_mpdcli->getStatus();
|
146 |
return *m_mpds;
|
148 |
return *m_mpds;
|
147 |
}
|
149 |
}
|
|
|
150 |
|
|
|
151 |
bool UpMpd::checkContentFormat(const string& uri, const string& didl,
|
|
|
152 |
UpSong *ups)
|
|
|
153 |
{
|
|
|
154 |
UPnPClient::UPnPDirContent dirc;
|
|
|
155 |
if (!dirc.parse(didl) || dirc.m_items.size() == 0) {
|
|
|
156 |
LOGERR("checkContentFormat: didl parse failed\n");
|
|
|
157 |
return false;
|
|
|
158 |
}
|
|
|
159 |
UPnPClient::UPnPDirObject& dobj = *dirc.m_items.begin();
|
|
|
160 |
|
|
|
161 |
if ((m_options & upmpdNoContentFormatCheck)) {
|
|
|
162 |
LOGERR("checkContentFormat: format check disabled\n");
|
|
|
163 |
return dirObjToUpSong(dobj, ups);
|
|
|
164 |
}
|
|
|
165 |
|
|
|
166 |
for (vector<UPnPClient::UPnPResource>::const_iterator it =
|
|
|
167 |
dobj.m_resources.begin(); it != dobj.m_resources.end(); it++) {
|
|
|
168 |
if (!it->m_uri.compare(uri)) {
|
|
|
169 |
string cf = stringtolower(resourceContentFormat(*it));
|
|
|
170 |
if (g_supportedFormats.find(cf) == g_supportedFormats.end()) {
|
|
|
171 |
LOGERR("checkContentFormat: unsupported:: " << cf << endl);
|
|
|
172 |
return false;
|
|
|
173 |
} else {
|
|
|
174 |
LOGDEB("checkContentFormat: supported: " << cf << endl);
|
|
|
175 |
if (ups) {
|
|
|
176 |
return dirObjToUpSong(dobj, ups);
|
|
|
177 |
} else {
|
|
|
178 |
return true;
|
|
|
179 |
}
|
|
|
180 |
}
|
|
|
181 |
}
|
|
|
182 |
}
|
|
|
183 |
LOGERR("checkContentFormat: uri not found in metadata resource list\n");
|
|
|
184 |
return false;
|
|
|
185 |
}
|