fix kodi playback states with new kodi version
This commit is contained in:
parent
bea46cb954
commit
2443cf2701
@ -313,9 +313,9 @@ void DevicePluginKodi::onPlaybackStatusChanged(const QString &playbackStatus)
|
|||||||
Device *device = m_kodis.value(kodi);
|
Device *device = m_kodis.value(kodi);
|
||||||
device->setStateValue(kodiPlaybackStatusStateTypeId, playbackStatus);
|
device->setStateValue(kodiPlaybackStatusStateTypeId, playbackStatus);
|
||||||
// legacy events
|
// legacy events
|
||||||
if (playbackStatus == "PLAYING") {
|
if (playbackStatus == "Playing") {
|
||||||
emit emitEvent(Event(kodiOnPlayerPlayEventTypeId, device->id()));
|
emit emitEvent(Event(kodiOnPlayerPlayEventTypeId, device->id()));
|
||||||
} else if (playbackStatus == "PAUSED") {
|
} else if (playbackStatus == "Paused") {
|
||||||
emit emitEvent(Event(kodiOnPlayerPauseEventTypeId, device->id()));
|
emit emitEvent(Event(kodiOnPlayerPauseEventTypeId, device->id()));
|
||||||
} else {
|
} else {
|
||||||
emit emitEvent(Event(kodiOnPlayerStopEventTypeId, device->id()));
|
emit emitEvent(Event(kodiOnPlayerStopEventTypeId, device->id()));
|
||||||
|
|||||||
@ -205,7 +205,7 @@ void Kodi::activePlayersChanged(const QVariantList &data)
|
|||||||
qCDebug(dcKodi()) << "active players changed" << data.count();
|
qCDebug(dcKodi()) << "active players changed" << data.count();
|
||||||
m_activePlayerCount = data.count();
|
m_activePlayerCount = data.count();
|
||||||
if (m_activePlayerCount == 0) {
|
if (m_activePlayerCount == 0) {
|
||||||
emit playbackStatusChanged("STOPPED");
|
emit playbackStatusChanged("Stopped");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int activePlayer = data.first().toMap().value("playerid").toInt();
|
int activePlayer = data.first().toMap().value("playerid").toInt();
|
||||||
@ -222,9 +222,9 @@ void Kodi::playerPropertiesReceived(const QVariantMap &properties)
|
|||||||
qCDebug(dcKodi()) << "player props received" << properties;
|
qCDebug(dcKodi()) << "player props received" << properties;
|
||||||
if (m_activePlayerCount > 0) {
|
if (m_activePlayerCount > 0) {
|
||||||
if (properties.value("speed").toDouble() > 0) {
|
if (properties.value("speed").toDouble() > 0) {
|
||||||
emit playbackStatusChanged("PLAYING");
|
emit playbackStatusChanged("Playing");
|
||||||
} else {
|
} else {
|
||||||
emit playbackStatusChanged("PAUSED");
|
emit playbackStatusChanged("Paused");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,12 +56,12 @@ void KodiJsonHandler::processNotification(const QString &method, const QVariantM
|
|||||||
if (method == "Application.OnVolumeChanged") {
|
if (method == "Application.OnVolumeChanged") {
|
||||||
QVariantMap data = params.value("data").toMap();
|
QVariantMap data = params.value("data").toMap();
|
||||||
emit volumeChanged(data.value("volume").toInt(), data.value("muted").toBool());
|
emit volumeChanged(data.value("volume").toInt(), data.value("muted").toBool());
|
||||||
} else if (method == "Player.OnPlay") {
|
} else if (method == "Player.OnPlay" || method == "Player.OnResume") {
|
||||||
emit playbackStatusChanged("PLAYING");
|
emit playbackStatusChanged("Playing");
|
||||||
} else if (method == "Player.OnPause") {
|
} else if (method == "Player.OnPause") {
|
||||||
emit playbackStatusChanged("PAUSED");
|
emit playbackStatusChanged("Paused");
|
||||||
} else if (method == "Player.OnStop") {
|
} else if (method == "Player.OnStop") {
|
||||||
emit playbackStatusChanged("STOPPED");
|
emit playbackStatusChanged("Stopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user