mirror of
https://github.com/YACReader/yacreader
synced 2025-07-19 13:34:44 -04:00
A?adida la informaci?n de descarga de folders y c?mcs
A?adidos los atributos necesarios a la sesi?n relacionados con YACReader
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#include "comiccontroller.h"
|
||||
|
||||
#include "library_window.h"
|
||||
|
||||
extern LibraryWindow * mw;
|
||||
@ -7,25 +8,47 @@ extern LibraryWindow * mw;
|
||||
#include "../static.h"
|
||||
|
||||
#include "comic_db.h"
|
||||
#include "comic.h"
|
||||
|
||||
ComicController::ComicController() {}
|
||||
|
||||
void ComicController::service(HttpRequest& request, HttpResponse& response)
|
||||
{
|
||||
response.setHeader("Content-Type", "plain/text; charset=ISO-8859-1");
|
||||
|
||||
|
||||
HttpSession session=Static::sessionStore->getSession(request,response);
|
||||
|
||||
QStringList pathElements = ((QString)request.getPath()).split('/');
|
||||
QString libraryName = pathElements.at(2);
|
||||
qulonglong comicId = pathElements.at(4).toULongLong();
|
||||
|
||||
QMap<QString,QString> libraries = mw->getLibraries();
|
||||
|
||||
|
||||
ComicDB comic = mw->getComicInfo(libraryName, comicId);
|
||||
|
||||
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);
|
||||
Comic * comicFile = new Comic;
|
||||
if(comicFile->load(libraries.value(libraryName)+comic.path))
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
delete comicFile;
|
||||
response.setStatus(404,"not found");
|
||||
response.write("404 not found",true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//response.write(t.toLatin1(),true);
|
||||
|
||||
}
|
Reference in New Issue
Block a user