|
a/upmpd/avtransport.cxx |
|
b/upmpd/avtransport.cxx |
|
... |
|
... |
166 |
status["TransportState"] = tstate;
|
166 |
status["TransportState"] = tstate;
|
167 |
status["CurrentTransportActions"] = tactions;
|
167 |
status["CurrentTransportActions"] = tactions;
|
168 |
status["TransportStatus"] = m_dev->m_mpdcli->ok() ? "OK" : "ERROR_OCCURRED";
|
168 |
status["TransportStatus"] = m_dev->m_mpdcli->ok() ? "OK" : "ERROR_OCCURRED";
|
169 |
status["TransportPlaySpeed"] = "1";
|
169 |
status["TransportPlaySpeed"] = "1";
|
170 |
|
170 |
|
171 |
const string& uri = mapget(mpds.currentsong, "uri");
|
171 |
const string& uri = mpds.currentsong.uri;
|
172 |
status["CurrentTrack"] = "1";
|
172 |
status["CurrentTrack"] = "1";
|
173 |
status["CurrentTrackURI"] = uri;
|
173 |
status["CurrentTrackURI"] = uri;
|
174 |
|
174 |
|
175 |
// If we own the queue, just use the metadata from the content directory.
|
175 |
// If we own the queue, just use the metadata from the content directory.
|
176 |
// else, try to make up something from mpd status.
|
176 |
// else, try to make up something from mpd status.
|
177 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
177 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
178 |
status["CurrentTrackMetaData"] = is_song ? m_curMetadata : "";
|
178 |
status["CurrentTrackMetaData"] = is_song ? m_curMetadata : "";
|
179 |
} else {
|
179 |
} else {
|
180 |
status["CurrentTrackMetaData"] = is_song ? didlmake(mpds) : "";
|
180 |
status["CurrentTrackMetaData"] = is_song ?
|
|
|
181 |
didlmake(mpds.currentsong) : "";
|
181 |
}
|
182 |
}
|
182 |
|
183 |
|
183 |
string playmedium("NONE");
|
184 |
string playmedium("NONE");
|
184 |
if (is_song)
|
185 |
if (is_song)
|
185 |
playmedium = uri.find("http://") == 0 ? "HDD" : "NETWORK";
|
186 |
playmedium = uri.find("http://") == 0 ? "HDD" : "NETWORK";
|
|
... |
|
... |
190 |
upnpduration(mpds.songlenms):"00:00:00";
|
191 |
upnpduration(mpds.songlenms):"00:00:00";
|
191 |
status["AVTransportURI"] = uri;
|
192 |
status["AVTransportURI"] = uri;
|
192 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
193 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
193 |
status["AVTransportURIMetaData"] = is_song ? m_curMetadata : "";
|
194 |
status["AVTransportURIMetaData"] = is_song ? m_curMetadata : "";
|
194 |
} else {
|
195 |
} else {
|
195 |
status["AVTransportURIMetaData"] = is_song ? didlmake(mpds) : "";
|
196 |
status["AVTransportURIMetaData"] = is_song ?
|
|
|
197 |
didlmake(mpds.currentsong) : "";
|
196 |
}
|
198 |
}
|
197 |
status["RelativeTimePosition"] = is_song?
|
199 |
status["RelativeTimePosition"] = is_song?
|
198 |
upnpduration(mpds.songelapsedms):"0:00:00";
|
200 |
upnpduration(mpds.songelapsedms):"0:00:00";
|
199 |
status["AbsoluteTimePosition"] = is_song?
|
201 |
status["AbsoluteTimePosition"] = is_song?
|
200 |
upnpduration(mpds.songelapsedms) : "0:00:00";
|
202 |
upnpduration(mpds.songelapsedms) : "0:00:00";
|
201 |
|
203 |
|
202 |
status["NextAVTransportURI"] = mapget(mpds.nextsong, "uri");
|
204 |
status["NextAVTransportURI"] = mpds.nextsong.uri;
|
203 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
205 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
204 |
status["NextAVTransportURIMetaData"] = is_song ? m_nextMetadata : "";
|
206 |
status["NextAVTransportURIMetaData"] = is_song ? m_nextMetadata : "";
|
205 |
} else {
|
207 |
} else {
|
206 |
status["NextAVTransportURIMetaData"] = is_song?didlmake(mpds, true) :"";
|
208 |
status["NextAVTransportURIMetaData"] = is_song ?
|
|
|
209 |
didlmake(mpds.nextsong) : "";
|
207 |
}
|
210 |
}
|
208 |
|
211 |
|
209 |
status["PlaybackStorageMedium"] = playmedium;
|
212 |
status["PlaybackStorageMedium"] = playmedium;
|
210 |
status["PossiblePlaybackStorageMedium"] = "HDD,NETWORK";
|
213 |
status["PossiblePlaybackStorageMedium"] = "HDD,NETWORK";
|
211 |
status["RecordStorageMedium"] = "NOT_IMPLEMENTED";
|
214 |
status["RecordStorageMedium"] = "NOT_IMPLEMENTED";
|
|
... |
|
... |
393 |
|
396 |
|
394 |
if (is_song) {
|
397 |
if (is_song) {
|
395 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
398 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
396 |
data.addarg("TrackMetaData", m_curMetadata);
|
399 |
data.addarg("TrackMetaData", m_curMetadata);
|
397 |
} else {
|
400 |
} else {
|
398 |
data.addarg("TrackMetaData", didlmake(mpds));
|
401 |
data.addarg("TrackMetaData", didlmake(mpds.currentsong));
|
399 |
}
|
402 |
}
|
400 |
} else {
|
403 |
} else {
|
401 |
data.addarg("TrackMetaData", "");
|
404 |
data.addarg("TrackMetaData", "");
|
402 |
}
|
405 |
}
|
403 |
|
406 |
|
404 |
const string& uri = mapget(mpds.currentsong, "uri");
|
407 |
const string& uri = mpds.currentsong.uri;
|
405 |
if (is_song && !uri.empty()) {
|
408 |
if (is_song && !uri.empty()) {
|
406 |
data.addarg("TrackURI", xmlquote(uri));
|
409 |
data.addarg("TrackURI", xmlquote(uri));
|
407 |
} else {
|
410 |
} else {
|
408 |
data.addarg("TrackURI", "");
|
411 |
data.addarg("TrackURI", "");
|
409 |
}
|
412 |
}
|
|
... |
|
... |
463 |
data.addarg("MediaDuration", upnpduration(mpds.songlenms));
|
466 |
data.addarg("MediaDuration", upnpduration(mpds.songlenms));
|
464 |
} else {
|
467 |
} else {
|
465 |
data.addarg("MediaDuration", "00:00:00");
|
468 |
data.addarg("MediaDuration", "00:00:00");
|
466 |
}
|
469 |
}
|
467 |
|
470 |
|
468 |
const string& thisuri = mapget(mpds.currentsong, "uri");
|
471 |
const string& thisuri = mpds.currentsong.uri;
|
469 |
if (is_song && !thisuri.empty()) {
|
472 |
if (is_song && !thisuri.empty()) {
|
470 |
data.addarg("CurrentURI", xmlquote(thisuri));
|
473 |
data.addarg("CurrentURI", xmlquote(thisuri));
|
471 |
} else {
|
474 |
} else {
|
472 |
data.addarg("CurrentURI", "");
|
475 |
data.addarg("CurrentURI", "");
|
473 |
}
|
476 |
}
|
474 |
if (is_song) {
|
477 |
if (is_song) {
|
475 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
478 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
476 |
data.addarg("CurrentURIMetaData", m_curMetadata);
|
479 |
data.addarg("CurrentURIMetaData", m_curMetadata);
|
477 |
} else {
|
480 |
} else {
|
478 |
data.addarg("CurrentURIMetaData", didlmake(mpds));
|
481 |
data.addarg("CurrentURIMetaData", didlmake(mpds.currentsong));
|
479 |
}
|
482 |
}
|
480 |
} else {
|
483 |
} else {
|
481 |
data.addarg("CurrentURIMetaData", "");
|
484 |
data.addarg("CurrentURIMetaData", "");
|
482 |
}
|
485 |
}
|
483 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
486 |
if ((m_dev->m_options & UpMpd::upmpdOwnQueue)) {
|
484 |
data.addarg("NextURI", m_nextUri);
|
487 |
data.addarg("NextURI", m_nextUri);
|
485 |
data.addarg("NextURIMetaData", is_song ? m_nextMetadata : "");
|
488 |
data.addarg("NextURIMetaData", is_song ? m_nextMetadata : "");
|
486 |
} else {
|
489 |
} else {
|
487 |
data.addarg("NextURI", mapget(mpds.nextsong, "uri"));
|
490 |
data.addarg("NextURI", mpds.nextsong.uri);
|
488 |
data.addarg("NextURIMetaData", is_song ? didlmake(mpds, true) : "");
|
491 |
data.addarg("NextURIMetaData", is_song ? didlmake(mpds.nextsong) : "");
|
489 |
}
|
492 |
}
|
490 |
string playmedium("NONE");
|
493 |
string playmedium("NONE");
|
491 |
if (is_song)
|
494 |
if (is_song)
|
492 |
playmedium = thisuri.find("http://") == 0 ? "HDD" : "NETWORK";
|
495 |
playmedium = thisuri.find("http://") == 0 ? "HDD" : "NETWORK";
|
493 |
data.addarg("PlayMedium", playmedium);
|
496 |
data.addarg("PlayMedium", playmedium);
|