From d65587ae615bb00187bf905b6de4a1b104aeb24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20=C3=81ngel=20San=20Mart=C3=ADn?= Date: Fri, 21 Dec 2012 19:20:36 +0100 Subject: [PATCH] (server) comic_info incluye ahora toda la informaci?n en response --- YACReaderLibrary/db/comic_db.cpp | 83 +++++++++++++++++++ YACReaderLibrary/db/comic_db.h | 2 + .../server/controllers/comiccontroller.cpp | 8 +- 3 files changed, 88 insertions(+), 5 deletions(-) diff --git a/YACReaderLibrary/db/comic_db.cpp b/YACReaderLibrary/db/comic_db.cpp index d10785b2..b56138cf 100644 --- a/YACReaderLibrary/db/comic_db.cpp +++ b/YACReaderLibrary/db/comic_db.cpp @@ -150,6 +150,89 @@ bool ComicDB::isDir() return false; } +QString ComicDB::toTXT() +{ + QString txt; + + //Legacy info + txt.append(QString("comicid:%1\r\n").arg(id)); + txt.append(QString("hash:%1\r\n").arg(info.hash)); + txt.append(QString("path:%1\r\n").arg(path)); + txt.append(QString("numpages:%1\r\n").arg(*info.numPages)); + + //Información general + if(info.coverPage != NULL) + txt.append(QString("coverPage:%1\r\n").arg(*info.coverPage)); + + if(info.title != NULL) + txt.append(QString("title:%1\r\n").arg(*info.title)); + + if(info.number != NULL) + txt.append(QString("number:%1\r\n").arg(*info.number)); + + if(info.count != NULL) + txt.append(QString("count:%1\r\n").arg(*info.count)); + + if(info.volume != NULL) + txt.append(QString("volume:%1\r\n").arg(*info.volume)); + + if(info.storyArc != NULL) + txt.append(QString("storyArc:%1\r\n").arg(*info.storyArc)); + + if(info.arcNumber != NULL) + txt.append(QString("arcNumber:%1\r\n").arg(*info.arcNumber)); + + if(info.arcCount != NULL) + txt.append(QString("arcCount:%1\r\n").arg(*info.arcCount)); + + if(info.genere != NULL) + txt.append(QString("genere:%1\r\n").arg(*info.genere)); + + //Autores + if(info.writer != NULL) + txt.append(QString("writer:%1\r\n").arg(*info.writer)); + + if(info.penciller != NULL) + txt.append(QString("penciller:%1\r\n").arg(*info.penciller)); + + if(info.inker != NULL) + txt.append(QString("inker:%1\r\n").arg(*info.inker)); + + if(info.colorist != NULL) + txt.append(QString("colorist:%1\r\n").arg(*info.colorist)); + + if(info.letterer != NULL) + txt.append(QString("letterer:%1\r\n").arg(*info.letterer)); + + if(info.coverArtist != NULL) + txt.append(QString("coverArtist:%1\r\n").arg(*info.coverArtist)); + //Publicación + if(info.date != NULL) + txt.append(QString("date:%1\r\n").arg(*info.date)); + + if(info.publisher != NULL) + txt.append(QString("publisher:%1\r\n").arg(*info.publisher)); + + if(info.format != NULL) + txt.append(QString("format:%1\r\n").arg(*info.format)); + + if(info.color != NULL) + txt.append(QString("color:%1\r\n").arg(*info.color)); + + if(info.ageRating != NULL) + txt.append(QString("ageRating:%1\r\n").arg(*info.ageRating)); + //Argumento + if(info.synopsis != NULL) + txt.append(QString("synopsis:%1\r\n").arg(*info.synopsis)); + + if(info.characters != NULL) + txt.append(QString("characters:%1\r\n").arg(*info.characters)); + + if(info.notes != NULL) + txt.append(QString("notes:%1\r\n").arg(*info.notes)); + + return txt; +} //----------------------------------------------------------------------------- //COMIC_INFO------------------------------------------------------------------- //----------------------------------------------------------------------------- diff --git a/YACReaderLibrary/db/comic_db.h b/YACReaderLibrary/db/comic_db.h index 3522511a..4b9076bc 100644 --- a/YACReaderLibrary/db/comic_db.h +++ b/YACReaderLibrary/db/comic_db.h @@ -131,6 +131,8 @@ public: void removeFromDB(QSqlDatabase & db); void update(QSqlDatabase & db); bool hasCover() {return _hasCover;}; + + QString toTXT(); ComicInfo info; }; diff --git a/YACReaderLibrary/server/controllers/comiccontroller.cpp b/YACReaderLibrary/server/controllers/comiccontroller.cpp index 89cf9a70..369c3272 100644 --- a/YACReaderLibrary/server/controllers/comiccontroller.cpp +++ b/YACReaderLibrary/server/controllers/comiccontroller.cpp @@ -78,11 +78,9 @@ void ComicController::service(HttpRequest& request, HttpResponse& response) session.setCurrentComic(comic.id, comicFile); response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1"); - response.writeText(QString("comicid:%1\n").arg(comic.id)); - response.writeText(QString("hash:%1\n").arg(comic.info.hash)); - response.writeText(QString("path:%1\n").arg(comic.path)); - response.writeText(QString("numpages:%1\n").arg(*comic.info.numPages)); - response.writeText(QString("library:%1\n").arg(libraryName),true); + + response.writeText(QString("library:%1\r\n").arg(libraryName)); + response.writeText(comic.toTXT(),true); } else {