Commit 1d95e242 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵
Browse files

fix mpris2 support to compute metadata correctly

also export them correctly at startup
parent 159134b4
......@@ -386,12 +386,19 @@ void MediaPlayer2Player::setCurrentTrack(int newTrackPosition)
m_currentTrackId = QDBusObjectPath(QLatin1String("/org/kde/elisa/playlist/") + QString::number(newTrackPosition)).path();
emit currentTrackChanged();
m_metadata = getMetadataOfCurrentTrack();
signalPropertiesChange(QStringLiteral("Metadata"), Metadata());
}
QVariantMap MediaPlayer2Player::getMetadataOfCurrentTrack()
{
auto result = QVariantMap();
if (m_currentTrackId.isEmpty()) {
return {};
}
result[QStringLiteral("mpris:trackid")] = QVariant::fromValue<QDBusObjectPath>(QDBusObjectPath(m_currentTrackId));
result[QStringLiteral("mpris:length")] = qlonglong(m_manageAudioPlayer->audioDuration()) * 1000;
//convert milli-seconds into micro-seconds
......
Markdown is supported
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