mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-03 13:30:26 +01:00
Fix compilation on older Qt, use Player::SongChangeRequestProcessed() signal to handle station play count
This commit is contained in:
parent
cd561af516
commit
91e1e5880d
@ -146,6 +146,8 @@ RadioBrowserService::RadioBrowserService(Application* app,
|
|||||||
app_->player()->RegisterUrlHandler(url_handler_);
|
app_->player()->RegisterUrlHandler(url_handler_);
|
||||||
app_->global_search()->AddProvider(
|
app_->global_search()->AddProvider(
|
||||||
new RadioBrowserSearchProvider(app_, this, this));
|
new RadioBrowserSearchProvider(app_, this, this));
|
||||||
|
connect(app_->player(), SIGNAL(SongChangeRequestProcessed(QUrl, bool)), this,
|
||||||
|
SLOT(SongChangeRequestProcessed(QUrl, bool)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItem* RadioBrowserService::CreateRootItem() {
|
QStandardItem* RadioBrowserService::CreateRootItem() {
|
||||||
@ -422,8 +424,11 @@ void RadioBrowserService::ResolveStationUrl(const QUrl& original_url) {
|
|||||||
|
|
||||||
StreamList list;
|
StreamList list;
|
||||||
QJsonArray contents = document.array();
|
QJsonArray contents = document.array();
|
||||||
QJsonValue item = contents.first();
|
QJsonObject item = contents.first().toObject();
|
||||||
if (item.isUndefined()) return;
|
if (item.isEmpty()) {
|
||||||
|
emit StationUrlResolved(original_url, QUrl());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Song ret;
|
Song ret;
|
||||||
ret.set_valid(true);
|
ret.set_valid(true);
|
||||||
@ -434,17 +439,21 @@ void RadioBrowserService::ResolveStationUrl(const QUrl& original_url) {
|
|||||||
|
|
||||||
emit StreamMetadataFound(original_url, ret);
|
emit StreamMetadataFound(original_url, ret);
|
||||||
emit StationUrlResolved(original_url, ret.url());
|
emit StationUrlResolved(original_url, ret.url());
|
||||||
|
|
||||||
// inform the server that we played the station
|
|
||||||
QString determinedUrl =
|
|
||||||
PlayClickUrl.arg(main_server_url_, original_url.path());
|
|
||||||
QUrl playUrl(determinedUrl);
|
|
||||||
QNetworkReply* playReply = network_->get(QNetworkRequest(playUrl));
|
|
||||||
connect(playReply, &QNetworkReply::finished,
|
|
||||||
[=] { playReply->deleteLater(); });
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadioBrowserService::SongChangeRequestProcessed(const QUrl& url,
|
||||||
|
bool valid) {
|
||||||
|
if (!valid || url.scheme() != url_handler_->scheme()) return;
|
||||||
|
|
||||||
|
// inform the server that the station is playing
|
||||||
|
QString determinedUrl = PlayClickUrl.arg(main_server_url_, url.path());
|
||||||
|
QUrl playUrl(determinedUrl);
|
||||||
|
QNetworkReply* playReply = network_->get(QNetworkRequest(playUrl));
|
||||||
|
connect(playReply, &QNetworkReply::finished,
|
||||||
|
[=] { playReply->deleteLater(); });
|
||||||
|
}
|
||||||
|
|
||||||
void RadioBrowserService::AddToSavedRadio(bool checked) {
|
void RadioBrowserService::AddToSavedRadio(bool checked) {
|
||||||
Q_UNUSED(checked);
|
Q_UNUSED(checked);
|
||||||
QAction* action = qobject_cast<QAction*>(sender());
|
QAction* action = qobject_cast<QAction*>(sender());
|
||||||
|
@ -85,6 +85,7 @@ class RadioBrowserService : public InternetService {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void ReloadSettings() override;
|
void ReloadSettings() override;
|
||||||
|
void SongChangeRequestProcessed(const QUrl& url, bool valid);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void LazyPopulate(QStandardItem* item) override;
|
void LazyPopulate(QStandardItem* item) override;
|
||||||
|
Loading…
Reference in New Issue
Block a user