DoViGUI/main.cpp

64 lines
1.8 KiB
C++
Raw Normal View History

2023-09-17 18:14:09 -05:00
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QMediaInfo.h>
#include <QHandbrake.h>
#include "qmoviedb.h"
#include <QFile>
#include <QQmlContext>
#include <QSettings>
2023-09-17 18:14:09 -05:00
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QCoreApplication::setOrganizationName("abissen");
QCoreApplication::setApplicationName("DoViGUI");
QSettings settings;
2023-09-17 18:14:09 -05:00
QMediaInfo mInfo(&app);
if (QString::compare(settings.value("MovieDB API Key").toString(), "", Qt::CaseInsensitive) == 0) {
qWarning() << "Set MovieDB API key in settings file.";
settings.setValue("MovieDB API Key", "");
}
QMovieDB movieDB(settings.value("MovieDB API Key").toString());
//movieDB.searchMovieTitle("10 cloverfield lane"); //Single Result Example
movieDB.searchMovieTitle("The Shawshank Redemption"); //Multi-result
// //Check if HDR/DolbyVision
// enum QMediaInfo::HDR_Type hdrType = mInfo.getHDRType(__T("Cosmos.mkv"));
// if (hdrType >= 0) {
// qInfo() << hdrType;
// } else {
// qWarning() << "Could not open file.";
// }
QHandbrake handbrake;
if (handbrake.setPath("J:\\Video\\VideoTools\\HandBrakeCLI.exe") ==1 ) {
qInfo() << "Success";
//handbrake.startEncode();
}
2023-12-23 05:29:36 -06:00
else if (handbrake.setPath("/usr/bin/HandBrakeCLI")) {
qInfo() << "Succes Linux";
}
else {
qInfo() << "fail";
}
2023-09-17 18:14:09 -05:00
QQmlApplicationEngine engine;
engine.rootContext()->setContextProperty("mediaInfo", &mInfo);
engine.rootContext()->setContextProperty("handbrake", &handbrake);
2023-09-17 18:14:09 -05:00
const QUrl url(u"qrc:/DoViGUI/Main.qml"_qs);
QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
&app, []() { QCoreApplication::exit(-1); },
Qt::QueuedConnection);
engine.load(url);
return app.exec();
}