feat: initial database creation, loading
fixes for cartographer and automatically add track to album when adding to artist
This commit is contained in:
parent
72bbcaba9e
commit
62c99ee67c
18 changed files with 515 additions and 108 deletions
|
@ -1,9 +1,11 @@
|
|||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQuickStyle>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "config/library.hpp"
|
||||
#include "config/config.hpp"
|
||||
#include "datalake/database.hpp"
|
||||
#include "datalake/indexer.hpp"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
@ -18,15 +20,33 @@ int main(int argc, char* argv[]) {
|
|||
|
||||
if (engine.rootObjects().isEmpty()) { return -1; }
|
||||
|
||||
// std::thread([]() {
|
||||
// auto config = KotoLibraryConfig("Music", "/home/joshua/Music");
|
||||
//
|
||||
// auto indexExample = FileIndexer(&config);
|
||||
// indexExample.index();
|
||||
// }).detach();
|
||||
Cartographer::create();
|
||||
auto config = KotoLibraryConfig("Music", "/home/joshua/Music");
|
||||
auto indexExample = FileIndexer(&config);
|
||||
indexExample.index();
|
||||
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();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue