2024-09-29 17:29:10 +03:00
|
|
|
#include <QGuiApplication>
|
|
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <QQuickStyle>
|
2024-10-05 00:03:50 +03:00
|
|
|
#include <iostream>
|
2024-10-02 17:51:51 +03:00
|
|
|
#include <thread>
|
2024-09-29 17:29:10 +03:00
|
|
|
|
2024-10-05 00:03:50 +03:00
|
|
|
#include "config/config.hpp"
|
|
|
|
#include "datalake/database.hpp"
|
2024-10-02 17:51:51 +03:00
|
|
|
#include "datalake/indexer.hpp"
|
2024-09-29 17:29:10 +03:00
|
|
|
|
2024-10-02 17:51:51 +03:00
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
|
|
|
|
QGuiApplication app(argc, argv);
|
|
|
|
app.setApplicationDisplayName("Koto");
|
|
|
|
app.setDesktopFileName("com.github.joshstrobl.koto.desktop");
|
2024-09-29 17:29:10 +03:00
|
|
|
|
2024-10-02 17:51:51 +03:00
|
|
|
QQmlApplicationEngine engine;
|
2024-09-29 17:29:10 +03:00
|
|
|
|
2024-10-02 17:51:51 +03:00
|
|
|
engine.loadFromModule("com.github.joshstrobl.koto", "Main");
|
2024-09-29 17:29:10 +03:00
|
|
|
|
2024-10-02 17:51:51 +03:00
|
|
|
if (engine.rootObjects().isEmpty()) { return -1; }
|
|
|
|
|
2024-10-05 00:03:50 +03:00
|
|
|
std::thread([]() {
|
|
|
|
Cartographer::create();
|
|
|
|
KotoConfig::create();
|
|
|
|
KotoDatabase::create();
|
|
|
|
|
|
|
|
KotoDatabase::instance().connect();
|
|
|
|
|
|
|
|
// If we needed to bootstrap, index all libraries, otherwise load the database
|
|
|
|
if (KotoDatabase::instance().requiredBootstrap()) {
|
|
|
|
indexAllLibraries();
|
|
|
|
} else {
|
|
|
|
KotoDatabase::instance().load();
|
|
|
|
std::cout << "===== Summary =====" << std::endl;
|
|
|
|
for (auto artist : Cartographer::instance().getArtists()) {
|
|
|
|
std::cout << "Artist: " << artist->getName().toStdString() << std::endl;
|
|
|
|
for (auto album : artist->getAlbums()) {
|
|
|
|
std::cout << " Album: " << album->getTitle().toStdString() << std::endl;
|
|
|
|
for (auto track : album->getTracks()) { std::cout << " Track: " << track->getTitle().toStdString() << std::endl; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
std::cout << "===== Tracks without albums and/or artists =====" << std::endl;
|
|
|
|
for (auto track : Cartographer::instance().getTracks()) {
|
|
|
|
if (track->album_uuid.has_value()) continue;
|
|
|
|
std::cout << "Track: " << track->getTitle().toStdString() << std::endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).detach();
|
|
|
|
|
2024-10-02 17:51:51 +03:00
|
|
|
return app.exec();
|
2024-09-29 17:29:10 +03:00
|
|
|
}
|