Commit ab7a2405 authored by camilo higuita's avatar camilo higuita

fixes

parent 7d066a15
......@@ -85,8 +85,7 @@ int main(int argc, char *argv[])
{
qDebug()<<"FINISHED LOADING QML APP";
const auto currentSources = vvave.getSourceFolders();
const QStringList sources = currentSources.isEmpty() ? BAE::defaultSources : currentSources;
vvave.scanDir(sources);
vvave.scanDir(currentSources.isEmpty() ? BAE::defaultSources : currentSources);
if(!urls.isEmpty())
vvave.openUrls(urls);
});
......
......@@ -120,12 +120,13 @@ void AlbumsModel::setList()
this->sortList();
emit this->postListChanged();
if(this->query == AlbumsModel::QUERY::ALBUMS)
this->runBrain();
}
void AlbumsModel::runBrain()
void AlbumsModel::fetchInformation()
{
qDebug() << "RNUNGING BRAIN EFFORRTS";
QFutureWatcher<void> *watcher = new QFutureWatcher<void>;
QObject::connect(watcher, &QFutureWatcher<void>::finished, [=]()
......@@ -152,7 +153,7 @@ void AlbumsModel::runBrain()
PULPO::REQUEST request;
request.track = album;
request.ontology = PULPO::ONTOLOGY::ALBUM;
request.ontology = this->query == AlbumsModel::QUERY::ALBUMS ? PULPO::ONTOLOGY::ALBUM : PULPO::ONTOLOGY::ARTIST;
request.services = {PULPO::SERVICES::LastFm, PULPO::SERVICES::Spotify, PULPO::SERVICES::MusicBrainz};
request.info = {PULPO::INFO::ARTWORK};
request.callback = [=](PULPO::REQUEST request, PULPO::RESPONSES responses)
......
......@@ -48,7 +48,6 @@ private:
AlbumsModel::QUERY query;
AlbumsModel::SORTBY sort = AlbumsModel::SORTBY::ADDDATE;
void runBrain();
void updateArtwork(const int index, const QString &artwork);
signals:
......@@ -60,6 +59,8 @@ public slots:
void append(const QVariantMap &item);
void append(const QVariantMap &item, const int &at);
void refresh();
void fetchInformation();
};
#endif // ALBUMSMODEL_H
......@@ -52,6 +52,7 @@ function refreshCollection(size)
refreshArtists()
refreshFolders()
}
function refreshFolders()
{
foldersView.populate()
......@@ -65,6 +66,7 @@ function refreshTracks()
function refreshAlbums()
{
albumsView.list.refresh()
albumsView.list.fetchInformation();
}
function refreshArtists()
......
......@@ -83,7 +83,6 @@ void vvave::checkCollection(const QStringList &paths, std::function<void(uint)>
//// PUBLIC SLOTS
QVariantList vvave::sourceFolders()
{
const auto sources = this->db->getDBData("select * from sources");
......@@ -124,8 +123,7 @@ void vvave::openUrls(const QStringList &urls)
for(QString url : urls)
if(db->check_existance(BAE::TABLEMAP[BAE::TABLE::TRACKS], FMH::MODEL_NAME[FMH::MODEL_KEY::URL], url))
{
const auto value = this->db->getDBData(QStringList() << url).first();
data << FM::toMap(value);
data << FM::toMap(this->db->getDBData(QStringList() << url).first());
}
else
{
......
......@@ -110,7 +110,6 @@ Maui.Dialog
{
sources.model.clear()
var folders = vvave.getSourceFolders()
console.log(folders)
for(var i in folders)
sources.model.append({url : folders[i]})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment