|
a/src/upmpdutils.cxx |
|
b/src/upmpdutils.cxx |
|
... |
|
... |
121 |
}
|
121 |
}
|
122 |
return out;
|
122 |
return out;
|
123 |
}
|
123 |
}
|
124 |
|
124 |
|
125 |
|
125 |
|
126 |
#define UPNPXML(FLD, TAG) \
|
126 |
#define UPNPXML(FLD, TAG) \
|
127 |
if (!FLD.empty()) { \
|
127 |
if (!FLD.empty()) { \
|
128 |
ss << "<" #TAG ">" << SoapHelp::xmlQuote(FLD) << \
|
128 |
ss << "<" #TAG ">" << SoapHelp::xmlQuote(FLD) << "</" #TAG ">"; \
|
129 |
"</" #TAG ">"; \
|
129 |
}
|
130 |
}
|
130 |
#define UPNPXMLD(FLD, TAG, DEF) \
|
|
|
131 |
if (!FLD.empty()) { \
|
|
|
132 |
ss << "<" #TAG ">" << SoapHelp::xmlQuote(FLD) << "</" #TAG ">"; \
|
|
|
133 |
} else { \
|
|
|
134 |
ss << "<" #TAG ">" << SoapHelp::xmlQuote(DEF) << "</" #TAG ">"; \
|
|
|
135 |
}
|
131 |
|
136 |
|
132 |
string UpSong::didl()
|
137 |
string UpSong::didl()
|
133 |
{
|
138 |
{
|
134 |
ostringstream ss;
|
139 |
ostringstream ss;
|
135 |
string typetag;
|
140 |
string typetag;
|
|
... |
|
... |
140 |
}
|
145 |
}
|
141 |
ss << "<" << typetag << " id=\"" << id << "\" parentID=\"" <<
|
146 |
ss << "<" << typetag << " id=\"" << id << "\" parentID=\"" <<
|
142 |
parentid << "\" restricted=\"1\" searchable=\"" <<
|
147 |
parentid << "\" restricted=\"1\" searchable=\"" <<
|
143 |
(searchable ? string("1") : string("0")) << "\">" <<
|
148 |
(searchable ? string("1") : string("0")) << "\">" <<
|
144 |
"<dc:title>" << SoapHelp::xmlQuote(title) << "</dc:title>";
|
149 |
"<dc:title>" << SoapHelp::xmlQuote(title) << "</dc:title>";
|
|
|
150 |
|
145 |
if (iscontainer) {
|
151 |
if (iscontainer) {
|
146 |
ss << "<upnp:class>object.container</upnp:class>" <<
|
152 |
UPNPXMLD(upnpClass, upnp:class, "object.container");
|
|
|
153 |
// tracknum is reused for annotations for containers
|
147 |
(tracknum.empty() ? string() :
|
154 |
ss << (tracknum.empty() ? string() :
|
148 |
string("<upnp:userAnnotation>" + SoapHelp::xmlQuote(tracknum) +
|
155 |
string("<upnp:userAnnotation>" + SoapHelp::xmlQuote(tracknum) +
|
149 |
"</upnp:userAnnotation>"));
|
156 |
"</upnp:userAnnotation>"));
|
150 |
|
157 |
|
151 |
} else {
|
158 |
} else {
|
152 |
ss << "<upnp:class>object.item.audioItem.musicTrack</upnp:class>";
|
159 |
UPNPXMLD(upnpClass, upnp:class, "object.item.audioItem.musicTrack");
|
153 |
|
|
|
154 |
UPNPXML(genre, upnp:genre);
|
160 |
UPNPXML(genre, upnp:genre);
|
155 |
UPNPXML(tracknum, upnp:originalTrackNumber);
|
161 |
UPNPXML(tracknum, upnp:originalTrackNumber);
|
156 |
|
162 |
|
157 |
ss << "<res " << "duration=\"" <<
|
163 |
string sfs = SoapHelp::i2s((samplefreq == 0 ? 44100 : samplefreq));
|
|
|
164 |
string lmime((mime.empty() ? "audio/mpeg" : mime));
|
|
|
165 |
|
|
|
166 |
ss << "<res " <<
|
158 |
upnpduration(duration_secs * 1000) << "\" " <<
|
167 |
"duration=\"" << upnpduration(duration_secs * 1000) << "\" " <<
|
159 |
"sampleFrequency=\"44100\" audioChannels=\"2\" " <<
|
168 |
"sampleFrequency=\"" << sfs << "\" " <<
|
|
|
169 |
"audioChannels=\"2\" " <<
|
160 |
"protocolInfo=\"http-get:*:audio/mpeg:*\">" <<
|
170 |
"protocolInfo=\"http-get:*:" << lmime << ":*\"" << ">" <<
|
161 |
SoapHelp::xmlQuote(uri) <<
|
171 |
SoapHelp::xmlQuote(uri) <<
|
162 |
"</res>";
|
172 |
"</res>";
|
163 |
}
|
173 |
}
|
164 |
UPNPXML(artist, dc:creator);
|
174 |
UPNPXML(artist, dc:creator);
|
165 |
UPNPXML(artist, upnp:artist);
|
175 |
UPNPXML(artist, upnp:artist);
|
166 |
UPNPXML(artUri, upnp:albumArtURI);
|
176 |
UPNPXML(artUri, upnp:albumArtURI);
|
167 |
ss << "</" << typetag << ">";
|
177 |
ss << "</" << typetag << ">";
|