Fix metadata overwrite and Wayland DBus crash

This commit is contained in:
Sebastian Palencsar
2026-05-25 14:50:11 +02:00
parent b8a2f11439
commit cc4a33a2ae
3 changed files with 23 additions and 7 deletions

View File

@@ -131,6 +131,11 @@ void BearPlayer::onMetaDataChanged()
QString title = meta.stringValue(QMediaMetaData::Title);
// Ignore completely empty metadata from QMediaPlayer so we don't overwrite IcyReader
if (artist.isEmpty() && title.isEmpty()) {
return;
}
if (m_currentTrackArtist == artist && m_currentTrackTitle == title) {
return;
}

View File

@@ -56,8 +56,10 @@ void IcyReader::onReadyRead()
if (m_metaInt == 0) {
if (m_reply->hasRawHeader("icy-metaint")) {
m_metaInt = m_reply->rawHeader("icy-metaint").toInt();
qDebug() << "ICYREADER: Found icy-metaint =" << m_metaInt;
} else {
// No ICY metadata supported by stream
qDebug() << "ICYREADER: No icy-metaint header found!";
return;
}
}
@@ -132,6 +134,9 @@ void IcyReader::parseMetaData(const QByteArray &metaData)
title = fullTitle;
}
qDebug() << "ICYREADER: PARSED METADATA -> Artist:" << artist << "Title:" << title;
emit metaDataReceived(artist, title);
} else {
qDebug() << "ICYREADER: Regex failed on string:" << metaString;
}
}

View File

@@ -6,6 +6,8 @@
#include <QDBusReply>
#include <QDBusMessage>
#include <QDBusConnection>
#include <QDBusPendingCallWatcher>
#include <QDBusPendingReply>
#include <QDir>
#include <QFile>
#include <QCryptographicHash>
@@ -230,17 +232,21 @@ void NotificationManager::showNotification(const QString &station, const QString
<< hints
<< -1;
QDBusReply<uint> dbusReply = notifyInterface.callWithArgumentList(
QDBus::Block,
QDBusPendingCall pcall = notifyInterface.asyncCallWithArgumentList(
QStringLiteral("Notify"),
args
);
if (dbusReply.isValid()) {
m_lastNotificationId = dbusReply.value();
} else {
qWarning() << "Failed to send notification via DBus:" << dbusReply.error().message();
}
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pcall, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](QDBusPendingCallWatcher *watcher) {
watcher->deleteLater();
QDBusPendingReply<uint> reply = *watcher;
if (reply.isValid()) {
m_lastNotificationId = reply.value();
} else {
qWarning() << "Failed to send notification via DBus:" << reply.error().message();
}
});
}
void NotificationManager::closeNotification()