1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-30 18:17:26 +01:00

Read song creation time from subsonic API

Fixes #526
This commit is contained in:
Jonas Kvinge 2020-08-31 17:05:09 +02:00
parent a18a4bdf31
commit 2d49b71bc9

View File

@ -28,6 +28,7 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include <QUrlQuery> #include <QUrlQuery>
#include <QDateTime>
#include <QImage> #include <QImage>
#include <QImageReader> #include <QImageReader>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
@ -614,6 +615,11 @@ QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, cons
} }
} }
qint64 created = 0;
if (json_obj.contains("created")) {
created = QDateTime::fromString(json_obj["created"].toString(), Qt::ISODate).toSecsSinceEpoch();
}
QUrl url; QUrl url;
url.setScheme(url_handler_->scheme()); url.setScheme(url_handler_->scheme());
url.setPath(song_id); url.setPath(song_id);
@ -654,8 +660,8 @@ QString SubsonicRequest::ParseSong(Song &song, const QJsonObject &json_obj, cons
song.set_directory_id(0); song.set_directory_id(0);
song.set_filetype(filetype); song.set_filetype(filetype);
song.set_filesize(size); song.set_filesize(size);
song.set_mtime(0); song.set_mtime(created);
song.set_ctime(0); song.set_ctime(created);
song.set_bitrate(bitrate); song.set_bitrate(bitrate);
song.set_valid(true); song.set_valid(true);