Add new method for updating songs based on song ID
Show status updating database. Fixes #750
This commit is contained in:
@@ -872,14 +872,14 @@ void SubsonicRequest::FinishCheck() {
|
||||
) {
|
||||
finished_ = true;
|
||||
if (no_results_ && songs_.isEmpty()) {
|
||||
emit Results(SongList(), QString());
|
||||
emit Results(SongMap(), QString());
|
||||
}
|
||||
else {
|
||||
if (songs_.isEmpty() && errors_.isEmpty()) {
|
||||
emit Results(songs_.values(), tr("Unknown error"));
|
||||
emit Results(songs_, tr("Unknown error"));
|
||||
}
|
||||
else {
|
||||
emit Results(songs_.values(), ErrorsToHTML(errors_));
|
||||
emit Results(songs_, ErrorsToHTML(errors_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class SubsonicRequest : public SubsonicBaseRequest {
|
||||
void Reset();
|
||||
|
||||
signals:
|
||||
void Results(SongList songs, QString error);
|
||||
void Results(SongMap songs, QString error);
|
||||
void UpdateStatus(QString text);
|
||||
void ProgressSetMaximum(int max);
|
||||
void UpdateProgress(int max);
|
||||
@@ -140,7 +140,7 @@ class SubsonicRequest : public SubsonicBaseRequest {
|
||||
int album_covers_requested_;
|
||||
int album_covers_received_;
|
||||
|
||||
QMap<QString, Song> songs_;
|
||||
SongMap songs_;
|
||||
QStringList errors_;
|
||||
bool no_results_;
|
||||
QList<QNetworkReply*> replies_;
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QByteArray>
|
||||
#include <QPair>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
#include <QUrl>
|
||||
@@ -86,7 +87,7 @@ SubsonicService::SubsonicService(Application *app, QObject *parent)
|
||||
|
||||
collection_backend_ = new CollectionBackend();
|
||||
collection_backend_->moveToThread(app_->database()->thread());
|
||||
collection_backend_->Init(app_->database(), Song::Source_Subsonic, kSongsTable, kSongsFtsTable);
|
||||
collection_backend_->Init(app_->database(), app->task_manager(), Song::Source_Subsonic, kSongsTable, kSongsFtsTable);
|
||||
|
||||
// Model
|
||||
|
||||
@@ -425,12 +426,12 @@ void SubsonicService::ResetSongsRequest() {
|
||||
void SubsonicService::GetSongs() {
|
||||
|
||||
if (!server_url().isValid()) {
|
||||
emit SongsResults(SongList(), tr("Server URL is invalid."));
|
||||
emit SongsResults(SongMap(), tr("Server URL is invalid."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (username().isEmpty() || password().isEmpty()) {
|
||||
emit SongsResults(SongList(), tr("Missing username or password."));
|
||||
emit SongsResults(SongMap(), tr("Missing username or password."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -445,7 +446,7 @@ void SubsonicService::GetSongs() {
|
||||
|
||||
}
|
||||
|
||||
void SubsonicService::SongsResultsReceived(const SongList &songs, const QString &error) {
|
||||
void SubsonicService::SongsResultsReceived(const SongMap &songs, const QString &error) {
|
||||
|
||||
emit SongsResults(songs, error);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <QPair>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QVariant>
|
||||
#include <QByteArray>
|
||||
#include <QString>
|
||||
@@ -96,7 +97,7 @@ class SubsonicService : public InternetService {
|
||||
private slots:
|
||||
void HandlePingSSLErrors(const QList<QSslError> &ssl_errors);
|
||||
void HandlePingReply(QNetworkReply *reply, const QUrl &url, const QString &username, const QString &password, const SubsonicSettingsPage::AuthMethod auth_method);
|
||||
void SongsResultsReceived(const SongList &songs, const QString &error);
|
||||
void SongsResultsReceived(const SongMap &songs, const QString &error);
|
||||
|
||||
private:
|
||||
typedef QPair<QString, QString> Param;
|
||||
|
||||
Reference in New Issue
Block a user