| 1 | /* |
| 2 | Copyright (c) 2004 Mark Kretschmann <[email protected]> |
| 3 | Copyright (c) 2004 Christian Muehlhaeuser <[email protected]> |
| 4 | Copyright (C) 2005-2014 Mario Stephan <[email protected]> |
| 5 | |
| 6 | This library is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU Lesser General Public License as published |
| 8 | by the Free Software Foundation; either version 2.1 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU Lesser General Public License |
| 17 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include "collectiondb.h"cxx . . $ `<file>/src/collectiondb.h`/ |
| 21 | |
| 22 | #include <QtSql> |
| 23 | |
| 24 | #include <QDesktopServices> |
| 25 | #include <QMutex> |
| 26 | #include <qimage.h> |
| 27 | |
| 28 | struct CollectionDbPrivatecxx . . $ CollectionDbPrivate# { |
| 29 | public: |
| 30 | uintcxx . . $ uint# genreCountcxx . . $ CollectionDbPrivate#genreCount.; |
| 31 | QStringcxx . . $ QString# lastPathcxx . . $ CollectionDbPrivate#lastPath.; |
| 32 | QStringcxx . . $ QString# lastArtistcxx . . $ CollectionDbPrivate#lastArtist.; |
| 33 | QStringcxx . . $ QString# lastGenrecxx . . $ CollectionDbPrivate#lastGenre.; |
| 34 | QStringcxx . . $ QString# lastFilterStringcxx . . $ CollectionDbPrivate#lastFilterString.; |
| 35 | QStringcxx . . $ QString# filterStringcxx . . $ CollectionDbPrivate#filterString.; |
| 36 | ulongcxx . . $ ulong# resultCountcxx . . $ CollectionDbPrivate#resultCount.; |
| 37 | ulongcxx . . $ ulong# resultLengthcxx . . $ CollectionDbPrivate#resultLength.; |
| 38 | QStringcxx . . $ QString# sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter.; |
| 39 | QStringcxx . . $ QString# sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString.; |
| 40 | QStringcxx . . $ QString# sqlFromStringPLcxx . . $ CollectionDbPrivate#sqlFromStringPL.; |
| 41 | QSqlDatabasecxx . . $ QSqlDatabase#* dbcxx . . $ CollectionDbPrivate#db.; |
| 42 | QSqlQuerycxx . . $ QSqlQuery#* querycxx . . $ CollectionDbPrivate#query.; |
| 43 | QMutexcxx . . $ QMutex# mutexcxx . . $ CollectionDbPrivate#mutex.; |
| 44 | |
| 45 | QStringcxx . . $ QString# selectionFiltercxx . . $ CollectionDbPrivate#selectionFilter(7361bdb59968dff0).(QStringcxx . . $ QString# year = ""cxx . . $ QString#QString(85c52e162fed56f9)., QStringcxx . . $ QString# genre = ""cxx . . $ QString#QString(85c52e162fed56f9)., QStringcxx . . $ QString# artist = ""cxx . . $ QString#QString(85c52e162fed56f9)., QStringcxx . . $ QString# album = ""cxx . . $ QString#QString(85c52e162fed56f9).) |
| 46 | { |
| 47 | QStringcxx . . $ QString# ret = ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 48 | if (!year.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 49 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND year.name = '" +cxx . . $ operator+(c75c3ae4eb9af1a8). year.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "' "; |
| 50 | if (!genre.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 51 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND genre.name = '" +cxx . . $ operator+(c75c3ae4eb9af1a8). genre.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "' "; |
| 52 | if (!artist.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 53 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND artist.name = '" +cxx . . $ operator+(c75c3ae4eb9af1a8). artist.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "' "; |
| 54 | if (!album.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 55 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND album.name = '" +cxx . . $ operator+(c75c3ae4eb9af1a8). album.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "' "; |
| 56 | return retcxx . . $ QString#QString(28715ad661ad3cec).; |
| 57 | } |
| 58 | |
| 59 | QStringcxx . . $ QString# selectionFilterForRandomcxx . . $ CollectionDbPrivate#selectionFilterForRandom(9e1571a6b06697ca).(QStringcxx . . $ QString# path = ""cxx . . $ QString#QString(85c52e162fed56f9)., QStringcxx . . $ QString# genre = ""cxx . . $ QString#QString(85c52e162fed56f9)., QStringcxx . . $ QString# artist = ""cxx . . $ QString#QString(85c52e162fed56f9).) |
| 60 | { |
| 61 | QStringcxx . . $ QString# ret = ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 62 | if (!path.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 63 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND lower(tags.url) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). path.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') "; |
| 64 | if (!genre.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 65 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND lower(genre.name) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). genre.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') "; |
| 66 | if (!artist.isEmptycxx . . $ QString#isEmpty(50ce9a9e25b4a850).()) |
| 67 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). "AND lower(artist.name) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). artist.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') "; |
| 68 | return retcxx . . $ QString#QString(28715ad661ad3cec).; |
| 69 | } |
| 70 | |
| 71 | QStringcxx . . $ QString# selectionFilterForRandomcxx . . $ CollectionDbPrivate#selectionFilterForRandom(b8221c6d8e424640).(QStringListcxx . . $ QStringList# paths, QStringListcxx . . $ QStringList# genres, QStringListcxx . . $ QStringList# artists) |
| 72 | { |
| 73 | QStringcxx . . $ QString# ret = ""cxx . . $ QString#QString(85c52e162fed56f9).; |
| 74 | if (!paths.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 75 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "AND ( "; |
| 76 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString path, paths) |
| 77 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). " lower(tags.url) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). path.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') OR "; |
| 78 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). " 1=2) "; |
| 79 | } |
| 80 | if (!genres.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 81 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "AND ( "; |
| 82 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString genre, genres) |
| 83 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). " lower(genre.name) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). genre.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') OR "; |
| 84 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). " 1=2) "; |
| 85 | } |
| 86 | if (!artists.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 87 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). "AND ( "; |
| 88 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString artist, artists) |
| 89 | ret +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). " lower(artist.name) like lower('%" +cxx . . $ operator+(c75c3ae4eb9af1a8). artist.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).) +cxx . . $ operator+(3d22f08efddf8107). "%') OR "; |
| 90 | ret +=cxx . . $ QString#`operator+=`(d02845eef0c33901). " 1=2) "; |
| 91 | } |
| 92 | return retcxx . . $ QString#QString(28715ad661ad3cec).; |
| 93 | } |
| 94 | }; |
| 95 | |
| 96 | CollectionDBcxx . . $ CollectionDB#::CollectionDBcxx . . $ CollectionDB#CollectionDB(49f6e7a06ebc5aa8).() |
| 97 | { |
| 98 | pcxx . . $ CollectionDB#p. = new CollectionDbPrivatecxx . . $ CollectionDbPrivate#; |
| 99 | dbcxx . . $ CollectionDB#db. =cxx . . $ QSqlDatabase#`operator=`(2177ac2a3cc07b15). QSqlDatabasecxx . . $ QSqlDatabase#::databasecxx . . $ QSqlDatabase#database(798f65c2bb0fade).(); |
| 100 | |
| 101 | pcxx . . $ CollectionDB#p.->dbcxx . . $ CollectionDbPrivate#db. = &dbcxx . . $ CollectionDB#db.; |
| 102 | pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query. = new QSqlQuerycxx . . $ QSqlQuery#QSqlQuery(97d270f85671d6c3).(*cxx . . $ QSqlDatabase#QSqlDatabase(b3df2939303ae7a3).(pcxx . . $ CollectionDB#p.->dbcxx . . $ CollectionDbPrivate#db.)); |
| 103 | |
| 104 | pcxx . . $ CollectionDB#p.->genreCountcxx . . $ CollectionDbPrivate#genreCount. = 0; |
| 105 | pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. = 0; |
| 106 | pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).(""); |
| 107 | |
| 108 | pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. =cxx . . $ QString#`operator=`(d02845eef0c33901). "FROM tags " |
| 109 | " INNER JOIN artist ON tags.artist = artist.id " |
| 110 | " INNER JOIN album ON tags.album = album.id " |
| 111 | " INNER JOIN year ON tags.year = year.id " |
| 112 | " INNER JOIN genre ON tags.genre = genre.id " |
| 113 | " LEFT OUTER JOIN statistics ON tags.url = statistics.url " |
| 114 | " LEFT OUTER JOIN favorites ON tags.url = favorites.url WHERE 1=1 "; |
| 115 | |
| 116 | pcxx . . $ CollectionDB#p.->sqlFromStringPLcxx . . $ CollectionDbPrivate#sqlFromStringPL. =cxx . . $ QString#`operator=`(d02845eef0c33901). "FROM tags " |
| 117 | " INNER JOIN artist ON tags.artist = artist.id " |
| 118 | " INNER JOIN album ON tags.album = album.id " |
| 119 | " INNER JOIN year ON tags.year = year.id " |
| 120 | " INNER JOIN genre ON tags.genre = genre.id " |
| 121 | " INNER JOIN playlists ON tags.url = playlists.url " |
| 122 | " LEFT OUTER JOIN statistics ON tags.url = statistics.url " |
| 123 | " LEFT OUTER JOIN favorites ON tags.url = favorites.url WHERE 1=1 "; |
| 124 | } |
| 125 | |
| 126 | CollectionDBcxx . . $ CollectionDB#::~cxx . . $ CollectionDB#`~CollectionDB`(ced63f7c635d850d).CollectionDBcxx . . $ CollectionDB#() |
| 127 | { |
| 128 | dbcxx . . $ CollectionDB#db..closecxx . . $ QSqlDatabase#close(49f6e7a06ebc5aa8).(); |
| 129 | delete pcxx . . $ CollectionDB#p.; |
| 130 | pcxx . . $ CollectionDB#p. = nullptr; |
| 131 | } |
| 132 | |
| 133 | QStringcxx . . $ QString# |
| 134 | CollectionDBcxx . . $ CollectionDB#::escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(QStringcxx . . $ QString# string) |
| 135 | { |
| 136 | string.replacecxx . . $ QString#replace(192e628656427d1c).("'"cxx . . $ QString#QString(85c52e162fed56f9)., "''"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 137 | return stringcxx . . $ QString#QString(28715ad661ad3cec).; |
| 138 | } |
| 139 | |
| 140 | void CollectionDBcxx . . $ CollectionDB#::setFilterStringcxx . . $ CollectionDB#setFilterString(7df51288a9ebd664).(QStringcxx . . $ QString# string) |
| 141 | { |
| 142 | string =cxx . . $ QString#`operator=`(4f35bf974e7f8568). escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(stringcxx . . $ QString#QString(132dd6869045752b).); |
| 143 | pcxx . . $ CollectionDB#p.->filterStringcxx . . $ CollectionDbPrivate#filterString. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). string; |
| 144 | pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. =cxx . . $ QString#`operator=`(d02845eef0c33901). ""; |
| 145 | |
| 146 | foreachcxx . . $ `<external>/15045578679651060896/qglobal.h:1145:13`! (QString token, string.split(" ")) { |
| 147 | pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. +=cxx . . $ QString#`operator+=`(6a89d0b7f4d2681c). QStringcxx . . $ QString#QString(85c52e162fed56f9).(" AND ( lower(artist.name) LIKE lower('%%1%') OR " |
| 148 | "lower(album.name) LIKE lower('%%1%') OR " |
| 149 | "lower(tags.title) LIKE lower('%%1%') OR " |
| 150 | "lower(genre.name) LIKE lower('%%1%') OR " |
| 151 | "lower(year.name) LIKE lower('%%1%') OR " |
| 152 | "lower(tags.url) LIKE lower('%%1%') )") |
| 153 | .argcxx . . $ QString#arg(bc823072288cbbb5).(token); |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | bool CollectionDBcxx . . $ CollectionDB#::isDbValidcxx . . $ CollectionDB#isDbValid(c9857a73d68e59ba).() |
| 158 | { |
| 159 | if ((!executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("SELECT COUNT( url ) FROM tags;"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 160 | || (!executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("SELECT COUNT( url ) FROM statistics;"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 161 | || (!executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("SELECT COUNT( url ) FROM favorites;"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 162 | || (!executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("SELECT COUNT( url ) FROM playlists;"cxx . . $ QString#QString(85c52e162fed56f9).))) |
| 163 | return false; |
| 164 | else |
| 165 | return true; |
| 166 | } |
| 167 | |
| 168 | bool CollectionDBcxx . . $ CollectionDB#::isEmptycxx . . $ CollectionDB#isEmpty(c9857a73d68e59ba).() |
| 169 | { |
| 170 | return (selectSqlNumbercxx . . $ CollectionDB#selectSqlNumber(5e0eb495a084d520).("SELECT COUNT( url ) FROM tags;"cxx . . $ QString#QString(85c52e162fed56f9).) < 1); |
| 171 | } |
| 172 | |
| 173 | void CollectionDBcxx . . $ CollectionDB#::incSongCountercxx . . $ CollectionDB#incSongCounter(7df51288a9ebd664).(const QStringcxx . . $ QString# url) |
| 174 | { |
| 175 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> entriescxx . . $ QList#QList(ced63f7c635d850d).; |
| 176 | |
| 177 | entries =cxx . . $ QList#`operator=`(fb6690361a2f6b44). selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("SELECT playcounter, createdate FROM statistics WHERE url = '%1';") |
| 178 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(urlcxx . . $ QString#QString(132dd6869045752b).))); |
| 179 | |
| 180 | if (!entries.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) { |
| 181 | // entry exists, increment playcounter and update accesstime |
| 182 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REPLACE INTO statistics ( url, createdate, accessdate, playcounter ) VALUES ( '%1', '%2', strftime('%s', 'now'), %3 );") |
| 183 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(urlcxx . . $ QString#QString(132dd6869045752b).)) |
| 184 | .argcxx . . $ QString#arg(bc823072288cbbb5).(entries.atcxx . . $ QList#at(e2681f9bb6b2f357).(0)[cxx . . $ QList#`operator[]`(e2681f9bb6b2f357).1]) |
| 185 | .argcxx . . $ QString#arg(bc823072288cbbb5).(entries.atcxx . . $ QList#at(e2681f9bb6b2f357).(0)[cxx . . $ QList#`operator[]`(e2681f9bb6b2f357).0] +cxx . . $ operator+(3d22f08efddf8107). " + 1")); |
| 186 | } else { |
| 187 | // entry didnt exist yet, create a new one |
| 188 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("INSERT INTO statistics ( url, createdate, accessdate, playcounter ) VALUES ( '%1', strftime('%s', 'now'), strftime('%s', 'now'), 1 );") |
| 189 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(urlcxx . . $ QString#QString(132dd6869045752b).))); |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | void CollectionDBcxx . . $ CollectionDB#::setSongRatecxx . . $ CollectionDB#setSongRate(f2e9810b37c242c3).(const QStringcxx . . $ QString# url, int rate) |
| 194 | { |
| 195 | // insert or update increment favorites |
| 196 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("INSERT OR REPLACE INTO favorites ( url, changedate, rate ) VALUES ( '%1', strftime('%s', 'now'), %2 );") |
| 197 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(urlcxx . . $ QString#QString(132dd6869045752b).)) |
| 198 | .argcxx . . $ QString#arg(64ab2ed17cc11715).(rate)); |
| 199 | } |
| 200 | |
| 201 | void CollectionDBcxx . . $ CollectionDB#::resetSongCountercxx . . $ CollectionDB#resetSongCounter(49f6e7a06ebc5aa8).() |
| 202 | { |
| 203 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DELETE FROM statistics;")); |
| 204 | //executeSql( QString( "VACUUM;")); |
| 205 | } |
| 206 | |
| 207 | void CollectionDBcxx . . $ CollectionDB#::updateDirStatscxx . . $ CollectionDB#updateDirStats(a681021b9d4cbed8).(QStringcxx . . $ QString# path, const long datetime) |
| 208 | { |
| 209 | if (path.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).("/"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 210 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). path.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(path.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 1); |
| 211 | |
| 212 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REPLACE INTO directories ( dir, changedate ) VALUES ( '%1', %2 );") |
| 213 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(pathcxx . . $ QString#QString(132dd6869045752b).)) |
| 214 | .argcxx . . $ QString#arg(def43e8914d794d2).(datetime)); |
| 215 | } |
| 216 | |
| 217 | void CollectionDBcxx . . $ CollectionDB#::removeSongsInDircxx . . $ CollectionDB#removeSongsInDir(7df51288a9ebd664).(QStringcxx . . $ QString# path) |
| 218 | { |
| 219 | if (path.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).("/"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 220 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). path.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(path.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 1); |
| 221 | |
| 222 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DELETE FROM tags WHERE dir = '%1';") |
| 223 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(pathcxx . . $ QString#QString(132dd6869045752b).))); |
| 224 | } |
| 225 | |
| 226 | bool CollectionDBcxx . . $ CollectionDB#::isDirInCollectioncxx . . $ CollectionDB#isDirInCollection(7dc6c9a0b6a7270f).(QStringcxx . . $ QString# path) |
| 227 | { |
| 228 | if (path.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).("/"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 229 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). path.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(path.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 1); |
| 230 | |
| 231 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> entries = selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("SELECT changedate FROM directories WHERE dir = '%1';") |
| 232 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(pathcxx . . $ QString#QString(132dd6869045752b).))); |
| 233 | |
| 234 | return !entries.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).(); |
| 235 | } |
| 236 | |
| 237 | void CollectionDBcxx . . $ CollectionDB#::removeDirFromCollectioncxx . . $ CollectionDB#removeDirFromCollection(7df51288a9ebd664).(QStringcxx . . $ QString# path) |
| 238 | { |
| 239 | if (path.endsWithcxx . . $ QString#endsWith(8cce4688c16f48f3).("/"cxx . . $ QString#QString(85c52e162fed56f9).)) |
| 240 | path =cxx . . $ QString#`operator=`(4f35bf974e7f8568). path.leftcxx . . $ QString#left(3f3c3d0e9c0eb37f).(path.lengthcxx . . $ QString#length(455f465bc33b4cdf).() - 1); |
| 241 | |
| 242 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DELETE FROM directories WHERE dir = '%1';") |
| 243 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(pathcxx . . $ QString#QString(132dd6869045752b).))); |
| 244 | } |
| 245 | |
| 246 | void CollectionDBcxx . . $ CollectionDB#::removePlaylistcxx . . $ CollectionDB#removePlaylist(7df51288a9ebd664).(QStringcxx . . $ QString# name) |
| 247 | { |
| 248 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DELETE FROM playlists WHERE name = '%1';") |
| 249 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(namecxx . . $ QString#QString(132dd6869045752b).))); |
| 250 | } |
| 251 | |
| 252 | long CollectionDBcxx . . $ CollectionDB#::selectSqlNumbercxx . . $ CollectionDB#selectSqlNumber(5e0eb495a084d520).(const QStringcxx . . $ QString#& statement) |
| 253 | { |
| 254 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..lockcxx . . $ QMutex#lock(ced63f7c635d850d).(); |
| 255 | |
| 256 | if (pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->execcxx . . $ QSqlQuery#exec(e1defb592416720d).(statement)) { |
| 257 | while (pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->nextcxx . . $ QSqlQuery#next(c9857a73d68e59ba).()) { |
| 258 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 259 | return pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->valuecxx . . $ QSqlQuery#value(fb36142a814bbf95).(0).toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 260 | } |
| 261 | } else |
| 262 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ `operator<<`(f4a0dc96c19fdafb). pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->lastErrorcxx . . $ QSqlQuery#lastError(b02d9d6c0f4da678).(); |
| 263 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 264 | return -1; |
| 265 | } |
| 266 | |
| 267 | bool CollectionDBcxx . . $ CollectionDB#::executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(const QStringcxx . . $ QString#& statement) |
| 268 | { |
| 269 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..lockcxx . . $ QMutex#lock(ced63f7c635d850d).(); |
| 270 | |
| 271 | if (pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->execcxx . . $ QSqlQuery#exec(e1defb592416720d).(statement)) { |
| 272 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 273 | return true; |
| 274 | } else { |
| 275 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ `operator<<`(f4a0dc96c19fdafb). pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->lastErrorcxx . . $ QSqlQuery#lastError(b02d9d6c0f4da678).(); |
| 276 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "Statement: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). statement; |
| 277 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 278 | return false; |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(const QStringcxx . . $ QString#& statement) |
| 283 | { |
| 284 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> tagscxx . . $ QList#QList(ced63f7c635d850d).; |
| 285 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..lockcxx . . $ QMutex#lock(ced63f7c635d850d).(); |
| 286 | tags.clearcxx . . $ QList#clear(49f6e7a06ebc5aa8).(); |
| 287 | int count; |
| 288 | |
| 289 | if (pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->execcxx . . $ QSqlQuery#exec(e1defb592416720d).(statement)) { |
| 290 | while (pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->nextcxx . . $ QSqlQuery#next(c9857a73d68e59ba).()) { |
| 291 | QStringListcxx . . $ QStringList# tagcxx . . $ QStringList#QStringList(ced63f7c635d850d).; |
| 292 | count = pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->recordcxx . . $ QSqlQuery#record(bb20731da56c592d).().countcxx . . $ QSqlRecord#count(455f465bc33b4cdf).(); |
| 293 | for (int i = 0; i < count; i++) { |
| 294 | tag <<cxx . . $ QStringList#`operator<<`(85116071a693d053). pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->valuecxx . . $ QSqlQuery#value(fb36142a814bbf95).(i).toStringcxx . . $ QVariant#toString(6ef7b6c27b00b43d).(); |
| 295 | } |
| 296 | tags <<cxx . . $ QList#`operator<<`(309d1580d8f5dc58). tag; |
| 297 | } |
| 298 | } else { |
| 299 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ `operator<<`(f4a0dc96c19fdafb). pcxx . . $ CollectionDB#p.->dbcxx . . $ CollectionDbPrivate#db.->lastErrorcxx . . $ QSqlDatabase#lastError(b02d9d6c0f4da678).() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "\n" |
| 300 | <<cxx . . $ `operator<<`(f4a0dc96c19fdafb). pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->lastErrorcxx . . $ QSqlQuery#lastError(b02d9d6c0f4da678).(); |
| 301 | qDebugcxx . . $ `<external>/10450329605257866924/qlogging.h:164:9`!() <<cxx . . $ QDebug#`operator<<`(d8a917b173851aad). "SQL-query: " <<cxx . . $ QDebug#`operator<<`(4cf17434affdd8). statement; |
| 302 | } |
| 303 | |
| 304 | pcxx . . $ CollectionDB#p.->mutexcxx . . $ CollectionDbPrivate#mutex..unlockcxx . . $ QMutex#unlock(ced63f7c635d850d).(); |
| 305 | return tagscxx . . $ QList#QList(88d75cd4b19cb2d1).; |
| 306 | } |
| 307 | |
| 308 | void CollectionDBcxx . . $ CollectionDB#::createTablescxx . . $ CollectionDB#createTables(b45ddcbc8423892c).(bool temporary) |
| 309 | { |
| 310 | 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`!; |
| 311 | |
| 312 | //create tag table |
| 313 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE %1 TABLE tags%2 (" |
| 314 | "%3" |
| 315 | "url VARCHAR(120)," |
| 316 | "dir VARCHAR(100)," |
| 317 | "artist INTEGER," |
| 318 | "title VARCHAR(100)," |
| 319 | "album INTEGER," |
| 320 | "genre INTEGER," |
| 321 | "year INTEGER," |
| 322 | "length INTEGER," |
| 323 | "track NUMBER(4) );") |
| 324 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "TEMPORARY" : "") |
| 325 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 326 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "id INTEGER," : "id INTEGER PRIMARY KEY,")); |
| 327 | |
| 328 | //create album table |
| 329 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE %1 TABLE album%2 (" |
| 330 | "id INTEGER PRIMARY KEY," |
| 331 | "name VARCHAR(100) );") |
| 332 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "TEMPORARY" : "") |
| 333 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 334 | |
| 335 | //create artist table |
| 336 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE %1 TABLE artist%2 (" |
| 337 | "id INTEGER PRIMARY KEY," |
| 338 | "name VARCHAR(100) );") |
| 339 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "TEMPORARY" : "") |
| 340 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 341 | |
| 342 | //create genre table |
| 343 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE %1 TABLE genre%2 (" |
| 344 | "id INTEGER PRIMARY KEY," |
| 345 | "name VARCHAR(100) );") |
| 346 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "TEMPORARY" : "") |
| 347 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 348 | |
| 349 | //create year table |
| 350 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE %1 TABLE year%2 (" |
| 351 | "id INTEGER PRIMARY KEY," |
| 352 | "name VARCHAR(100) );") |
| 353 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "TEMPORARY" : "") |
| 354 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 355 | |
| 356 | //create indexes |
| 357 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE INDEX album_idx%1 ON album%2( name );") |
| 358 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 359 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 360 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE INDEX artist_idx%1 ON artist%2( name );") |
| 361 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 362 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 363 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE INDEX genre_idx%1 ON genre%2( name );") |
| 364 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 365 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 366 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE INDEX year_idx%1 ON year%2( name );") |
| 367 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 368 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 369 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE INDEX url_idx%1 ON tags%2( url );") |
| 370 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "") |
| 371 | .argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 372 | |
| 373 | if (!temporary) { |
| 374 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("CREATE INDEX album_tag ON tags( album );"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 375 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("CREATE INDEX artist_tag ON tags( artist );"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 376 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("CREATE INDEX genre_tag ON tags( genre );"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 377 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("CREATE INDEX year_tag ON tags( year );"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 378 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("CREATE INDEX url_tag ON tags( url );"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 379 | |
| 380 | // create directory statistics database |
| 381 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE TABLE IF NOT EXISTS directories (" |
| 382 | "dir VARCHAR(100) UNIQUE," |
| 383 | "changedate INTEGER );")); |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | void CollectionDBcxx . . $ CollectionDB#::dropTablescxx . . $ CollectionDB#dropTables(b45ddcbc8423892c).(bool temporary) |
| 388 | { |
| 389 | 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`!; |
| 390 | |
| 391 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DROP TABLE tags%1;").argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 392 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DROP TABLE album%1;").argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 393 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DROP TABLE artist%1;").argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 394 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DROP TABLE genre%1;").argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 395 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DROP TABLE year%1;").argcxx . . $ QString#arg(bc823072288cbbb5).(temporarycxx . . $ QString#QString(85c52e162fed56f9). ? "_temp" : "")); |
| 396 | |
| 397 | // force to re-read over all count for random entry |
| 398 | pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. = 0; |
| 399 | } |
| 400 | |
| 401 | void CollectionDBcxx . . $ CollectionDB#::moveTempTablescxx . . $ CollectionDB#moveTempTables(49f6e7a06ebc5aa8).() |
| 402 | { |
| 403 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("INSERT INTO tags SELECT * FROM tags_temp;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 404 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("INSERT INTO album SELECT * FROM album_temp;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 405 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("INSERT INTO artist SELECT * FROM artist_temp;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 406 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("INSERT INTO genre SELECT * FROM genre_temp;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 407 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("INSERT INTO year SELECT * FROM year_temp;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 408 | |
| 409 | // Re-create index to be fast as possible |
| 410 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX album_idx;")); |
| 411 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX artist_idx;")); |
| 412 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX genre_idx;")); |
| 413 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX year_idx;")); |
| 414 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX url_idx;")); |
| 415 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX album_tag;")); |
| 416 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX artist_tag;")); |
| 417 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX genre_tag;")); |
| 418 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX year_tag;")); |
| 419 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("REINDEX url_tag;")); |
| 420 | } |
| 421 | |
| 422 | void CollectionDBcxx . . $ CollectionDB#::createStatsTablecxx . . $ CollectionDB#createStatsTable(49f6e7a06ebc5aa8).() |
| 423 | { |
| 424 | 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`!; |
| 425 | |
| 426 | // create music statistics database |
| 427 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE TABLE statistics (" |
| 428 | "url VARCHAR(120) UNIQUE," |
| 429 | "createdate INTEGER," |
| 430 | "accessdate INTEGER," |
| 431 | "playcounter INTEGER );")); |
| 432 | |
| 433 | // create music favorites database |
| 434 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE TABLE favorites (" |
| 435 | "url VARCHAR(120) UNIQUE," |
| 436 | "changedate INTEGER," |
| 437 | "rate INTEGER );")); |
| 438 | |
| 439 | // create playlist database |
| 440 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("CREATE TABLE playlists (" |
| 441 | "url VARCHAR(120)," |
| 442 | "name VARCHAR(60)," |
| 443 | "length INTEGER," |
| 444 | "changedate INTEGER," |
| 445 | "flags INTEGER," |
| 446 | "norder INTEGER," |
| 447 | "UNIQUE(url, name) ON CONFLICT REPLACE);")); |
| 448 | } |
| 449 | |
| 450 | void CollectionDBcxx . . $ CollectionDB#::dropStatsTablecxx . . $ CollectionDB#dropStatsTable(49f6e7a06ebc5aa8).() |
| 451 | { |
| 452 | 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`!; |
| 453 | |
| 454 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("DROP TABLE statistics;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 455 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("DROP TABLE favorites;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 456 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).("DROP TABLE playlists;"cxx . . $ QString#QString(85c52e162fed56f9).); |
| 457 | } |
| 458 | |
| 459 | void CollectionDBcxx . . $ CollectionDB#::purgeDirCachecxx . . $ CollectionDB#purgeDirCache(49f6e7a06ebc5aa8).() |
| 460 | { |
| 461 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(QStringcxx . . $ QString#QString(85c52e162fed56f9).("DELETE FROM directories;")); |
| 462 | } |
| 463 | |
| 464 | ulongcxx . . $ ulong# CollectionDBcxx . . $ CollectionDB#::getValueIDcxx . . $ CollectionDB#getValueID(f3056d5d9bf66617).(QStringcxx . . $ QString# name, QStringcxx . . $ QString# value, bool autocreate, bool useTempTables) |
| 465 | { |
| 466 | |
| 467 | if (useTempTables) |
| 468 | name.appendcxx . . $ QString#append(d02845eef0c33901).("_temp"); |
| 469 | |
| 470 | QStringcxx . . $ QString# command = QStringcxx . . $ QString#QString(85c52e162fed56f9).("SELECT id FROM %1 WHERE name LIKE '%2';") |
| 471 | .argcxx . . $ QString#arg(bc823072288cbbb5).(name) |
| 472 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(valuecxx . . $ QString#QString(132dd6869045752b).)); |
| 473 | long id = selectSqlNumbercxx . . $ CollectionDB#selectSqlNumber(5e0eb495a084d520).(command); |
| 474 | |
| 475 | //check if item exists. if not, should we autocreate it? |
| 476 | if (id < 0 && autocreate) { |
| 477 | command =cxx . . $ QString#`operator=`(4f35bf974e7f8568). QStringcxx . . $ QString#QString(85c52e162fed56f9).("INSERT INTO %1 ( name ) VALUES ( '%2' );") |
| 478 | .argcxx . . $ QString#arg(bc823072288cbbb5).(name) |
| 479 | .argcxx . . $ QString#arg(bc823072288cbbb5).(escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(valuecxx . . $ QString#QString(132dd6869045752b).)); |
| 480 | |
| 481 | executeSqlcxx . . $ CollectionDB#executeSql(e1defb592416720d).(command); |
| 482 | return pcxx . . $ CollectionDB#p.->querycxx . . $ CollectionDbPrivate#query.->lastInsertIdcxx . . $ QSqlQuery#lastInsertId(23280f95d1ccaa1f).().toIntcxx . . $ QVariant#toInt(5bd9a3493f6a7a21).(); |
| 483 | } |
| 484 | |
| 485 | return id; |
| 486 | } |
| 487 | |
| 488 | QStringListcxx . . $ QStringList# CollectionDBcxx . . $ CollectionDB#::getRandomEntrycxx . . $ CollectionDB#getRandomEntry(8e8f2f8532ff0672).(QStringcxx . . $ QString# path, QStringcxx . . $ QString# genre, QStringcxx . . $ QString# artist) |
| 489 | { |
| 490 | |
| 491 | // retrieve Max_Count |
| 492 | |
| 493 | if (genre !=cxx . . $ `operator!=`(5bc2975d2d751687). pcxx . . $ CollectionDB#p.->lastGenrecxx . . $ CollectionDbPrivate#lastGenre. |
| 494 | || artist !=cxx . . $ `operator!=`(5bc2975d2d751687). pcxx . . $ CollectionDB#p.->lastArtistcxx . . $ CollectionDbPrivate#lastArtist. |
| 495 | || path !=cxx . . $ `operator!=`(5bc2975d2d751687). pcxx . . $ CollectionDB#p.->lastPathcxx . . $ CollectionDbPrivate#lastPath. |
| 496 | || pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. == 0) { |
| 497 | //new filter > get new count |
| 498 | pcxx . . $ CollectionDB#p.->lastGenrecxx . . $ CollectionDbPrivate#lastGenre. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). genre; |
| 499 | pcxx . . $ CollectionDB#p.->lastArtistcxx . . $ CollectionDbPrivate#lastArtist. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). artist; |
| 500 | pcxx . . $ CollectionDB#p.->lastPathcxx . . $ CollectionDbPrivate#lastPath. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). path; |
| 501 | |
| 502 | pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. = getCountcxx . . $ CollectionDB#getCount(4b1632ee4ca0317d).(pathcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b).); |
| 503 | } |
| 504 | |
| 505 | if (pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. > 0) { |
| 506 | long randomID = (qrandcxx . . $ qrand(b126dc7c1de90089).() % pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount.); |
| 507 | //qebug() << QString::number(randomID); |
| 508 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> entries = selectRandomEntrycxx . . $ CollectionDB#selectRandomEntry(e2c73df4e0ebaeed).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f6cb4ef476e726c4).(randomID), pathcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b).); |
| 509 | |
| 510 | if (!entries.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) |
| 511 | return entries.atcxx . . $ QList#at(e2681f9bb6b2f357).(0); |
| 512 | else |
| 513 | return QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).(); |
| 514 | } else { |
| 515 | 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). " No Track found matching filter"; |
| 516 | return QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).(); |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | QStringListcxx . . $ QStringList# CollectionDBcxx . . $ CollectionDB#::getRandomEntrycxx . . $ CollectionDB#getRandomEntry(669a05bc42dd57cc).() |
| 521 | { |
| 522 | double randMax; |
| 523 | |
| 524 | randMax = RAND_MAXcxx . . $ `<external>/10696550936717951914/stdlib.h:87:9`!; |
| 525 | |
| 526 | if (pcxx . . $ CollectionDB#p.->filterStringcxx . . $ CollectionDbPrivate#filterString. !=cxx . . $ `operator!=`(5bc2975d2d751687). pcxx . . $ CollectionDB#p.->lastFilterStringcxx . . $ CollectionDbPrivate#lastFilterString. || pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. == 0) { |
| 527 | //new genre > get new count |
| 528 | pcxx . . $ CollectionDB#p.->lastFilterStringcxx . . $ CollectionDbPrivate#lastFilterString. =cxx . . $ QString#`operator=`(b79fde0b0ce9b948). pcxx . . $ CollectionDB#p.->filterStringcxx . . $ CollectionDbPrivate#filterString.; |
| 529 | pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount. = getCountcxx . . $ CollectionDB#getCount(f708dce9a8856c70).(); |
| 530 | } |
| 531 | |
| 532 | long randomID = (qrandcxx . . $ qrand(b126dc7c1de90089).() / randMax) * pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount.; |
| 533 | //qDebug() << QString::number(randomID); |
| 534 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> entries = selectRandomEntrycxx . . $ CollectionDB#selectRandomEntry(e2c73df4e0ebaeed).(QStringcxx . . $ QString#::numbercxx . . $ QString#number(f6cb4ef476e726c4).(randomID)); |
| 535 | |
| 536 | if (!entries.isEmptycxx . . $ QList#isEmpty(3482b152b9333168).()) |
| 537 | return entries.atcxx . . $ QList#at(e2681f9bb6b2f357).(0); |
| 538 | else |
| 539 | return QStringListcxx . . $ QStringList#QStringList(ced63f7c635d850d).(); |
| 540 | } |
| 541 | |
| 542 | ulongcxx . . $ ulong# CollectionDBcxx . . $ CollectionDB#::getCountcxx . . $ CollectionDB#getCount(f708dce9a8856c70).() |
| 543 | { |
| 544 | QStringcxx . . $ QString# command = "SELECT count(distinct tags.url) " |
| 545 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 546 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter.; |
| 547 | |
| 548 | return selectSqlNumbercxx . . $ CollectionDB#selectSqlNumber(5e0eb495a084d520).(command); |
| 549 | } |
| 550 | |
| 551 | QPaircxx . . $ QPair#<int, int> CollectionDBcxx . . $ CollectionDB#::getCountcxx . . $ CollectionDB#getCount(42e7798a7ecb90db).(QStringListcxx . . $ QStringList# paths, QStringListcxx . . $ QStringList# genres, QStringListcxx . . $ QStringList# artists) |
| 552 | { |
| 553 | QStringcxx . . $ QString# command = "SELECT count(distinct tags.url), sum(tags.length) FROM tags, artist, genre " |
| 554 | " WHERE tags.artist = artist.id " |
| 555 | " AND tags.artist = artist.id " |
| 556 | " AND tags.genre = genre.id " |
| 557 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->selectionFilterForRandomcxx . . $ CollectionDbPrivate#selectionFilterForRandom(b8221c6d8e424640).(paths, genres, artists) +cxx . . $ operator+(3d22f08efddf8107). ";"; |
| 558 | |
| 559 | QStringListcxx . . $ QStringList# result = selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command).atcxx . . $ QList#at(e2681f9bb6b2f357).(0); |
| 560 | QPaircxx . . $ QPair#<int, int> paircxx . . $ QPair#QPair(7d94e3e767b7b77f).; |
| 561 | pair.firstcxx . . $ QPair#first. = result[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).0].toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 562 | pair.secondcxx . . $ QPair#second. = result[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).1].toIntcxx . . $ QString#toInt(d7972accae11ee1f).(); |
| 563 | |
| 564 | return pair; |
| 565 | } |
| 566 | |
| 567 | uintcxx . . $ uint# CollectionDBcxx . . $ CollectionDB#::getCountcxx . . $ CollectionDB#getCount(4b1632ee4ca0317d).(QStringcxx . . $ QString# path, QStringcxx . . $ QString# genre, QStringcxx . . $ QString# artist) |
| 568 | { |
| 569 | QStringcxx . . $ QString# command = "SELECT count(distinct tags.url), sum(tags.length) FROM tags, artist, genre " |
| 570 | " WHERE tags.artist = artist.id " |
| 571 | " AND tags.artist = artist.id " |
| 572 | " AND tags.genre = genre.id " |
| 573 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->selectionFilterForRandomcxx . . $ CollectionDbPrivate#selectionFilterForRandom(9e1571a6b06697ca).(pathcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). ";"; |
| 574 | |
| 575 | QStringListcxx . . $ QStringList# result = selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command).atcxx . . $ QList#at(e2681f9bb6b2f357).(0); |
| 576 | |
| 577 | pcxx . . $ CollectionDB#p.->resultLengthcxx . . $ CollectionDbPrivate#resultLength. = result[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).1].toLongcxx . . $ QString#toLong(9627c40b2a14c302).(); |
| 578 | |
| 579 | return result[cxx . . $ QList#`operator[]`(7a0ef1c7079e8533).0].toLongcxx . . $ QString#toLong(9627c40b2a14c302).(); |
| 580 | } |
| 581 | |
| 582 | long CollectionDBcxx . . $ CollectionDB#::lastLengthSumcxx . . $ CollectionDB#lastLengthSum(da6335ded91d79c2).() |
| 583 | { |
| 584 | return pcxx . . $ CollectionDB#p.->resultLengthcxx . . $ CollectionDbPrivate#resultLength.; |
| 585 | } |
| 586 | |
| 587 | uintcxx . . $ uint# CollectionDBcxx . . $ CollectionDB#::lastMaxCountcxx . . $ CollectionDB#lastMaxCount(db52760e79bf9054).() |
| 588 | { |
| 589 | return pcxx . . $ CollectionDB#p.->resultCountcxx . . $ CollectionDbPrivate#resultCount.; |
| 590 | } |
| 591 | |
| 592 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectRandomEntrycxx . . $ CollectionDB#selectRandomEntry(e2c73df4e0ebaeed).(QStringcxx . . $ QString# rownum, QStringcxx . . $ QString# path, QStringcxx . . $ QString# genre, QStringcxx . . $ QString# artist) |
| 593 | { |
| 594 | QStringcxx . . $ QString# command = "SELECT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate " |
| 595 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 596 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. |
| 597 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->selectionFilterForRandomcxx . . $ CollectionDbPrivate#selectionFilterForRandom(9e1571a6b06697ca).(pathcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). " LIMIT 1 OFFSET " +cxx . . $ operator+(fab9b4f80031f353). rownum +cxx . . $ operator+(3d22f08efddf8107). ";"; |
| 598 | |
| 599 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 600 | } |
| 601 | |
| 602 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectYearscxx . . $ CollectionDB#selectYears(c58e6b6884db9162).() |
| 603 | { |
| 604 | QStringcxx . . $ QString# command = "SELECT DISTINCT year.name " |
| 605 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 606 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. +cxx . . $ operator+(3d22f08efddf8107). "AND year.name <> '' " |
| 607 | "ORDER BY year.name DESC;"; |
| 608 | |
| 609 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 610 | } |
| 611 | |
| 612 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectGenrescxx . . $ CollectionDB#selectGenres(c58e6b6884db9162).() |
| 613 | { |
| 614 | QStringcxx . . $ QString# command = "SELECT DISTINCT genre.name " |
| 615 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 616 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. +cxx . . $ operator+(3d22f08efddf8107). "AND genre.name <> '' " |
| 617 | "ORDER BY genre.name;"; |
| 618 | |
| 619 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 620 | } |
| 621 | |
| 622 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectArtistscxx . . $ CollectionDB#selectArtists(dd80deef3a1011c6).(QStringcxx . . $ QString# year, QStringcxx . . $ QString# genre) |
| 623 | { |
| 624 | QStringcxx . . $ QString# command = "SELECT DISTINCT artist.name " |
| 625 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 626 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. |
| 627 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->selectionFiltercxx . . $ CollectionDbPrivate#selectionFilter(7361bdb59968dff0).(yearcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). "AND artist.name <> '' " |
| 628 | "ORDER BY artist.name;"; |
| 629 | |
| 630 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 631 | } |
| 632 | |
| 633 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectAlbumscxx . . $ CollectionDB#selectAlbums(7bf9880d9b041173).(QStringcxx . . $ QString# year, QStringcxx . . $ QString# genre, QStringcxx . . $ QString# artist) |
| 634 | { |
| 635 | |
| 636 | QStringcxx . . $ QString# command = "SELECT DISTINCT album.name " |
| 637 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 638 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. |
| 639 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->selectionFiltercxx . . $ CollectionDbPrivate#selectionFilter(7361bdb59968dff0).(yearcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). "AND album.name <> '' " |
| 640 | "ORDER BY album.name;"; |
| 641 | |
| 642 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 643 | } |
| 644 | |
| 645 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectTrackscxx . . $ CollectionDB#selectTracks(e2c73df4e0ebaeed).(QStringcxx . . $ QString# year, QStringcxx . . $ QString# genre, QStringcxx . . $ QString# artist, QStringcxx . . $ QString# album) |
| 646 | { |
| 647 | QStringcxx . . $ QString# command = "SELECT DISTINCT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate " |
| 648 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. |
| 649 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->sqlQuickFiltercxx . . $ CollectionDbPrivate#sqlQuickFilter. |
| 650 | +cxx . . $ operator+(fab9b4f80031f353). pcxx . . $ CollectionDB#p.->selectionFiltercxx . . $ CollectionDbPrivate#selectionFilter(7361bdb59968dff0).(yearcxx . . $ QString#QString(132dd6869045752b)., genrecxx . . $ QString#QString(132dd6869045752b)., artistcxx . . $ QString#QString(132dd6869045752b)., albumcxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). "ORDER BY artist.name DESC, album.name DESC, tags.track;"; |
| 651 | |
| 652 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 653 | } |
| 654 | |
| 655 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectHotTrackscxx . . $ CollectionDB#selectHotTracks(c58e6b6884db9162).() |
| 656 | { |
| 657 | QStringcxx . . $ QString# command = "SELECT DISTINCT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate " |
| 658 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. +cxx . . $ operator+(3d22f08efddf8107). "AND statistics.playcounter>0 " |
| 659 | "ORDER BY statistics.playcounter DESC " |
| 660 | "LIMIT 20 OFFSET 0;"; |
| 661 | |
| 662 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 663 | } |
| 664 | |
| 665 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectLastTrackscxx . . $ CollectionDB#selectLastTracks(c58e6b6884db9162).() |
| 666 | { |
| 667 | QStringcxx . . $ QString# command = "SELECT DISTINCT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate " |
| 668 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. +cxx . . $ operator+(3d22f08efddf8107). "AND statistics.playcounter>0 " |
| 669 | "ORDER BY statistics.accessdate DESC " |
| 670 | "LIMIT 20 OFFSET 0;"; |
| 671 | |
| 672 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 673 | } |
| 674 | |
| 675 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectFavoritesTrackscxx . . $ CollectionDB#selectFavoritesTracks(c58e6b6884db9162).() |
| 676 | { |
| 677 | QStringcxx . . $ QString# command = "SELECT DISTINCT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate " |
| 678 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringcxx . . $ CollectionDbPrivate#sqlFromString. +cxx . . $ operator+(3d22f08efddf8107). "AND favorites.rate>0 " |
| 679 | "ORDER BY favorites.rate DESC "; |
| 680 | |
| 681 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 682 | } |
| 683 | |
| 684 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectPlaylistDatacxx . . $ CollectionDB#selectPlaylistData(c58e6b6884db9162).() |
| 685 | { |
| 686 | QStringcxx . . $ QString# command = "SELECT name, COUNT(name), SUM(length), changedate "cxx . . $ QString#QString(85c52e162fed56f9). |
| 687 | "from playlists " |
| 688 | "WHERE name <> 'defaultKnowthelist' " |
| 689 | "GROUP BY name, changedate " |
| 690 | "ORDER BY changedate DESC;"; |
| 691 | |
| 692 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 693 | } |
| 694 | |
| 695 | QListcxx . . $ QList#<QStringListcxx . . $ QStringList#> CollectionDBcxx . . $ CollectionDB#::selectPlaylistTrackscxx . . $ CollectionDB#selectPlaylistTracks(b852ae6b10e970c6).(QStringcxx . . $ QString# name) |
| 696 | { |
| 697 | QStringcxx . . $ QString# command = "SELECT tags.url, artist.name, tags.title, album.name, year.name, genre.name, tags.track, tags.length, statistics.playcounter, favorites.rate, playlists.flags " |
| 698 | +cxx . . $ operator+(c75c3ae4eb9af1a8). pcxx . . $ CollectionDB#p.->sqlFromStringPLcxx . . $ CollectionDbPrivate#sqlFromStringPL. +cxx . . $ operator+(3d22f08efddf8107). "AND playlists.name ='" +cxx . . $ operator+(fab9b4f80031f353). escapeStringcxx . . $ CollectionDB#escapeString(f7f320d754b8fd09).(namecxx . . $ QString#QString(132dd6869045752b).) +cxx . . $ operator+(3d22f08efddf8107). "' " |
| 699 | "ORDER BY playlists.norder"; |
| 700 | |
| 701 | return selectSqlcxx . . $ CollectionDB#selectSql(246915446894f09d).(command); |
| 702 | } |