Commit bb9259eb authored by Jean-Francois Dockes's avatar Jean-Francois Dockes
Browse files

Radio: arrange so that the art for the current track is sent also with...

Radio: arrange so that the art for the current track is sent also with Info::Track, and so that the radio logo replaces the dyn art if the latter cant be retrieved
parent aa9a815c
......@@ -61,12 +61,19 @@ void OHInfo::urimetadata(string& uri, string& metadata)
if (is_song) {
uri = mpds.currentsong.uri;
// Prefer metadata from cache (copy from media server) to
// whatever comes from mpd
if (m_ohpl && m_ohpl->cacheFind(uri, metadata)) {
return;
// If somebody (e.g. ohradio) took care to set the metatext, use it.
// Metatext is reset by OHProduct::setSourceIndex.
if (!m_metatext.empty()) {
metadata = m_metatext;
} else {
// Playlist or AVTransport playing, probably.
// Prefer metadata from cache (copy from media server) to
// whatever comes from mpd.
if (m_ohpl && m_ohpl->cacheFind(uri, metadata)) {
return;
}
metadata = didlmake(mpds.currentsong);
}
metadata = didlmake(mpds.currentsong);
} else {
uri.clear();
metadata.clear();
......@@ -99,7 +106,7 @@ bool OHInfo::makestate(unordered_map<string, string> &st)
m_dev->m_mpds->trackcounter : 0);
st["DetailsCount"] = SoapHelp::i2s(m_dev->m_mpds ?
m_dev->m_mpds->detailscounter : 0);
st["MetatextCount"] = "0";
st["MetatextCount"] = SoapHelp::i2s(m_metatextcnt);
string uri, metadata;
urimetadata(uri, metadata);
st["Uri"] = uri;
......@@ -119,7 +126,7 @@ int OHInfo::counters(const SoapIncoming& sc, SoapOutgoing& data)
m_dev->m_mpds->trackcounter : 0));
data.addarg("DetailsCount", SoapHelp::i2s(m_dev->m_mpds ?
m_dev->m_mpds->detailscounter:0));
data.addarg("MetatextCount", "0");
data.addarg("MetatextCount", SoapHelp::i2s(m_metatextcnt));
return UPNP_E_SUCCESS;
}
......@@ -159,5 +166,8 @@ int OHInfo::metatext(const SoapIncoming& sc, SoapOutgoing& data)
void OHInfo::setMetatext(const string& metatext)
{
//LOGDEB1("OHInfo::setMetatext: " << metatext << endl);
m_metatext = metatext;
if (metatext.compare(m_metatext)) {
m_metatext = metatext;
m_metatextcnt++;
}
}
......@@ -54,6 +54,7 @@ private:
std::string& bitdepth, std::string& samplerate);
std::string m_metatext;
int m_metatextcnt{0};
OHPlaylist *m_ohpl;
};
......
......@@ -213,6 +213,7 @@ bool OHRadio::makestate(unordered_map<string, string>& st)
if (nsong.compare(m_currentsong)) {
m_currentsong = nsong;
string uri;
radio.dynArtUri.clear();
if (ExecCmd::backtick(radio.artScript, uri)) {
trimstring(uri, " \t\r\n");
LOGDEB("OHRadio::makestate: artScript got: [" << uri <<
......@@ -221,7 +222,8 @@ bool OHRadio::makestate(unordered_map<string, string>& st)
}
}
}
mpds.currentsong.artUri = radio.dynArtUri;
mpds.currentsong.artUri = radio.dynArtUri.empty() ? radio.artUri :
radio.dynArtUri;
string meta = didlmake(mpds.currentsong);
st["Metadata"] = meta;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment