Commit 2bc13fcc authored by Camilo Higuita's avatar Camilo Higuita

finally fix last bug for beta release: kirigami freezing bug

parent 55f9aecd
......@@ -365,7 +365,7 @@ void Babe::scanDir(const QString &url)
void Babe::brainz(const bool &on)
{
this->settings->checkCollectionBrainz(on);
// this->settings->checkCollectionBrainz(on);
}
bool Babe::brainzState()
......
......@@ -227,9 +227,7 @@ void CollectionDB::openDB(const QString &name)
void CollectionDB::addTrack(const DB &track)
{
auto query = this->getQuery("PRAGMA synchronous=OFF");
if(query.exec())
{
auto url = track[KEY::URL];
auto title = track[KEY::TITLE];
auto artist = track[KEY::ARTIST];
......@@ -243,7 +241,6 @@ void CollectionDB::addTrack(const DB &track)
auto artwork = track[KEY::ARTWORK].isEmpty()? "" : track[KEY::ARTWORK];
bDebug::Instance()->msg("Writting to db: "+title+" "+artist);
/* first needs to insert album and artist*/
QVariantMap sourceMap {{KEYMAP[KEY::URL],sourceUrl},
{KEYMAP[KEY::SOURCE_TYPE], sourceType(url)}};
......@@ -281,12 +278,6 @@ void CollectionDB::addTrack(const DB &track)
{KEYMAP[KEY::COMMENT], ""}};
insert(TABLEMAP[TABLE::TRACKS],trackMap);
}else
{
qDebug()<< "Failed to insert async";
}
emit trackInserted();
}
bool CollectionDB::updateTrack(const DB &track)
......@@ -853,7 +844,7 @@ bool CollectionDB::removeTrack(const QString &path)
}
QSqlQuery CollectionDB::getQuery(const QString &queryTxt)
{
{
return QSqlQuery(queryTxt, this->m_db);
}
......
......@@ -84,7 +84,6 @@ BabeSettings::BabeSettings(QObject *parent) : QObject(parent)
if(size > 0)
{
bDebug::Instance()->msg("Finished inserting into DB "+QString::number(size)+" tracks");
bDebug::Instance()->msg("Starting Brainz with interval: " + QString::number(BAE::SEG::ONEHALF));
this->startBrainz(true, BAE::SEG::HALF);
}else
......@@ -123,6 +122,8 @@ void BabeSettings::checkCollectionBrainz(const bool &state)
void BabeSettings::startBrainz(const bool &on, const uint &speed)
{
bDebug::Instance()->msg("Starting Brainz with interval: " + QString::number(BAE::SEG::ONEHALF));
this->brainDeamon->setInterval(speed);
if(on)
......
......@@ -31,13 +31,12 @@ public:
void requestPaths(QStringList paths)
{
qDebug()<<"FROM file loader"<< &paths;
qDebug()<<"FROM file loader"<< paths;
if(!go)
{
this->go = true;
QMetaObject::invokeMethod(this, "getTracks", Q_ARG(QStringList, paths));
}
}
......@@ -63,13 +62,14 @@ public slots:
while (it.hasNext()) urls<<it.next();
} else if (QFileInfo(path).isFile()) urls<<path;
}
qDebug()<<"URLS SIZEW FOR:"<<paths<< urls.size();
int newTracks = 0;
if(urls.size()>0)
if(!urls.isEmpty())
{
this->execQuery("PRAGMA synchronous=OFF");
for(auto url : urls)
{
if(go)
......@@ -89,18 +89,19 @@ public slots:
BAE::DB trackMap =
{
{BAE::KEY::URL,url},
{BAE::KEY::TRACK,QString::number(track)},
{BAE::KEY::TITLE,title},
{BAE::KEY::ARTIST,artist},
{BAE::KEY::ALBUM,album},
{BAE::KEY::URL, url},
{BAE::KEY::TRACK, QString::number(track)},
{BAE::KEY::TITLE, title},
{BAE::KEY::ARTIST, artist},
{BAE::KEY::ALBUM, album},
{BAE::KEY::DURATION,QString::number(duration)},
{BAE::KEY::GENRE,genre},
{BAE::KEY::SOURCES_URL,sourceUrl},
{BAE::KEY::BABE, url.startsWith(BAE::YoutubeCachePath)?"1":"0"},
{BAE::KEY::RELEASE_DATE,QString::number(year)}
{BAE::KEY::GENRE, genre},
{BAE::KEY::SOURCES_URL, sourceUrl},
{BAE::KEY::BABE, url.startsWith(BAE::YoutubeCachePath) ? "1": "0"},
{BAE::KEY::RELEASE_DATE, QString::number(year)}
};
qDebug()<<url;
this->addTrack(trackMap);
newTracks++;
}
......
......@@ -10,7 +10,7 @@ Kirigami.GlobalDrawer
id: settingsView
handleVisible: false
signal iconSizeChanged(int size)
readonly property bool activeBrainz : bae.brainzState()
readonly property bool activeBrainz : false
visible: false
y: header.height
......@@ -127,23 +127,7 @@ Kirigami.GlobalDrawer
{
text: qsTr("Settings...")
iconName: "view-media-config"
Kirigami.Action
{
text: "Brainz"
Kirigami.Action
{
id: brainzToggle
text: checked ? "Turn OFF" : "Turn ON"
checked: activeBrainz
checkable: true
onToggled:
{
bae.saveSetting("BRAINZ", checked === true ? true : false, "BABE")
bae.brainz(checked === true ? true : false)
}
}
}
Kirigami.Action
{
......
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