18#ifndef _UPNPDIRCONTENT_H_X_INCLUDED_
19#define _UPNPDIRCONTENT_H_X_INCLUDED_
28#include "libupnpp/upnpavutils.hxx"
43 std::map<std::string, std::string>
m_props;
47 const auto it = m_props.find(
"protocolInfo");
48 if (it == m_props.end()) {
51 return UPnPP::parseProtoInfEntry(it->second, e);
66 enum ObjType {objtnone = -1, item, container};
72 enum ItemClass {ITC_audioItem = 0, ITC_playlist = 1,
75 ITC_audioItem_musicTrack = ITC_audioItem,
76 ITC_audioItem_playlist = ITC_playlist
102 std::multimap<std::string, std::string>
m_props;
118 bool getprop(
const std::string& name, std::string& value)
const;
125 const std::string getprop(
const std::string& name)
const;
128 const std::string& getupropref(
const std::string& name)
const;
133 bool getRoledArtists(std::vector<std::pair<std::string, std::string>>& out)
const;
135 std::string getAlbumArtist()
const;
138 std::string getArtists()
const;
140 std::string getAlbumArtistElseArtists()
const;
150 bool getrprop(
unsigned int ridx,
const std::string& nm, std::string& val)
const {
151 if (ridx >= m_resources.size())
153 const auto it = m_resources[ridx].m_props.find(nm);
154 if (it == m_resources[ridx].m_props.end())
163 std::string
f2s(
const std::string& nm,
bool isresfield) {
166 getrprop(0, nm, val);
179 if (!getrprop(ridx,
"duration", sdur)) {
183 return UPnPP::upnpdurationtos(sdur);
191 std::string getdidl()
const;
198 m_iclass = ITC_unknown;
204 std::string dump()
const {
205 std::ostringstream os;
206 os <<
"UPnPDirObject: " << (m_type == item ?
"item" :
"container") <<
" id [" << m_id <<
207 "] pid [" << m_pid <<
"] title [" << m_title <<
"]" <<
'\n';
208 os <<
"Properties: " <<
'\n';
209 for (
const auto& m_prop : m_props) {
210 os <<
"[" << m_prop.first <<
"]->[" << m_prop.second <<
"] " <<
'\n';
212 os <<
"Resources:" <<
'\n';
213 for (
const auto& m_resource : m_resources) {
214 os <<
" Uri [" << m_resource.m_uri <<
"]" <<
'\n';
215 os <<
" Resource attributes:" <<
'\n';
216 for (
const auto& m_prop : m_resource.m_props) {
217 os <<
" [" << m_prop.first <<
"]->[" << m_prop.second <<
"] " <<
'\n';
225 friend class UPnPDirParser;
227 std::string m_didlfrag;
228 static std::string nullstr;
241 std::vector<UPnPDirObject> m_containers;
242 std::vector<UPnPDirObject> m_items;
245 m_containers.clear();
261 bool parse(
const std::string& didltext);
Image of a MediaServer Directory Service container (directory), possibly containing items and subordi...
Definition cdircontent.hxx:239
UPnP Media Server directory entry, converted from XML data.
Definition cdircontent.hxx:60
std::vector< UPnPResource > m_resources
Resources: there may be several, for example for different audio formats of the same track,...
Definition cdircontent.hxx:106
std::string m_id
Object Id.
Definition cdircontent.hxx:83
std::string m_title
Value of dc:title.
Definition cdircontent.hxx:87
bool getrprop(unsigned int ridx, const std::string &nm, std::string &val) const
Get named resource attribute.
Definition cdircontent.hxx:150
std::string f2s(const std::string &nm, bool isresfield)
Simplified interface to retrieving values: we don't distinguish between non-existing and empty,...
Definition cdircontent.hxx:163
std::string m_pid
Parent Object Id.
Definition cdircontent.hxx:85
int getDurationSeconds(unsigned ridx=0) const
Return resource duration in seconds.
Definition cdircontent.hxx:177
ItemClass m_iclass
Item type details.
Definition cdircontent.hxx:91
std::multimap< std::string, std::string > m_props
Storage for the properties.
Definition cdircontent.hxx:102
ObjType m_type
Item or container.
Definition cdircontent.hxx:89
UPnP resource.
Definition cdircontent.hxx:37
std::map< std::string, std::string > m_props
Resource attributes.
Definition cdircontent.hxx:43
std::string m_uri
URI Value.
Definition cdircontent.hxx:40
bool protoInfo(UPnPP::ProtocolinfoEntry &e) const
Get the protocolinfo attribute in cooked form.
Definition cdircontent.hxx:46
UPnP Description phase: interpreting the device description which we downloaded from the URL obtained...
Definition avlastchg.cxx:28
Decoded protocolinfo entry data.
Definition upnpavutils.hxx:39