| 1 | /* |
| 2 | Copyright (C) 2004 Max Howell <[email protected]> |
| 3 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU Lesser General Public License as published |
| 7 | by the Free Software Foundation; either version 2.1 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | #include "collectionupdater.h"cxx . . $ `<file>/src/collectionupdater.h`/ |
| 20 | |
| 21 | #include "collectiondb.h"cxx . . $ `<file>/src/collectiondb.h`/ |
| 22 | |
| 23 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= 0x050000 |
| 24 | #include <QtConcurrent/QtConcurrent> |
| 25 | #else |
| 26 | #include <QtConcurrentRun> |
| 27 | #endif |
| 28 | |
| 29 | class CollectionUpdaterPrivatecxx . . $ CollectionUpdaterPrivate# { |
| 30 | public: |
| 31 | bool doMonitorcxx . . $ CollectionUpdaterPrivate#doMonitor.; |
| 32 | QStringListcxx . . $ QStringList# dirscxx . . $ CollectionUpdaterPrivate#dirs.; |
| 33 | bool isStopedcxx . . $ CollectionUpdaterPrivate#isStoped.; |
| 34 | QPointcxx . . $ QPoint# startPoscxx . . $ CollectionUpdaterPrivate#startPos.; |
| 35 | bool openContextcxx . . $ CollectionUpdaterPrivate#openContext.; |
| 36 | bool dragLockedcxx . . $ CollectionUpdaterPrivate#dragLocked.; |
| 37 | QTimercxx . . $ QTimer#* timercxx . . $ CollectionUpdaterPrivate#timer.; |
| 38 | bool incrementalcxx . . $ CollectionUpdaterPrivate#incremental.; |
| 39 | CollectionDBcxx . . $ CollectionDB#* collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.; |
| 40 | QMutexcxx . . $ QMutex# mutexcxx . . $ CollectionUpdaterPrivate#mutex.; |
| 41 | }; |
| 42 | |
| 43 | CollectionUpdatercxx . . $ CollectionUpdater#::CollectionUpdatercxx . . $ CollectionUpdater#CollectionUpdater(49f6e7a06ebc5aa8).() |
| 44 | { |
| 45 | pcxx . . $ CollectionUpdater#p. = new CollectionUpdaterPrivatecxx . . $ CollectionUpdaterPrivate#; |
| 46 | |
| 47 | QSettingscxx . . $ QSettings# settingscxx . . $ QSettings#QSettings(749de1b6ae65bddd).; |
| 48 | |
| 49 | pcxx . . $ CollectionUpdater#p.->doMonitorcxx . . $ CollectionUpdaterPrivate#doMonitor. = settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("Monitor"cxx . . $ QString#QString(85c52e162fed56f9).).toBoolcxx . . $ QVariant#toBool(50ce9a9e25b4a850).(); |
| 50 | pcxx . . $ CollectionUpdater#p.->dirscxx . . $ CollectionUpdaterPrivate#dirs. =cxx . . $ QStringList#`operator=`(335bb966c1744308). settings.valuecxx . . $ QSettings#value(12a1b1749da49362).("Dirs"cxx . . $ QString#QString(85c52e162fed56f9).).toStringListcxx . . $ QVariant#toStringList(e1dbd5c4feadc8f5).(); |
| 51 | |
| 52 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB. = new CollectionDBcxx . . $ CollectionDB#(); |
| 53 | if (!pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.) |
| 54 | qWarningcxx . . $ `<external>/10450329605257866924/qlogging.h:166:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Could not open SQLite database\n"; |
| 55 | |
| 56 | //optimization for speeding up SQLite |
| 57 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("PRAGMA synchronous = OFF;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 58 | |
| 59 | if (!pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->isDbValidcxx . . $ CollectionDB#isDbValid(c9857a73d68e59ba).()) { |
| 60 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Rebuilding database!" <<cxx . . $ QDebug#`operator<<`(eeec1a57ad6beb98). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 61 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->dropTablescxx . . $ CollectionDB#dropTables(b45ddcbc8423892c).(); |
| 62 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->createTablescxx . . $ CollectionDB#createTables(b45ddcbc8423892c).(); |
| 63 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->dropStatsTablecxx . . $ CollectionDB#dropStatsTable(49f6e7a06ebc5aa8).(); |
| 64 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->createStatsTablecxx . . $ CollectionDB#createStatsTable(49f6e7a06ebc5aa8).(); |
| 65 | scancxx . . $ CollectionUpdater#scan(49f6e7a06ebc5aa8).(); |
| 66 | } |
| 67 | |
| 68 | pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer. = new QTimercxx . . $ QTimer#QTimer(749de1b6ae65bddd).(this); |
| 69 | pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer.->setIntervalcxx . . $ QTimer#setInterval(d4f767463ce0a6b3).(600000); //1000 * 60 * 10 = 10min |
| 70 | connectcxx . . $ QObject#connect(158df1d9a01a3410).(pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer., SIGNALcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:271:10`!(timeout()), this, SLOTcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:270:10`!(monitor())); |
| 71 | if (pcxx . . $ CollectionUpdater#p.->doMonitorcxx . . $ CollectionUpdaterPrivate#doMonitor.) { |
| 72 | monitorcxx . . $ CollectionUpdater#monitor(49f6e7a06ebc5aa8).(); |
| 73 | pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer.->startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | CollectionUpdatercxx . . $ CollectionUpdater#::~cxx . . $ CollectionUpdater#`~CollectionUpdater`(ced63f7c635d850d).CollectionUpdatercxx . . $ CollectionUpdater#() |
| 78 | { |
| 79 | delete pcxx . . $ CollectionUpdater#p.; |
| 80 | } |
| 81 | |
| 82 | void CollectionUpdatercxx . . $ CollectionUpdater#::setDoMonitorcxx . . $ CollectionUpdater#setDoMonitor(b45ddcbc8423892c).(bool value) |
| 83 | { |
| 84 | pcxx . . $ CollectionUpdater#p.->doMonitorcxx . . $ CollectionUpdaterPrivate#doMonitor. = value; |
| 85 | if (pcxx . . $ CollectionUpdater#p.->doMonitorcxx . . $ CollectionUpdaterPrivate#doMonitor.) |
| 86 | pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer.->startcxx . . $ QTimer#start(49f6e7a06ebc5aa8).(); |
| 87 | else |
| 88 | pcxx . . $ CollectionUpdater#p.->timercxx . . $ CollectionUpdaterPrivate#timer.->stopcxx . . $ QTimer#stop(49f6e7a06ebc5aa8).(); |
| 89 | } |
| 90 | |
| 91 | void CollectionUpdatercxx . . $ CollectionUpdater#::stopcxx . . $ CollectionUpdater#stop(49f6e7a06ebc5aa8).() |
| 92 | { |
| 93 | pcxx . . $ CollectionUpdater#p.->isStopedcxx . . $ CollectionUpdaterPrivate#isStoped. = true; |
| 94 | } |
| 95 | |
| 96 | void CollectionUpdatercxx . . $ CollectionUpdater#::setDirectoryListcxx . . $ CollectionUpdater#setDirectoryList(259d7dd017a80eae).(QStringListcxx . . $ QStringList# dirs, bool force) |
| 97 | { |
| 98 | if (pcxx . . $ CollectionUpdater#p.->dirscxx . . $ CollectionUpdaterPrivate#dirs. !=cxx . . $ QList#`operator!=`(2a7c7e01cfd9c901). dirs || force) { |
| 99 | pcxx . . $ CollectionUpdater#p.->dirscxx . . $ CollectionUpdaterPrivate#dirs. =cxx . . $ QStringList#`operator=`(cb3c3d1614140851). dirs; |
| 100 | scancxx . . $ CollectionUpdater#scan(49f6e7a06ebc5aa8).(); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | void CollectionUpdatercxx . . $ CollectionUpdater#::monitorcxx . . $ CollectionUpdater#monitor(49f6e7a06ebc5aa8).() |
| 105 | { |
| 106 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`!; |
| 107 | |
| 108 | pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental. = true; |
| 109 | pcxx . . $ CollectionUpdater#p.->isStopedcxx . . $ CollectionUpdaterPrivate#isStoped. = false; |
| 110 | |
| 111 | QStringListcxx . . $ QStringList# folderscxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 112 | |
| 113 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> entries = pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).("SELECT dir, changedate FROM directories;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 114 | |
| 115 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QStringList entry, entries) { |
| 116 | QStringcxx . . $ QString# dircxx . . $ QString#QString(132dd6869045752b).(entry[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).0]); |
| 117 | QStringcxx . . $ QString# changedatecxx . . $ QString#QString(132dd6869045752b).(entry[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).1]); |
| 118 | QFileInfocxx . . $ QFileInfo# ficxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(dir); |
| 119 | |
| 120 | if (fi.existscxx . . $ QFileInfo#exists(50ce9a9e25b4a850).()) { |
| 121 | if (QStringcxx . . $ QString#::numbercxx . . $ QString#number(da83c6b4fd8c0e98).(fi.lastModifiedcxx . . $ QFileInfo#lastModified(4e062b5c490497ac).().toTime_tcxx . . $ QDateTime#toTime_t(ddd8539a2fcdd4ce).()) !=cxx . . $ `operator!=`(5bc2975d2d751687). changedate) { |
| 122 | folders <<cxx . . $ QStringList#`operator<<`(85116071a693d053). dir; |
| 123 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Collection dir changed: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). dir; |
| 124 | } |
| 125 | } else { |
| 126 | // this folder has been removed |
| 127 | folders <<cxx . . $ QStringList#`operator<<`(85116071a693d053). dir; |
| 128 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Collection dir removed: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). dir; |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | if (!folders.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) |
| 133 | QFuturecxx . . $ QFuture#<void> future = QtConcurrentcxx . . $ QtConcurrent/::runcxx . . $ QtConcurrent/run(99327172cea463ca).(this, &CollectionUpdatercxx . . $ CollectionUpdater#::asynchronScancxx . . $ CollectionUpdater#asynchronScan(fc47db3ea09604d9)., folders); |
| 134 | } |
| 135 | |
| 136 | void CollectionUpdatercxx . . $ CollectionUpdater#::scancxx . . $ CollectionUpdater#scan(49f6e7a06ebc5aa8).() |
| 137 | { |
| 138 | pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental. = false; |
| 139 | pcxx . . $ CollectionUpdater#p.->isStopedcxx . . $ CollectionUpdaterPrivate#isStoped. = false; |
| 140 | QFuturecxx . . $ QFuture#<void> future = QtConcurrentcxx . . $ QtConcurrent/::runcxx . . $ QtConcurrent/run(99327172cea463ca).(this, &CollectionUpdatercxx . . $ CollectionUpdater#::asynchronScancxx . . $ CollectionUpdater#asynchronScan(fc47db3ea09604d9)., pcxx . . $ CollectionUpdater#p.->dirscxx . . $ CollectionUpdaterPrivate#dirs.); |
| 141 | } |
| 142 | |
| 143 | void CollectionUpdatercxx . . $ CollectionUpdater#::asynchronScancxx . . $ CollectionUpdater#asynchronScan(fc47db3ea09604d9).(QStringListcxx . . $ QStringList# dirs) |
| 144 | { |
| 145 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(6e3b7ae53f380c3). dirs.countcxx . . $ QList#count(455f465bc33b4cdf).() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "dirs" <<cxx . . $ QDebug#`operator<<`(eeec1a57ad6beb98). endlcxx . . $ QTextStreamFunctions/endl(e06208c9acdf85a).; |
| 146 | |
| 147 | // avoid multiple runs |
| 148 | QMutexLockercxx . . $ QMutexLocker# lockercxx . . $ QMutexLocker#QMutexLocker(beb12293d355549c).(&pcxx . . $ CollectionUpdater#p.->mutexcxx . . $ CollectionUpdaterPrivate#mutex.); |
| 149 | |
| 150 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! progressChangedcxx . . $ CollectionUpdater#progressChanged(d4f767463ce0a6b3).(1); |
| 151 | |
| 152 | if (!pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.) |
| 153 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->purgeDirCachecxx . . $ CollectionDB#purgeDirCache(49f6e7a06ebc5aa8).(); |
| 154 | |
| 155 | QStringListcxx . . $ QStringList# entriescxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 156 | int dirCount = dirs.countcxx . . $ QList#count(455f465bc33b4cdf).(); |
| 157 | |
| 158 | //iterate over all folders |
| 159 | for (int i = 0; i < dirCount; i++) { |
| 160 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! progressChangedcxx . . $ CollectionUpdater#progressChanged(d4f767463ce0a6b3).(((i + 1) * 10) / dirCount); |
| 161 | readDircxx . . $ CollectionUpdater#readDir(917cbfb293b6ce35).(dirs[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i], entries); |
| 162 | } |
| 163 | |
| 164 | if (!entries.emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) { |
| 165 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! progressChangedcxx . . $ CollectionUpdater#progressChanged(d4f767463ce0a6b3).(10); |
| 166 | readTagscxx . . $ CollectionUpdater#readTags(631c0101495f0328).(entries); |
| 167 | } |
| 168 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! progressChangedcxx . . $ CollectionUpdater#progressChanged(d4f767463ce0a6b3).(100); |
| 169 | |
| 170 | if (!entries.emptycxx . . $ QList#empty(50ce9a9e25b4a850).()) |
| 171 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! changesDonecxx . . $ CollectionUpdater#changesDone(49f6e7a06ebc5aa8).(); |
| 172 | } |
| 173 | |
| 174 | void CollectionUpdatercxx . . $ CollectionUpdater#::readDircxx . . $ CollectionUpdater#readDir(917cbfb293b6ce35).(const QStringcxx . . $ QString#& dir, QStringListcxx . . $ QStringList#& entries) |
| 175 | { |
| 176 | //update dir statistics for rescanning purposes |
| 177 | QFileInfocxx . . $ QFileInfo# ficxx . . $ QFileInfo#QFileInfo(3520e46b33348bf6).(dir); |
| 178 | |
| 179 | if (fi.existscxx . . $ QFileInfo#exists(50ce9a9e25b4a850).()) |
| 180 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->updateDirStatscxx . . $ CollectionDB#updateDirStats(a681021b9d4cbed8).(dircxx . . $ QString#QString(132dd6869045752b)., (long)fi.lastModifiedcxx . . $ QFileInfo#lastModified(4e062b5c490497ac).().toTime_tcxx . . $ QDateTime#toTime_t(ddd8539a2fcdd4ce).()); |
| 181 | else { |
| 182 | if (pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.) { |
| 183 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->removeSongsInDircxx . . $ CollectionDB#removeSongsInDir(7df51288a9ebd664).(dircxx . . $ QString#QString(132dd6869045752b).); |
| 184 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->removeDirFromCollectioncxx . . $ CollectionDB#removeDirFromCollection(7df51288a9ebd664).(dircxx . . $ QString#QString(132dd6869045752b).); |
| 185 | } |
| 186 | return; |
| 187 | } |
| 188 | |
| 189 | QDircxx . . $ QDir# rDircxx . . $ QDir#QDir(3520e46b33348bf6).(dir); |
| 190 | rDir.setFiltercxx . . $ QDir#setFilter(3cb6a626764edf13).(QDircxx . . $ QDir#::Dirscxx . . $ QDir#Dirs. |cxx . . $ `operator|`(153b300229e4e3d0). QDircxx . . $ QDir#::Filescxx . . $ QDir#Files. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). QDircxx . . $ QDir#::NoDotDotcxx . . $ QDir#NoDotDot. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). QDircxx . . $ QDir#::NoDotcxx . . $ QDir#NoDot. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). QDircxx . . $ QDir#::NoSymLinkscxx . . $ QDir#NoSymLinks. |cxx . . $ QFlags#`operator|`(2cc1994e0be6f18e). QDircxx . . $ QDir#::Readablecxx . . $ QDir#Readable.); |
| 191 | QFileInfoListcxx . . $ QFileInfoList# list = rDir.entryInfoListcxx . . $ QDir#entryInfoList(c85cb969d00e05df).(); |
| 192 | |
| 193 | Q_FOREACHcxx . . $ `<external>/15045578679651060896/qglobal.h:1137:9`! (const QFileInfo fi, list) { |
| 194 | if (fi.isDircxx . . $ QFileInfo#isDir(50ce9a9e25b4a850).()) { |
| 195 | if (!pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental. || !pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->isDirInCollectioncxx . . $ CollectionDB#isDirInCollection(7dc6c9a0b6a7270f).(fi.absoluteFilePathcxx . . $ QFileInfo#absoluteFilePath(6ef7b6c27b00b43d).())) |
| 196 | readDircxx . . $ CollectionUpdater#readDir(917cbfb293b6ce35).(fi.absoluteFilePathcxx . . $ QFileInfo#absoluteFilePath(6ef7b6c27b00b43d).(), entries); |
| 197 | } else if (fi.isFilecxx . . $ QFileInfo#isFile(50ce9a9e25b4a850).()) |
| 198 | entries <<cxx . . $ QStringList#`operator<<`(85116071a693d053). fi.absoluteFilePathcxx . . $ QFileInfo#absoluteFilePath(6ef7b6c27b00b43d).(); |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | void CollectionUpdatercxx . . $ CollectionUpdater#::readTagscxx . . $ CollectionUpdater#readTags(631c0101495f0328).(const QStringListcxx . . $ QStringList#& entries) |
| 203 | { |
| 204 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " Start"; |
| 205 | |
| 206 | QUrlcxx . . $ QUrl# urlcxx . . $ QUrl#QUrl(49f6e7a06ebc5aa8).; |
| 207 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->createTablescxx . . $ CollectionDB#createTables(b45ddcbc8423892c).(true); |
| 208 | |
| 209 | int entriesCount = entries.countcxx . . $ QList#count(455f465bc33b4cdf).(); |
| 210 | for (int i = 0; i < entriesCount; i++) { |
| 211 | if (!(i % 20)) |
| 212 | Q_EMITcxx . . $ `<external>/1208926524888476972/qobjectdefs.h:95:10`! progressChangedcxx . . $ CollectionUpdater#progressChanged(d4f767463ce0a6b3).(((i * 90) / entriesCount) + 10); |
| 213 | |
| 214 | url =cxx . . $ QUrl#`operator=`(590d023fc9cd4b2d). QUrlcxx . . $ QUrl#::fromLocalFilecxx . . $ QUrl#fromLocalFile(daf4b0201622af21).(entries[cxx . . $ QList#`operator[]`(e2681f9bb6b2f357).i]); |
| 215 | |
| 216 | Trackcxx . . $ Track# trackcxx . . $ Track#Track(37355d2f77053a23).(url); |
| 217 | |
| 218 | if (track.isValidcxx . . $ Track#isValid(c9857a73d68e59ba).()) { |
| 219 | |
| 220 | QStringcxx . . $ QString# command = QStringcxx . . $ QString#QString(85c52e162fed56f9).("INSERT INTO tags_temp " |
| 221 | "( url, dir, artist, title, album, genre, year, length, track ) " |
| 222 | "VALUES('%1','%2',%3,'%4',%5,%6,%7,%8,%9);") |
| 223 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(track.urlcxx . . $ Track#url(db502ccec337722f).().toLocalFilecxx . . $ QUrl#toLocalFile(6ef7b6c27b00b43d).())) |
| 224 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(track.dirPathcxx . . $ Track#dirPath(4365c3963150523e).())) |
| 225 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f54db86e0e113c71).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->getValueIDcxx . . $ CollectionDB#getValueID(f3056d5d9bf66617).("artist"cxx . . $ QString#QString(85c52e162fed56f9)., track.artistcxx . . $ Track#artist(4365c3963150523e).(), true, !pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.)))) |
| 226 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(track.titlecxx . . $ Track#title(4365c3963150523e).())) |
| 227 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f54db86e0e113c71).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->getValueIDcxx . . $ CollectionDB#getValueID(f3056d5d9bf66617).("album"cxx . . $ QString#QString(85c52e162fed56f9)., track.albumcxx . . $ Track#album(4365c3963150523e).(), true, !pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.)))) |
| 228 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f54db86e0e113c71).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->getValueIDcxx . . $ CollectionDB#getValueID(f3056d5d9bf66617).("genre"cxx . . $ QString#QString(85c52e162fed56f9)., track.genrecxx . . $ Track#genre(4365c3963150523e).(), true, !pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.)))) |
| 229 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f54db86e0e113c71).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->getValueIDcxx . . $ CollectionDB#getValueID(f3056d5d9bf66617).("year"cxx . . $ QString#QString(85c52e162fed56f9)., track.yearcxx . . $ Track#year(4365c3963150523e).(), true, !pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.)))) |
| 230 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f4fd9db251ca774b).(track.lengthcxx . . $ Track#length(b126dc7c1de90089).()))) |
| 231 | .argcxx . . $ QString#arg(bc823072288cbbb5).(pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(track.tracknumbercxx . . $ Track#tracknumber(4365c3963150523e).())); |
| 232 | |
| 233 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(command); |
| 234 | |
| 235 | //stop the process? |
| 236 | if (pcxx . . $ CollectionUpdater#p.->isStopedcxx . . $ CollectionUpdaterPrivate#isStoped.) |
| 237 | i = entries.countcxx . . $ QList#count(455f465bc33b4cdf).(); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " Insert finish"; |
| 242 | |
| 243 | //update database only if not stoped |
| 244 | if (!pcxx . . $ CollectionUpdater#p.->isStopedcxx . . $ CollectionUpdaterPrivate#isStoped.) { |
| 245 | // let's lock the database (will block other threads) |
| 246 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("BEGIN TRANSACTION;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 247 | |
| 248 | // remove tables and recreate them (quicker than DELETE FROM) |
| 249 | if (!pcxx . . $ CollectionUpdater#p.->incrementalcxx . . $ CollectionUpdaterPrivate#incremental.) { |
| 250 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->dropTablescxx . . $ CollectionDB#dropTables(b45ddcbc8423892c).(); |
| 251 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->createTablescxx . . $ CollectionDB#createTables(b45ddcbc8423892c).(); |
| 252 | } else { |
| 253 | // remove old entries from database, only |
| 254 | for (int i = 0; i < pcxx . . $ CollectionUpdater#p.->dirscxx . . $ CollectionUpdaterPrivate#dirs..countcxx . . $ QList#count(455f465bc33b4cdf).(); i++) |
| 255 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->removeSongsInDircxx . . $ CollectionDB#removeSongsInDir(7df51288a9ebd664).(pcxx . . $ QString#QString(132dd6869045752b).->dirscxx . . $ CollectionUpdaterPrivate#dirs.[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).i]); |
| 256 | } |
| 257 | |
| 258 | // rename tables |
| 259 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->moveTempTablescxx . . $ CollectionDB#moveTempTables(49f6e7a06ebc5aa8).(); |
| 260 | |
| 261 | // remove temp tables and unlock database |
| 262 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->dropTablescxx . . $ CollectionDB#dropTables(b45ddcbc8423892c).(true); |
| 263 | pcxx . . $ CollectionUpdater#p.->collectionDBcxx . . $ CollectionUpdaterPrivate#collectionDB.->executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("END TRANSACTION;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 264 | } else { |
| 265 | |
| 266 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " Stop"; |
| 267 | } |
| 268 | |
| 269 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). Q_FUNC_INFOcxx . . $ `/usr/include/x86_64-linux-gnu/qt5/QtCore/qcompilerdetection.h:240:11`! <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). " End"; |
| 270 | } |