aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp/ContentDirectoryService.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-18 15:27:54 +0100
committerMax Kellermann <max@duempel.org>2014-01-18 15:27:54 +0100
commitf33f891c54b22233083e82e3743af5ca74a85128 (patch)
tree6834f7a77a892ccd3ece883cfb6c4aac4ae8f3ee /src/db/upnp/ContentDirectoryService.cxx
parent6e55552292d4832bcefeee78346d121caf3715a1 (diff)
downloadmpd-f33f891c54b22233083e82e3743af5ca74a85128.tar.gz
mpd-f33f891c54b22233083e82e3743af5ca74a85128.tar.xz
mpd-f33f891c54b22233083e82e3743af5ca74a85128.zip
db/upnp: add UpnpMakeAction() helper function
Diffstat (limited to 'src/db/upnp/ContentDirectoryService.cxx')
-rw-r--r--src/db/upnp/ContentDirectoryService.cxx52
1 files changed, 22 insertions, 30 deletions
diff --git a/src/db/upnp/ContentDirectoryService.cxx b/src/db/upnp/ContentDirectoryService.cxx
index 9349c1163..aea8144bf 100644
--- a/src/db/upnp/ContentDirectoryService.cxx
+++ b/src/db/upnp/ContentDirectoryService.cxx
@@ -24,12 +24,11 @@
#include "ixmlwrap.hxx"
#include "Directory.hxx"
#include "Util.hxx"
+#include "Action.hxx"
#include "util/Error.hxx"
#include <stdio.h>
-#include <upnp/upnptools.h>
-
ContentDirectoryService::ContentDirectoryService(const UPnPDevice &device,
const UPnPService &service)
:m_actionURL(caturl(device.URLBase, service.controlURL)),
@@ -80,17 +79,15 @@ ContentDirectoryService::readDirSlice(UpnpClient_Handle hdl,
char ofbuf[100], cntbuf[100];
sprintf(ofbuf, "%d", offset);
sprintf(cntbuf, "%d", count);
- int argcnt = 6;
// Some devices require an empty SortCriteria, else bad params
IXML_Document *request =
- UpnpMakeAction("Browse", m_serviceType.c_str(), argcnt,
- "ObjectID", objectId,
- "BrowseFlag", "BrowseDirectChildren",
- "Filter", "*",
- "SortCriteria", "",
- "StartingIndex", ofbuf,
- "RequestedCount", cntbuf,
- nullptr, nullptr);
+ MakeActionHelper("Browse", m_serviceType.c_str(),
+ "ObjectID", objectId,
+ "BrowseFlag", "BrowseDirectChildren",
+ "Filter", "*",
+ "SortCriteria", "",
+ "StartingIndex", ofbuf,
+ "RequestedCount", cntbuf);
if (request == nullptr) {
error.Set(upnp_domain, "UpnpMakeAction() failed");
return false;
@@ -165,18 +162,15 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
while (offset < total) {
char ofbuf[100];
sprintf(ofbuf, "%d", offset);
- // Create request
- int argcnt = 6;
IXML_Document *request =
- UpnpMakeAction("Search", m_serviceType.c_str(), argcnt,
- "ContainerID", objectId,
- "SearchCriteria", ss,
- "Filter", "*",
- "SortCriteria", "",
- "StartingIndex", ofbuf,
- "RequestedCount", "0", // Setting a value here gets twonky into fits
- nullptr, nullptr);
+ MakeActionHelper("Search", m_serviceType.c_str(),
+ "ContainerID", objectId,
+ "SearchCriteria", ss,
+ "Filter", "*",
+ "SortCriteria", "",
+ "StartingIndex", ofbuf,
+ "RequestedCount", "0"); // Setting a value here gets twonky into fits
if (request == 0) {
error.Set(upnp_domain, "UpnpMakeAction() failed");
return false;
@@ -270,16 +264,14 @@ ContentDirectoryService::getMetadata(UpnpClient_Handle hdl,
Error &error)
{
// Create request
- int argcnt = 6;
IXML_Document *request =
- UpnpMakeAction("Browse", m_serviceType.c_str(), argcnt,
- "ObjectID", objectId,
- "BrowseFlag", "BrowseMetadata",
- "Filter", "*",
- "SortCriteria", "",
- "StartingIndex", "0",
- "RequestedCount", "1",
- nullptr, nullptr);
+ MakeActionHelper("Browse", m_serviceType.c_str(),
+ "ObjectID", objectId,
+ "BrowseFlag", "BrowseMetadata",
+ "Filter", "*",
+ "SortCriteria", "",
+ "StartingIndex", "0",
+ "RequestedCount", "1");
if (request == nullptr) {
error.Set(upnp_domain, "UpnpMakeAction() failed");
return false;