TuneIn browsing does now work
parent
811349c444
commit
6dce9a2ad6
|
|
@ -790,11 +790,16 @@ void Heos::readData()
|
||||||
MediaObject media;
|
MediaObject media;
|
||||||
qDebug(dcDenon()) << "Media Item" << payloadEntryVariant.toMap().value("mid").toString() << payloadEntryVariant.toMap().value("cid").toString();
|
qDebug(dcDenon()) << "Media Item" << payloadEntryVariant.toMap().value("mid").toString() << payloadEntryVariant.toMap().value("cid").toString();
|
||||||
media.name = payloadEntryVariant.toMap().value("name").toString();
|
media.name = payloadEntryVariant.toMap().value("name").toString();
|
||||||
media.containerId = payloadEntryVariant.toMap().value("cid").toString();
|
if (payloadEntryVariant.toMap().contains("cid")) {
|
||||||
|
media.containerId = payloadEntryVariant.toMap().value("cid").toString();
|
||||||
|
} else {
|
||||||
|
media.containerId = message.queryItemValue("cid");
|
||||||
|
}
|
||||||
media.mediaId = payloadEntryVariant.toMap().value("mid").toString();
|
media.mediaId = payloadEntryVariant.toMap().value("mid").toString();
|
||||||
media.imageUrl = payloadEntryVariant.toMap().value("image_url").toString();
|
media.imageUrl = payloadEntryVariant.toMap().value("image_url").toString();
|
||||||
media.isPlayable = payloadEntryVariant.toMap().value("playable").toString().contains("yes");
|
media.isPlayable = payloadEntryVariant.toMap().value("playable").toString().contains("yes");
|
||||||
media.isContainer = payloadEntryVariant.toMap().value("container").toString().contains("yes");
|
media.isContainer = payloadEntryVariant.toMap().value("container").toString().contains("yes");
|
||||||
|
media.sourceId = sourceId;
|
||||||
if (type == "artist") {
|
if (type == "artist") {
|
||||||
media.mediaType = MEDIA_TYPE_ARTIST;
|
media.mediaType = MEDIA_TYPE_ARTIST;
|
||||||
} else if (type == "song") {
|
} else if (type == "song") {
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,7 @@ struct MediaObject {
|
||||||
QString name;
|
QString name;
|
||||||
QString imageUrl;
|
QString imageUrl;
|
||||||
QString containerId;
|
QString containerId;
|
||||||
|
QString sourceId;
|
||||||
QString mediaId;
|
QString mediaId;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -829,6 +829,7 @@ void IntegrationPluginDenon::onHeosBrowseRequestReceived(QList<MusicSourceObject
|
||||||
item.setExecutable(media.isPlayable);
|
item.setExecutable(media.isPlayable);
|
||||||
item.setBrowsable(media.isContainer);
|
item.setBrowsable(media.isContainer);
|
||||||
//item.setActionTypeIds();
|
//item.setActionTypeIds();
|
||||||
|
m_mediaObjects.insert(item.id(), media);
|
||||||
result->addItem(item);
|
result->addItem(item);
|
||||||
}
|
}
|
||||||
foreach(MusicSourceObject source, musicSources) {
|
foreach(MusicSourceObject source, musicSources) {
|
||||||
|
|
@ -904,23 +905,27 @@ void IntegrationPluginDenon::browseDevice(BrowseResult *result)
|
||||||
qDebug(dcDenon()) << "Browse source";
|
qDebug(dcDenon()) << "Browse source";
|
||||||
heos->getMusicSources();
|
heos->getMusicSources();
|
||||||
m_pendingGetSourcesRequest.insert(heos, result);
|
m_pendingGetSourcesRequest.insert(heos, result);
|
||||||
//connect(result, &QObject::destroyed, this, [this, result->itemId()](){ m_pendingBrowseResult.remove(result->itemId());});
|
connect(result, &QObject::destroyed, this, [this, heos](){m_pendingGetSourcesRequest.remove(heos);});
|
||||||
|
|
||||||
} else if (result->itemId().startsWith("source=")){
|
} else if (result->itemId().startsWith("source=")){
|
||||||
qDebug(dcDenon()) << "Browse source" << result->itemId();
|
qDebug(dcDenon()) << "Browse source" << result->itemId();
|
||||||
QString id = result->itemId().remove("source=");
|
QString id = result->itemId().remove("source=");
|
||||||
heos->browseSource(id);
|
heos->browseSource(id);
|
||||||
m_pendingBrowseResult.insert(id, result);
|
m_pendingBrowseResult.insert(id, result);
|
||||||
//connect(result, &QObject::destroyed, this, [this, result->itemId()](){ m_pendingBrowseResult.remove(result->itemId());});
|
//connect(result, &QObject::destroyed, this, [this, result->itemId()](){ m_pendingBrowseResult.remove(result->itemId());});
|
||||||
|
|
||||||
} else if (result->itemId().startsWith("container=")){
|
} else if (result->itemId().startsWith("container=")){
|
||||||
qDebug(dcDenon()) << "Browse container" << result->itemId();
|
qDebug(dcDenon()) << "Browse container" << result->itemId();
|
||||||
QStringList values = result->itemId().split("&");
|
QStringList values = result->itemId().split("&");
|
||||||
if (values.length() == 2) {
|
if (values.length() == 2) {
|
||||||
QString id = values[0].remove("container=");
|
QString id = values[0].remove("container=");
|
||||||
heos->browseSourceContainers(values[1], id);
|
heos->browseSourceContainers(values[1], id);
|
||||||
|
// URL encoding is needed because some container ids are a URL and their encoding varies.
|
||||||
if (QUrl(id).isValid()) {
|
if (QUrl(id).isValid()) {
|
||||||
id = QUrl::fromPercentEncoding(id.toUtf8());
|
id = QUrl::fromPercentEncoding(id.toUtf8());
|
||||||
}
|
}
|
||||||
m_pendingBrowseResult.insert(id, result);
|
m_pendingBrowseResult.insert(id, result);
|
||||||
|
connect(result, &QObject::destroyed, this, [this, id](){ m_pendingBrowseResult.remove(id);});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -943,20 +948,21 @@ void IntegrationPluginDenon::executeBrowserItem(BrowserActionInfo *info)
|
||||||
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
info->finish(Device::DeviceErrorHardwareNotAvailable);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* BrowserAction action = info->browserAction();
|
BrowserAction action = info->browserAction();
|
||||||
int playerId = info->device()->paramValue(heosPlayerDevicePlayerIdParamTypeId).toInt();
|
int playerId = info->device()->paramValue(heosPlayerDevicePlayerIdParamTypeId).toInt();
|
||||||
if (action.itemId()) {
|
qDebug(dcDenon()) << "Execute browse item called. Player Id:" << playerId << "Item ID" << action.itemId();
|
||||||
heos->playUrl(playerId, action.itemId());
|
|
||||||
|
if (m_mediaObjects.contains(action.itemId())) {
|
||||||
|
MediaObject media = m_mediaObjects.value(action.itemId());
|
||||||
|
if (media.mediaType == MEDIA_TYPE_CONTAINER) {
|
||||||
|
heos->addContainerToQueue(playerId, media.sourceId, media.containerId, ADD_CRITERIA_PLAY_NOW);
|
||||||
|
} else if (media.mediaType == MEDIA_TYPE_STATION) {
|
||||||
|
heos->playStation(playerId, media.sourceId, media.containerId, media.mediaId, media.name);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
heos->playPresetStation(playerId, presetNumber);
|
qWarning(dcDenon()) << "Media item not found" << action.itemId();
|
||||||
}
|
}
|
||||||
heos->playInputSource(playerId, inputName);
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
qDebug(dcDenon()) << "Execute browse item called";
|
|
||||||
info->finish(Device::DeviceErrorNoError);
|
info->finish(Device::DeviceErrorNoError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ private:
|
||||||
QHash<QString, BrowseResult*> m_pendingBrowseResult; // QString = containerId or sourceId
|
QHash<QString, BrowseResult*> m_pendingBrowseResult; // QString = containerId or sourceId
|
||||||
QHash<int, BrowserActionInfo*> m_pendingBrowserActions;
|
QHash<int, BrowserActionInfo*> m_pendingBrowserActions;
|
||||||
QHash<int, BrowserItemActionInfo*> m_pendingBrowserItemActions;
|
QHash<int, BrowserItemActionInfo*> m_pendingBrowserItemActions;
|
||||||
|
QHash<QString, MediaObject> m_mediaObjects;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onPluginTimer();
|
void onPluginTimer();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue