Switch to unified view

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)                    \
127
  if (!FLD.empty()) {                    \
128
      ss << "<" #TAG ">" << SoapHelp::xmlQuote(FLD) <<   \
129
      "</" #TAG ">";                     \
130
  }
131
126
string UpSong::didl()
132
string UpSong::didl()
127
{
133
{
128
    ostringstream ss;
134
    ostringstream ss;
129
    string typetag;
135
    string typetag;
130
    if (iscontainer) {
136
    if (iscontainer) {
...
...
136
    parentid << "\" restricted=\"1\" searchable=\"" <<
142
    parentid << "\" restricted=\"1\" searchable=\"" <<
137
    (searchable ? string("1") : string("0")) << "\">" <<
143
    (searchable ? string("1") : string("0")) << "\">" <<
138
    "<dc:title>" << SoapHelp::xmlQuote(title) << "</dc:title>";
144
    "<dc:title>" << SoapHelp::xmlQuote(title) << "</dc:title>";
139
    if (iscontainer) {
145
    if (iscontainer) {
140
    ss << "<upnp:class>object.container</upnp:class>" <<
146
    ss << "<upnp:class>object.container</upnp:class>" <<
141
        (artist.empty() ? string() :
147
        (tracknum.empty() ? string() :
142
         string("<upnp:userAnnotation>" + SoapHelp::xmlQuote(artist) +
148
         string("<upnp:userAnnotation>" + SoapHelp::xmlQuote(tracknum) +
143
            "</upnp:userAnnotation>"));
149
            "</upnp:userAnnotation>"));
144
        
150
        
145
    } else {
151
    } else {
146
    ss << "<upnp:class>object.item.audioItem.musicTrack</upnp:class>";
152
    ss << "<upnp:class>object.item.audioItem.musicTrack</upnp:class>";
147
153
148
#define UPNPXML(FLD, TAG)                    \
149
  if (!FLD.empty()) {                    \
150
      ss << "<" #TAG ">" << SoapHelp::xmlQuote(FLD) <<   \
151
      "</" #TAG ">";                     \
152
  }
153
154
  UPNPXML(artist, dc:creator);
155
  UPNPXML(artist, upnp:artist);
156
    UPNPXML(genre, upnp:genre);
154
    UPNPXML(genre, upnp:genre);
157
    UPNPXML(tracknum, upnp:originalTrackNumber);
155
    UPNPXML(tracknum, upnp:originalTrackNumber);
158
  UPNPXML(artUri, upnp:albumArtURI);
159
156
160
    ss << "<res " << "duration=\"" <<
157
    ss << "<res " << "duration=\"" <<
161
        upnpduration(duration_secs * 1000)  << "\" " <<
158
        upnpduration(duration_secs * 1000)  << "\" " <<
162
        "sampleFrequency=\"44100\" audioChannels=\"2\" " <<
159
        "sampleFrequency=\"44100\" audioChannels=\"2\" " <<
163
        "protocolInfo=\"http-get:*:audio/mpeg:*\">" <<
160
        "protocolInfo=\"http-get:*:audio/mpeg:*\">" <<
164
        SoapHelp::xmlQuote(uri) <<
161
        SoapHelp::xmlQuote(uri) <<
165
        "</res>";
162
        "</res>";
166
    }
163
    }
164
    UPNPXML(artist, dc:creator);
165
    UPNPXML(artist, upnp:artist);
166
    UPNPXML(artUri, upnp:albumArtURI);
167
    ss << "</" << typetag << ">";
167
    ss << "</" << typetag << ">";
168
    return ss.str();
168
    return ss.str();
169
}
169
}
170
170
171
const string& headDIDL()
171
const string& headDIDL()