mirror of
https://github.com/spalencsar/bearwave.git
synced 2026-07-06 22:24:17 +02:00
Fix metadata overwrite and Wayland DBus crash
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user