mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Add a new method to serialize a comic remote information to json
This commit is contained in:
parent
da5a4def96
commit
7e571c8ffe
@ -23,4 +23,20 @@ QString YACReaderServerDataHelper::comicToYSFormat(const qulonglong libraryId,co
|
||||
.arg(comic.info.read?1:0);
|
||||
}
|
||||
|
||||
static QJsonObject YACReaderServerDataHelper::comicToJSON(const qulonglong libraryId, const ComicDB & comic)
|
||||
{
|
||||
QJsonObject json;
|
||||
|
||||
json["type"] = "comic";
|
||||
json["id"] = comic.id;
|
||||
json["file_name"] = comic.getFileName();
|
||||
json["file_size"] = comic.getFileSize();
|
||||
json["hash"] = comic.info.hash;
|
||||
json["current_page"] = comic.info.currentPage;
|
||||
json["num_pages"] = comic.info.numPages.toInt();
|
||||
json["read"] = comic.info.read;
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
YACReaderServerDataHelper::YACReaderServerDataHelper() {}
|
||||
|
@ -11,6 +11,8 @@ public:
|
||||
static QString folderToYSFormat(const qulonglong libraryId, const Folder & folder);
|
||||
static QString comicToYSFormat(const qulonglong libraryId, const ComicDB & comic);
|
||||
|
||||
static QJsonObject comicToJSON(const qulonglong libraryId, const ComicDB & comic);
|
||||
|
||||
private:
|
||||
YACReaderServerDataHelper();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user