1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-28 09:10:58 +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 <QUrl>
#include <QUrlQuery>
#include <QDateTime>
#include <QImage>
#include <QImageReader>
#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;
url.setScheme(url_handler_->scheme());
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_filetype(filetype);
song.set_filesize(size);
song.set_mtime(0);
song.set_ctime(0);
song.set_mtime(created);
song.set_ctime(created);
song.set_bitrate(bitrate);
song.set_valid(true);