diff --git a/data/data.qrc b/data/data.qrc
index b8dac0813..210f09b84 100644
--- a/data/data.qrc
+++ b/data/data.qrc
@@ -11,6 +11,7 @@
schema/schema-8.sql
schema/schema-9.sql
schema/schema-10.sql
+ schema/schema-11.sql
schema/device-schema.sql
style/strawberry.css
html/playing-tooltip-plain.html
diff --git a/data/schema/schema-11.sql b/data/schema/schema-11.sql
new file mode 100644
index 000000000..c24c47089
--- /dev/null
+++ b/data/schema/schema-11.sql
@@ -0,0 +1,219 @@
+ALTER TABLE songs RENAME TO songs_old;
+
+ALTER TABLE subsonic_songs RENAME TO subsonic_songs_old;
+
+ALTER TABLE playlist_items RENAME TO playlist_items_old;
+
+CREATE TABLE songs (
+
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
+ track INTEGER NOT NULL DEFAULT -1,
+ disc INTEGER NOT NULL DEFAULT -1,
+ year INTEGER NOT NULL DEFAULT -1,
+ originalyear INTEGER NOT NULL DEFAULT 0,
+ genre TEXT,
+ compilation INTEGER NOT NULL DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
+
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
+
+ beginning INTEGER NOT NULL DEFAULT 0,
+ length INTEGER NOT NULL DEFAULT 0,
+
+ bitrate INTEGER NOT NULL DEFAULT -1,
+ samplerate INTEGER NOT NULL DEFAULT -1,
+ bitdepth INTEGER NOT NULL DEFAULT -1,
+
+ source INTEGER NOT NULL DEFAULT 0,
+ directory_id INTEGER NOT NULL DEFAULT -1,
+ url TEXT NOT NULL,
+ filetype INTEGER NOT NULL DEFAULT 0,
+ filesize INTEGER NOT NULL DEFAULT -1,
+ mtime INTEGER NOT NULL DEFAULT -1,
+ ctime INTEGER NOT NULL DEFAULT -1,
+ unavailable INTEGER DEFAULT 0,
+
+ playcount INTEGER NOT NULL DEFAULT 0,
+ skipcount INTEGER NOT NULL DEFAULT 0,
+ lastplayed INTEGER NOT NULL DEFAULT -1,
+
+ compilation_detected INTEGER DEFAULT 0,
+ compilation_on INTEGER NOT NULL DEFAULT 0,
+ compilation_off INTEGER NOT NULL DEFAULT 0,
+ compilation_effective INTEGER NOT NULL DEFAULT 0,
+
+ art_automatic TEXT,
+ art_manual TEXT,
+
+ effective_albumartist TEXT,
+ effective_originalyear INTEGER NOT NULL DEFAULT 0,
+
+ cue_path TEXT
+
+);
+
+CREATE TABLE subsonic_songs (
+
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
+ track INTEGER NOT NULL DEFAULT -1,
+ disc INTEGER NOT NULL DEFAULT -1,
+ year INTEGER NOT NULL DEFAULT -1,
+ originalyear INTEGER NOT NULL DEFAULT 0,
+ genre TEXT,
+ compilation INTEGER NOT NULL DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
+
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
+
+ beginning INTEGER NOT NULL DEFAULT 0,
+ length INTEGER NOT NULL DEFAULT 0,
+
+ bitrate INTEGER NOT NULL DEFAULT -1,
+ samplerate INTEGER NOT NULL DEFAULT -1,
+ bitdepth INTEGER NOT NULL DEFAULT -1,
+
+ source INTEGER NOT NULL DEFAULT 0,
+ directory_id INTEGER NOT NULL DEFAULT -1,
+ url TEXT NOT NULL,
+ filetype INTEGER NOT NULL DEFAULT 0,
+ filesize INTEGER NOT NULL DEFAULT -1,
+ mtime INTEGER NOT NULL DEFAULT -1,
+ ctime INTEGER NOT NULL DEFAULT -1,
+ unavailable INTEGER DEFAULT 0,
+
+ playcount INTEGER NOT NULL DEFAULT 0,
+ skipcount INTEGER NOT NULL DEFAULT 0,
+ lastplayed INTEGER NOT NULL DEFAULT -1,
+
+ compilation_detected INTEGER DEFAULT 0,
+ compilation_on INTEGER NOT NULL DEFAULT 0,
+ compilation_off INTEGER NOT NULL DEFAULT 0,
+ compilation_effective INTEGER NOT NULL DEFAULT 0,
+
+ art_automatic TEXT,
+ art_manual TEXT,
+
+ effective_albumartist TEXT,
+ effective_originalyear INTEGER NOT NULL DEFAULT 0,
+
+ cue_path TEXT
+
+);
+
+INSERT INTO songs (ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path)
+SELECT ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path
+FROM songs_old;
+
+DROP TABLE songs_old;
+
+DELETE FROM songs_fts;
+
+INSERT INTO songs_fts (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)
+SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment
+FROM songs;
+
+INSERT INTO subsonic_songs (ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path)
+SELECT ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path
+FROM subsonic_songs_old;
+
+DROP TABLE subsonic_songs_old;
+
+DELETE FROM subsonic_songs_fts;
+
+INSERT INTO subsonic_songs_fts (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)
+SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment
+FROM subsonic_songs;
+
+CREATE TABLE playlist_items (
+
+ playlist INTEGER NOT NULL,
+ type INTEGER NOT NULL DEFAULT 0,
+ collection_id INTEGER,
+ playlist_url TEXT,
+
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
+ track INTEGER,
+ disc INTEGER,
+ year INTEGER,
+ originalyear INTEGER,
+ genre TEXT,
+ compilation INTEGER DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
+
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
+
+ beginning INTEGER,
+ length INTEGER,
+
+ bitrate INTEGER,
+ samplerate INTEGER,
+ bitdepth INTEGER,
+
+ source INTEGER,
+ directory_id INTEGER,
+ url TEXT,
+ filetype INTEGER,
+ filesize INTEGER,
+ mtime INTEGER,
+ ctime INTEGER,
+ unavailable INTEGER DEFAULT 0,
+
+ playcount INTEGER DEFAULT 0,
+ skipcount INTEGER DEFAULT 0,
+ lastplayed INTEGER DEFAULT 0,
+
+ compilation_detected INTEGER DEFAULT 0,
+ compilation_on INTEGER DEFAULT 0,
+ compilation_off INTEGER DEFAULT 0,
+ compilation_effective INTEGER DEFAULT 0,
+
+ art_automatic TEXT,
+ art_manual TEXT,
+
+ effective_albumartist TEXT,
+ effective_originalyear INTEGER,
+
+ cue_path TEXT
+
+);
+
+INSERT INTO playlist_items (ROWID, playlist, type, collection_id, playlist_url, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path)
+SELECT ROWID, playlist, type, collection_id, playlist_url, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, artist_id, album_id, song_id, beginning, length, bitrate, samplerate, bitdepth, source, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path
+FROM playlist_items_old;
+
+DROP TABLE playlist_items_old;
+
+DELETE FROM playlist_items_fts_;
+
+INSERT INTO playlist_items_fts_ (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)
+SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment
+FROM playlist_items;
+
+UPDATE schema_version SET version=11;
diff --git a/data/schema/schema.sql b/data/schema/schema.sql
index d21148e09..802fad5ad 100644
--- a/data/schema/schema.sql
+++ b/data/schema/schema.sql
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS schema_version (
DELETE FROM schema_version;
-INSERT INTO schema_version (version) VALUES (10);
+INSERT INTO schema_version (version) VALUES (11);
CREATE TABLE IF NOT EXISTS directories (
path TEXT NOT NULL,
@@ -19,25 +19,25 @@ CREATE TABLE IF NOT EXISTS subdirectories (
CREATE TABLE IF NOT EXISTS songs (
- title TEXT NOT NULL,
- album TEXT NOT NULL,
- artist TEXT NOT NULL,
- albumartist TEXT NOT NULL,
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
track INTEGER NOT NULL DEFAULT -1,
disc INTEGER NOT NULL DEFAULT -1,
year INTEGER NOT NULL DEFAULT -1,
originalyear INTEGER NOT NULL DEFAULT 0,
- genre TEXT NOT NULL,
- compilation INTEGER NOT NULL DEFAULT -1,
- composer TEXT NOT NULL,
- performer TEXT NOT NULL,
- grouping TEXT NOT NULL,
- comment TEXT NOT NULL,
- lyrics TEXT NOT NULL,
+ genre TEXT,
+ compilation INTEGER NOT NULL DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
- artist_id INTEGER NOT NULL DEFAULT -1,
- album_id TEXT NOT NULL,
- song_id INTEGER NOT NULL DEFAULT -1,
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
beginning INTEGER NOT NULL DEFAULT 0,
length INTEGER NOT NULL DEFAULT 0,
@@ -76,25 +76,25 @@ CREATE TABLE IF NOT EXISTS songs (
CREATE TABLE IF NOT EXISTS subsonic_songs (
- title TEXT NOT NULL,
- album TEXT NOT NULL,
- artist TEXT NOT NULL,
- albumartist TEXT NOT NULL,
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
track INTEGER NOT NULL DEFAULT -1,
disc INTEGER NOT NULL DEFAULT -1,
year INTEGER NOT NULL DEFAULT -1,
originalyear INTEGER NOT NULL DEFAULT 0,
- genre TEXT NOT NULL,
- compilation INTEGER NOT NULL DEFAULT -1,
- composer TEXT NOT NULL,
- performer TEXT NOT NULL,
- grouping TEXT NOT NULL,
- comment TEXT NOT NULL,
- lyrics TEXT NOT NULL,
+ genre TEXT,
+ compilation INTEGER NOT NULL DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
- artist_id INTEGER NOT NULL DEFAULT -1,
- album_id TEXT NOT NULL,
- song_id INTEGER NOT NULL DEFAULT -1,
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
beginning INTEGER NOT NULL DEFAULT 0,
length INTEGER NOT NULL DEFAULT 0,
@@ -149,56 +149,56 @@ CREATE TABLE IF NOT EXISTS playlist_items (
collection_id INTEGER,
playlist_url TEXT,
- title TEXT NOT NULL,
- album TEXT NOT NULL,
- artist TEXT NOT NULL,
- albumartist TEXT NOT NULL,
- track INTEGER NOT NULL DEFAULT -1,
- disc INTEGER NOT NULL DEFAULT -1,
- year INTEGER NOT NULL DEFAULT -1,
- originalyear INTEGER NOT NULL DEFAULT 0,
- genre TEXT NOT NULL,
- compilation INTEGER NOT NULL DEFAULT -1,
- composer TEXT NOT NULL,
- performer TEXT NOT NULL,
- grouping TEXT NOT NULL,
- comment TEXT NOT NULL,
- lyrics TEXT NOT NULL,
+ title TEXT,
+ album TEXT,
+ artist TEXT,
+ albumartist TEXT,
+ track INTEGER,
+ disc INTEGER,
+ year INTEGER,
+ originalyear INTEGER,
+ genre TEXT,
+ compilation INTEGER DEFAULT 0,
+ composer TEXT,
+ performer TEXT,
+ grouping TEXT,
+ comment TEXT,
+ lyrics TEXT,
- artist_id INTEGER NOT NULL DEFAULT -1,
- album_id TEXT NOT NULL,
- song_id INTEGER NOT NULL DEFAULT -1,
+ artist_id TEXT,
+ album_id TEXT,
+ song_id TEXT,
- beginning INTEGER NOT NULL DEFAULT 0,
- length INTEGER NOT NULL DEFAULT 0,
+ beginning INTEGER,
+ length INTEGER,
- bitrate INTEGER NOT NULL DEFAULT -1,
- samplerate INTEGER NOT NULL DEFAULT -1,
- bitdepth INTEGER NOT NULL DEFAULT -1,
+ bitrate INTEGER,
+ samplerate INTEGER,
+ bitdepth INTEGER,
- source INTEGER NOT NULL DEFAULT 0,
+ source INTEGER,
directory_id INTEGER,
url TEXT,
- filetype INTEGER NOT NULL DEFAULT 0,
+ filetype INTEGER,
filesize INTEGER,
mtime INTEGER,
ctime INTEGER,
unavailable INTEGER DEFAULT 0,
- playcount INTEGER NOT NULL DEFAULT 0,
- skipcount INTEGER NOT NULL DEFAULT 0,
- lastplayed INTEGER NOT NULL DEFAULT -1,
+ playcount INTEGER DEFAULT 0,
+ skipcount INTEGER DEFAULT 0,
+ lastplayed INTEGER DEFAULT 0,
compilation_detected INTEGER DEFAULT 0,
- compilation_on INTEGER NOT NULL DEFAULT 0,
- compilation_off INTEGER NOT NULL DEFAULT 0,
- compilation_effective INTEGER NOT NULL DEFAULT 0,
+ compilation_on INTEGER DEFAULT 0,
+ compilation_off INTEGER DEFAULT 0,
+ compilation_effective INTEGER DEFAULT 0,
art_automatic TEXT,
art_manual TEXT,
effective_albumartist TEXT,
- effective_originalyear INTEGER NOT NULL DEFAULT 0,
+ effective_originalyear INTEGER,
cue_path TEXT
diff --git a/src/collection/collectionbackend.cpp b/src/collection/collectionbackend.cpp
index b64f6a88d..1f39c377c 100644
--- a/src/collection/collectionbackend.cpp
+++ b/src/collection/collectionbackend.cpp
@@ -822,35 +822,29 @@ SongList CollectionBackend::GetSongsByUrl(const QUrl &url) {
}
-Song CollectionBackend::GetSongBySongId(int song_id) {
+Song CollectionBackend::GetSongBySongId(const QString &song_id) {
+
QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect());
return GetSongBySongId(song_id, db);
-}
-SongList CollectionBackend::GetSongsBySongId(const QList &song_ids) {
- QMutexLocker l(db_->Mutex());
- QSqlDatabase db(db_->Connect());
-
- QStringList str_song_ids;
- for (int song_id : song_ids) {
- str_song_ids << QString::number(song_id);
- }
-
- return GetSongsBySongId(str_song_ids, db);
}
SongList CollectionBackend::GetSongsBySongId(const QStringList &song_ids) {
+
QMutexLocker l(db_->Mutex());
QSqlDatabase db(db_->Connect());
return GetSongsBySongId(song_ids, db);
+
}
-Song CollectionBackend::GetSongBySongId(int song_id, QSqlDatabase &db) {
- SongList list = GetSongsBySongId(QStringList() << QString::number(song_id), db);
+Song CollectionBackend::GetSongBySongId(const QString &song_id, QSqlDatabase &db) {
+
+ SongList list = GetSongsBySongId(QStringList() << song_id, db);
if (list.isEmpty()) return Song();
return list.first();
+
}
SongList CollectionBackend::GetSongsBySongId(const QStringList &song_ids, QSqlDatabase &db) {
diff --git a/src/collection/collectionbackend.h b/src/collection/collectionbackend.h
index ddec52969..6ac22673a 100644
--- a/src/collection/collectionbackend.h
+++ b/src/collection/collectionbackend.h
@@ -181,8 +181,7 @@ class CollectionBackend : public CollectionBackendInterface {
void DeleteAll();
- Song GetSongBySongId(int song_id);
- SongList GetSongsBySongId(const QList &song_ids);
+ Song GetSongBySongId(const QString &song_id);
SongList GetSongsBySongId(const QStringList &song_ids);
Song::Source Source() const;
@@ -241,7 +240,7 @@ class CollectionBackend : public CollectionBackendInterface {
Song GetSongById(int id, QSqlDatabase &db);
SongList GetSongsById(const QStringList &ids, QSqlDatabase &db);
- Song GetSongBySongId(int song_id, QSqlDatabase &db);
+ Song GetSongBySongId(const QString &song_id, QSqlDatabase &db);
SongList GetSongsBySongId(const QStringList &song_ids, QSqlDatabase &db);
private:
diff --git a/src/core/database.cpp b/src/core/database.cpp
index 307a78031..7ace63889 100644
--- a/src/core/database.cpp
+++ b/src/core/database.cpp
@@ -54,7 +54,7 @@
#include "scopedtransaction.h"
const char *Database::kDatabaseFilename = "strawberry.db";
-const int Database::kSchemaVersion = 10;
+const int Database::kSchemaVersion = 11;
const char *Database::kMagicAllSongsTables = "%allsongstables";
int Database::sNextConnectionId = 1;
diff --git a/src/core/song.cpp b/src/core/song.cpp
index 91a75a0c1..1155a9fcf 100644
--- a/src/core/song.cpp
+++ b/src/core/song.cpp
@@ -181,9 +181,9 @@ struct Song::Private : public QSharedData {
QString comment_;
QString lyrics_;
- qint64 artist_id_;
+ QString artist_id_;
QString album_id_;
- qint64 song_id_;
+ QString song_id_;
qint64 beginning_;
qint64 end_;
@@ -279,9 +279,9 @@ bool Song::is_valid() const { return d->valid_; }
bool Song::is_unavailable() const { return d->unavailable_; }
int Song::id() const { return d->id_; }
-qint64 Song::artist_id() const { return d->artist_id_; }
+QString Song::artist_id() const { return d->artist_id_.isNull() ? "" : d->artist_id_; }
QString Song::album_id() const { return d->album_id_.isNull() ? "" : d->album_id_; }
-qint64 Song::song_id() const { return d->song_id_; }
+QString Song::song_id() const { return d->song_id_.isNull() ? "" : d->song_id_; }
const QString &Song::title() const { return d->title_; }
const QString &Song::title_sortable() const { return d->title_sortable_; }
@@ -380,10 +380,9 @@ const QString &Song::error() const { return d->error_; }
void Song::set_id(int id) { d->id_ = id; }
void Song::set_valid(bool v) { d->valid_ = v; }
-void Song::set_artist_id(qint64 v) { d->artist_id_ = v; }
-void Song::set_album_id(qint64 v) { d->album_id_ = QString::number(v); }
+void Song::set_artist_id(const QString &v) { d->artist_id_ = v; }
void Song::set_album_id(const QString &v) { d->album_id_ = v; }
-void Song::set_song_id(qint64 v) { d->song_id_ = v; }
+void Song::set_song_id(const QString &v) { d->song_id_ = v; }
QString Song::sortable(const QString &v) const {
@@ -860,13 +859,13 @@ void Song::InitFromQuery(const SqlRow &q, bool reliable_metadata, int col) {
}
else if (Song::kColumns.value(i) == "artist_id") {
- d->artist_id_ = tolonglong(x);
+ d->artist_id_ = tostr(x);
}
else if (Song::kColumns.value(i) == "album_id") {
d->album_id_ = tostr(x);
}
else if (Song::kColumns.value(i) == "song_id") {
- d->song_id_ = tolonglong(x);
+ d->song_id_ = tostr(x);
}
else if (Song::kColumns.value(i) == "beginning") {
@@ -1265,9 +1264,9 @@ void Song::BindToQuery(QSqlQuery *query) const {
query->bindValue(":comment", strval(d->comment_));
query->bindValue(":lyrics", strval(d->lyrics_));
- query->bindValue(":artist_id", intval(d->artist_id_));
+ query->bindValue(":artist_id", strval(d->artist_id_));
query->bindValue(":album_id", strval(d->album_id_));
- query->bindValue(":song_id", intval(d->song_id_));
+ query->bindValue(":song_id", strval(d->song_id_));
query->bindValue(":beginning", d->beginning_);
query->bindValue(":length", intval(length_nanosec()));
diff --git a/src/core/song.h b/src/core/song.h
index 137906606..d85c08a3f 100644
--- a/src/core/song.h
+++ b/src/core/song.h
@@ -208,9 +208,9 @@ class Song {
const QString &comment() const;
const QString &lyrics() const;
- qint64 artist_id() const;
+ QString artist_id() const;
QString album_id() const;
- qint64 song_id() const;
+ QString song_id() const;
qint64 beginning_nanosec() const;
qint64 end_nanosec() const;
@@ -309,10 +309,9 @@ class Song {
void set_comment(const QString &v);
void set_lyrics(const QString &v);
- void set_artist_id(qint64 v);
- void set_album_id(qint64 v);
+ void set_artist_id(const QString &v);
void set_album_id(const QString &v);
- void set_song_id(qint64 v);
+ void set_song_id(const QString &v);
void set_beginning_nanosec(qint64 v);
void set_end_nanosec(qint64 v);
diff --git a/src/subsonic/subsonicrequest.cpp b/src/subsonic/subsonicrequest.cpp
index 88f1be351..48b839137 100644
--- a/src/subsonic/subsonicrequest.cpp
+++ b/src/subsonic/subsonicrequest.cpp
@@ -324,7 +324,7 @@ void SubsonicRequest::AlbumsFinishCheck(const int offset, const int albums_recei
}
-void SubsonicRequest::AddAlbumSongsRequest(const qint64 artist_id, const QString &album_id, const QString &album_artist, const int offset) {
+void SubsonicRequest::AddAlbumSongsRequest(const QString &artist_id, const QString &album_id, const QString &album_artist, const int offset) {
Request request;
request.artist_id = artist_id;
@@ -346,13 +346,13 @@ void SubsonicRequest::FlushAlbumSongsRequests() {
ParamList params = ParamList() << Param("id", request.album_id);
QNetworkReply *reply = CreateGetRequest(QString("getAlbum"), params);
replies_ << reply;
- NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumSongsReplyReceived(QNetworkReply*, const qint64, const qint64, const QString&)), reply, request.artist_id, request.album_id, request.album_artist);
+ NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumSongsReplyReceived(QNetworkReply*, QString, QString, QString)), reply, request.artist_id, request.album_id, request.album_artist);
}
}
-void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const qint64 artist_id, const qint64 album_id, const QString &album_artist) {
+void SubsonicRequest::AlbumSongsReplyReceived(QNetworkReply *reply, const QString &artist_id, const QString &album_id, const QString &album_artist) {
if (!replies_.contains(reply)) return;
replies_.removeAll(reply);
@@ -482,7 +482,7 @@ void SubsonicRequest::SongsFinishCheck() {
}
-int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qint64 artist_id_requested, const qint64 album_id_requested, const QString &album_artist) {
+QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const QString &artist_id_requested, const QString &album_id_requested, const QString &album_artist) {
Q_UNUSED(artist_id_requested);
Q_UNUSED(album_id_requested);
@@ -496,18 +496,15 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
!json_obj.contains("type")
) {
Error("Invalid Json reply, song is missing one or more values.", json_obj);
- return -1;
+ return QString();
}
- qint64 song_id = 0;
- QString song_id_str;
+ QString song_id;
if (json_obj["id"].type() == QJsonValue::String) {
- song_id_str = json_obj["id"].toString();
- song_id = QString(song_id_str).remove(QRegExp("[^0-9]+")).toLongLong();
+ song_id = json_obj["id"].toString();
}
else {
- song_id = json_obj["id"].toInt();
- song_id_str = QString::number(song_id);
+ song_id = QString::number(json_obj["id"].toInt());
}
QString album_id;
@@ -520,14 +517,13 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
}
}
- qint64 artist_id = -1;
+ QString artist_id;
if (json_obj.contains("artistId")) {
if (json_obj["artistId"].type() == QJsonValue::String) {
- QString artist_id_str = json_obj["artistId"].toString();
- artist_id = QString(artist_id_str).remove(QRegExp("[^0-9]+")).toLongLong();
+ artist_id = json_obj["artistId"].toString();
}
else {
- artist_id = json_obj["artistId"].toInt();
+ artist_id = QString::number(json_obj["artistId"].toInt());
}
}
@@ -619,7 +615,7 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
QUrl url;
url.setScheme(url_handler_->scheme());
- url.setPath(song_id_str);
+ url.setPath(song_id);
QUrl cover_url;
if (!cover_art_id.isEmpty()) {
@@ -641,9 +637,9 @@ int SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, const qi
song.set_source(Song::Source_Subsonic);
song.set_song_id(song_id);
- if (album_id > 0) song.set_album_id(album_id);
- if (artist_id > 0) song.set_artist_id(artist_id);
- if (album_artist != artist) song.set_albumartist(album_artist);
+ if (!album_id.isEmpty()) song.set_album_id(album_id);
+ if (!artist_id.isEmpty()) song.set_artist_id(artist_id);
+ if (!album_artist.isEmpty()) song.set_albumartist(album_artist);
song.set_album(album);
song.set_artist(artist);
song.set_title(title);
@@ -721,7 +717,7 @@ void SubsonicRequest::FlushAlbumCoverRequests() {
QNetworkReply *reply = network_->get(req);
album_cover_replies_ << reply;
- NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumCoverReceived(QNetworkReply*, const QString&, const QUrl&, const QString&)), reply, request.album_id, request.url, request.filename);
+ NewClosure(reply, SIGNAL(finished()), this, SLOT(AlbumCoverReceived(QNetworkReply*, QString, QUrl, QString)), reply, request.album_id, request.url, request.filename);
}
diff --git a/src/subsonic/subsonicrequest.h b/src/subsonic/subsonicrequest.h
index ad35b1285..e5dd13c91 100644
--- a/src/subsonic/subsonicrequest.h
+++ b/src/subsonic/subsonicrequest.h
@@ -68,7 +68,7 @@ class SubsonicRequest : public SubsonicBaseRequest {
private slots:
void AlbumsReplyReceived(QNetworkReply *reply, const int offset_requested);
- void AlbumSongsReplyReceived(QNetworkReply *reply, const qint64 artist_id, const qint64 album_id, const QString &album_artist);
+ void AlbumSongsReplyReceived(QNetworkReply *reply, const QString &artist_id, const QString &album_id, const QString &album_artist);
void AlbumCoverReceived(QNetworkReply *reply, const QString &album_id, const QUrl &url, const QString &filename);
private:
@@ -76,15 +76,15 @@ class SubsonicRequest : public SubsonicBaseRequest {
typedef QList ParamList;
struct Request {
- qint64 artist_id = 0;
+ QString artist_id = 0;
QString album_id;
- qint64 song_id = 0;
+ QString song_id = 0;
int offset = 0;
int size = 0;
QString album_artist;
};
struct AlbumCoverRequest {
- qint64 artist_id = 0;
+ QString artist_id = 0;
QString album_id = 0;
QUrl url;
QString filename;
@@ -96,10 +96,10 @@ class SubsonicRequest : public SubsonicBaseRequest {
void AlbumsFinishCheck(const int offset = 0, const int albums_received = 0);
void SongsFinishCheck();
- void AddAlbumSongsRequest(const qint64 artist_id, const QString &album_id, const QString &album_artist, const int offset = 0);
+ void AddAlbumSongsRequest(const QString &artist_id, const QString &album_id, const QString &album_artist, const int offset = 0);
void FlushAlbumSongsRequests();
- int ParseSong(Song &song, const QJsonObject &json_obj, const qint64 artist_id_requested = 0, const qint64 album_id_requested = 0, const QString &album_artist = QString());
+ QString ParseSong(Song &song, const QJsonObject &json_obj, const QString &artist_id_requested = QString(), const QString &album_id_requested = QString(), const QString &album_artist = QString());
void GetAlbumCovers();
void AddAlbumCoverRequest(Song &song);