mirror of
https://github.com/YACReader/yacreader
synced 2025-06-03 17:18:23 -04:00
added new class for creating and updating libraries using command line, the opearion progress is shown in the console. TODO add the library to the settings files
This commit is contained in:
parent
2b4c972219
commit
a5baa5278e
@ -1,159 +1,164 @@
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = YACReaderLibraryServer
|
||||
CONFIG += console
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
|
||||
|
||||
#load default build flags
|
||||
#TODO include (../config.pri)
|
||||
!CONFIG(unarr):!CONFIG(7zip) {
|
||||
unix {
|
||||
!macx {
|
||||
CONFIG+=unarr
|
||||
}
|
||||
else {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
|
||||
}
|
||||
win32 {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
|
||||
LIBS += -lpoppler-qt5
|
||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
|
||||
macx{
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
||||
HEADERS += $$PWD/../common/pdf_comic.h
|
||||
CONFIG += objective_c
|
||||
}
|
||||
|
||||
unix{
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += core sql network script
|
||||
|
||||
# Input
|
||||
HEADERS += library_creator.h \
|
||||
package_manager.h \
|
||||
bundle_creator.h \
|
||||
db_helper.h \
|
||||
./db/data_base_management.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
../common/comic.h \
|
||||
../common/bookmarks.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
yacreader_local_server.h \
|
||||
comics_remover.h \
|
||||
../common/http_worker.h \
|
||||
yacreader_libraries.h \
|
||||
comic_files_manager.h
|
||||
|
||||
|
||||
SOURCES += library_creator.cpp \
|
||||
.\headless\main.cpp \
|
||||
package_manager.cpp \
|
||||
bundle_creator.cpp \
|
||||
db_helper.cpp \
|
||||
./db/data_base_management.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
../common/comic.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
comic_files_manager.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr) {
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
|
||||
TRANSLATIONS = yacreaderlibraryserver_es.ts \
|
||||
yacreaderlibraryserver_ru.ts \
|
||||
yacreaderlibraryserver_pt.ts \
|
||||
yacreaderlibraryserver_fr.ts \
|
||||
yacreaderlibraryserver_nl.ts \
|
||||
yacreaderlibraryserver_tr.ts \
|
||||
yacreaderlibraryserver_de.ts \
|
||||
yacreaderlibraryserver_source.ts
|
||||
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
INSTALLS += bin icon desktop server translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReaderLibrary
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReaderLibrary
|
||||
}
|
||||
|
||||
server.path = $$DATADIR/yacreader
|
||||
server.files = ../release/server
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreaderlibrary_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReaderLibrary.1
|
||||
}
|
||||
######################################################################
|
||||
# Automatically generated by qmake (2.01a) dom 12. oct 20:47:48 2008
|
||||
######################################################################
|
||||
|
||||
TEMPLATE = app
|
||||
TARGET = YACReaderLibraryServer
|
||||
CONFIG += console
|
||||
DEPENDPATH += .
|
||||
INCLUDEPATH += .
|
||||
INCLUDEPATH += ../common \
|
||||
./server \
|
||||
./db
|
||||
|
||||
DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
|
||||
|
||||
#load default build flags
|
||||
#TODO include (../config.pri)
|
||||
!CONFIG(unarr):!CONFIG(7zip) {
|
||||
unix {
|
||||
!macx {
|
||||
CONFIG+=unarr
|
||||
}
|
||||
else {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
|
||||
}
|
||||
win32 {
|
||||
CONFIG+=7zip
|
||||
}
|
||||
}
|
||||
|
||||
win32 {
|
||||
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
|
||||
LIBS += -lpoppler-qt5
|
||||
INCLUDEPATH += ../dependencies/poppler/include/qt5
|
||||
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
unix:!macx{
|
||||
INCLUDEPATH += /usr/include/poppler/qt5
|
||||
LIBS += -L/usr/lib -lpoppler-qt5
|
||||
}
|
||||
|
||||
macx{
|
||||
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
|
||||
|
||||
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
|
||||
HEADERS += $$PWD/../common/pdf_comic.h
|
||||
CONFIG += objective_c
|
||||
}
|
||||
|
||||
unix{
|
||||
CONFIG += c++11
|
||||
}
|
||||
|
||||
#CONFIG += release
|
||||
CONFIG -= flat
|
||||
QT += core sql network script
|
||||
|
||||
# Input
|
||||
HEADERS += library_creator.h \
|
||||
package_manager.h \
|
||||
bundle_creator.h \
|
||||
db_helper.h \
|
||||
./db/data_base_management.h \
|
||||
../common/comic_db.h \
|
||||
../common/folder.h \
|
||||
../common/library_item.h \
|
||||
../common/comic.h \
|
||||
../common/bookmarks.h \
|
||||
../common/qnaturalsorting.h \
|
||||
../common/yacreader_global.h \
|
||||
yacreader_local_server.h \
|
||||
comics_remover.h \
|
||||
../common/http_worker.h \
|
||||
yacreader_libraries.h \
|
||||
comic_files_manager.h \
|
||||
headless/console_ui_library_creator.h
|
||||
|
||||
|
||||
SOURCES += library_creator.cpp \
|
||||
.\headless\main.cpp \
|
||||
package_manager.cpp \
|
||||
bundle_creator.cpp \
|
||||
db_helper.cpp \
|
||||
./db/data_base_management.cpp \
|
||||
../common/comic_db.cpp \
|
||||
../common/folder.cpp \
|
||||
../common/library_item.cpp \
|
||||
../common/comic.cpp \
|
||||
../common/bookmarks.cpp \
|
||||
../common/qnaturalsorting.cpp \
|
||||
yacreader_local_server.cpp \
|
||||
comics_remover.cpp \
|
||||
../common/http_worker.cpp \
|
||||
../common/yacreader_global.cpp \
|
||||
yacreader_libraries.cpp \
|
||||
comic_files_manager.cpp \
|
||||
headless/console_ui_library_creator.cpp
|
||||
|
||||
|
||||
include(./server/server.pri)
|
||||
CONFIG(7zip){
|
||||
include(../compressed_archive/wrapper.pri)
|
||||
} else:CONFIG(unarr) {
|
||||
include(../compressed_archive/unarr/unarr-wrapper.pri)
|
||||
} else {
|
||||
error(No compression backend specified. Did you mess with the build system?)
|
||||
}
|
||||
include(../QsLog/QsLog.pri)
|
||||
|
||||
|
||||
TRANSLATIONS = yacreaderlibraryserver_es.ts \
|
||||
yacreaderlibraryserver_ru.ts \
|
||||
yacreaderlibraryserver_pt.ts \
|
||||
yacreaderlibraryserver_fr.ts \
|
||||
yacreaderlibraryserver_nl.ts \
|
||||
yacreaderlibraryserver_tr.ts \
|
||||
yacreaderlibraryserver_de.ts \
|
||||
yacreaderlibraryserver_source.ts
|
||||
|
||||
|
||||
RESOURCES += headless/images.qrc
|
||||
|
||||
|
||||
Release:DESTDIR = ../release
|
||||
Debug:DESTDIR = ../debug
|
||||
|
||||
|
||||
unix:!macx {
|
||||
#set install prefix if it's empty
|
||||
isEmpty(PREFIX) {
|
||||
PREFIX = /usr
|
||||
}
|
||||
|
||||
BINDIR = $$PREFIX/bin
|
||||
LIBDIR = $$PREFIX/lib
|
||||
DATADIR = $$PREFIX/share
|
||||
|
||||
DEFINES += "LIBDIR=\\\"$$LIBDIR\\\"" "DATADIR=\\\"$$DATADIR\\\"" "BINDIR=\\\"$$BINDIR\\\""
|
||||
|
||||
#MAKE INSTALL
|
||||
INSTALLS += bin icon desktop server translation manpage
|
||||
|
||||
bin.path = $$BINDIR
|
||||
isEmpty(DESTDIR) {
|
||||
bin.files = YACReaderLibrary
|
||||
} else {
|
||||
bin.files = $$DESTDIR/YACReaderLibrary
|
||||
}
|
||||
|
||||
server.path = $$DATADIR/yacreader
|
||||
server.files = ../release/server
|
||||
|
||||
translation.path = $$DATADIR/yacreader/languages
|
||||
translation.files = ../release/languages/yacreaderlibrary_*
|
||||
|
||||
manpage.path = $$DATADIR/man/man1
|
||||
manpage.files = ../YACReaderLibrary.1
|
||||
}
|
||||
|
55
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
55
YACReaderLibrary/headless/console_ui_library_creator.cpp
Normal file
@ -0,0 +1,55 @@
|
||||
#include "console_ui_library_creator.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "library_creator.h"
|
||||
|
||||
|
||||
|
||||
ConsoleUILibraryCreator::ConsoleUILibraryCreator(QObject *parent) :
|
||||
QObject(parent), numComicsProcessed(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::createLibrary(const QString & name, const QString & path)
|
||||
{
|
||||
QEventLoop eventLoop;
|
||||
LibraryCreator * libraryCreator = new LibraryCreator();
|
||||
|
||||
libraryCreator->createLibrary(QDir::cleanPath(path),QDir::cleanPath(path)+"/.yacreaderlibrary");
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, this, &ConsoleUILibraryCreator::done);
|
||||
connect(libraryCreator, &LibraryCreator::comicAdded, this, &ConsoleUILibraryCreator::newComic);
|
||||
connect(libraryCreator, &LibraryCreator::failedCreatingDB, this, &ConsoleUILibraryCreator::manageCreatingError);
|
||||
|
||||
connect(libraryCreator, &LibraryCreator::finished, &eventLoop, &QEventLoop::quit);
|
||||
|
||||
std::cout << "Processing comics";
|
||||
|
||||
libraryCreator->start();
|
||||
eventLoop.exec();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::updateLibrary(const QString & path)
|
||||
{
|
||||
//TODO
|
||||
//connect(libraryCreator,SIGNAL(failedUpdatingDB(QString)),this,SLOT(manageUpdatingError(QString)));
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::newComic(const QString & relativeComicPath, const QString & coverPath)
|
||||
{
|
||||
numComicsProcessed++;
|
||||
std::cout << ".";
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::manageCreatingError(const QString & error)
|
||||
{
|
||||
std::cout << std::endl << "Error creating library! " << error.toUtf8().constData();
|
||||
}
|
||||
|
||||
void ConsoleUILibraryCreator::done()
|
||||
{
|
||||
std::cout << "Done!" << std::endl;
|
||||
std::cout << "Number of comis processed = " << numComicsProcessed << std::endl;
|
||||
}
|
26
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
26
YACReaderLibrary/headless/console_ui_library_creator.h
Normal file
@ -0,0 +1,26 @@
|
||||
#ifndef CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
#define CONSOLE_UI_LIBRARY_CREATOR_H
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
class ConsoleUILibraryCreator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConsoleUILibraryCreator(QObject *parent = 0);
|
||||
void createLibrary(const QString & name, const QString & path);
|
||||
void updateLibrary(const QString & path);
|
||||
|
||||
private:
|
||||
uint numComicsProcessed;
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
|
||||
protected slots:
|
||||
void newComic(const QString & relativeComicPath, const QString & coverPath);
|
||||
void manageCreatingError(const QString & error);
|
||||
void done();
|
||||
};
|
||||
|
||||
#endif // CONSOLE_UI_LIBRARY_CREATOR_H
|
Loading…
x
Reference in New Issue
Block a user