mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 12:26:48 +01:00
Fix formatting
This commit is contained in:
parent
8d75f321de
commit
6accd1e3db
@ -770,12 +770,12 @@ void LibraryBackend::UpdateCompilations() {
|
|||||||
|
|
||||||
// Find the directory the song is in
|
// Find the directory the song is in
|
||||||
QUrl url = QUrl::fromEncoded(filename.toUtf8());
|
QUrl url = QUrl::fromEncoded(filename.toUtf8());
|
||||||
QString directory = url.toString(QUrl::PreferLocalFile|QUrl::RemoveFilename);
|
QString directory =
|
||||||
|
url.toString(QUrl::PreferLocalFile | QUrl::RemoveFilename);
|
||||||
|
|
||||||
CompilationInfo& info = compilation_info[directory + album];
|
CompilationInfo& info = compilation_info[directory + album];
|
||||||
info.urls << url;
|
info.urls << url;
|
||||||
if (!info.artists.contains(artist))
|
if (!info.artists.contains(artist)) info.artists << artist;
|
||||||
info.artists << artist;
|
|
||||||
if (sampler)
|
if (sampler)
|
||||||
++info.has_samplers;
|
++info.has_samplers;
|
||||||
else
|
else
|
||||||
@ -794,15 +794,14 @@ void LibraryBackend::UpdateCompilations() {
|
|||||||
for (; it != compilation_info.constEnd(); ++it) {
|
for (; it != compilation_info.constEnd(); ++it) {
|
||||||
const CompilationInfo& info = it.value();
|
const CompilationInfo& info = it.value();
|
||||||
|
|
||||||
// If there were more then one 'effective album artist' for this album directory
|
// If there were more then one 'effective album artist' for this album
|
||||||
// then it's a compilation
|
// directory then it's a compilation
|
||||||
|
|
||||||
for (const QUrl &url : info.urls) {
|
for (const QUrl& url : info.urls) {
|
||||||
if (info.artists.count() > 1) { // This directory+album is a compilation.
|
if (info.artists.count() > 1) { // This directory+album is a compilation.
|
||||||
if (info.has_not_samplers > 0)
|
if (info.has_not_samplers > 0)
|
||||||
UpdateCompilations(db, deleted_songs, added_songs, url, true);
|
UpdateCompilations(db, deleted_songs, added_songs, url, true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (info.has_samplers > 0)
|
if (info.has_samplers > 0)
|
||||||
UpdateCompilations(db, deleted_songs, added_songs, url, false);
|
UpdateCompilations(db, deleted_songs, added_songs, url, false);
|
||||||
}
|
}
|
||||||
@ -818,25 +817,24 @@ void LibraryBackend::UpdateCompilations() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LibraryBackend::UpdateCompilations(const QSqlDatabase& db,
|
void LibraryBackend::UpdateCompilations(const QSqlDatabase& db,
|
||||||
SongList& deleted_songs, SongList& added_songs,
|
SongList& deleted_songs,
|
||||||
const QUrl& url, const bool sampler) {
|
SongList& added_songs, const QUrl& url,
|
||||||
|
const bool sampler) {
|
||||||
QSqlQuery find_song(db);
|
QSqlQuery find_song(db);
|
||||||
find_song.prepare(
|
find_song.prepare(QString("SELECT ROWID, " + Song::kColumnSpec +
|
||||||
QString(
|
" FROM %1"
|
||||||
"SELECT ROWID, " + Song::kColumnSpec +
|
" WHERE filename = :filename AND sampler = "
|
||||||
" FROM %1"
|
":sampler AND unavailable = 0")
|
||||||
" WHERE filename = :filename AND sampler = :sampler AND unavailable = 0")
|
.arg(songs_table_));
|
||||||
.arg(songs_table_));
|
|
||||||
|
|
||||||
QSqlQuery update_song(db);
|
QSqlQuery update_song(db);
|
||||||
update_song.prepare(
|
update_song.prepare(
|
||||||
QString(
|
QString("UPDATE %1"
|
||||||
"UPDATE %1"
|
" SET sampler = :sampler,"
|
||||||
" SET sampler = :sampler,"
|
" effective_compilation = ((compilation OR :sampler OR "
|
||||||
" effective_compilation = ((compilation OR :sampler OR "
|
"forced_compilation_on) AND NOT forced_compilation_off) + 0"
|
||||||
"forced_compilation_on) AND NOT forced_compilation_off) + 0"
|
" WHERE filename = :filename AND unavailable = 0")
|
||||||
" WHERE filename = :filename AND unavailable = 0").arg(songs_table_));
|
.arg(songs_table_));
|
||||||
|
|
||||||
// Get song, so we can tell the model its updated
|
// Get song, so we can tell the model its updated
|
||||||
find_song.bindValue(":filename", url.toEncoded());
|
find_song.bindValue(":filename", url.toEncoded());
|
||||||
|
@ -248,9 +248,9 @@ signals:
|
|||||||
|
|
||||||
static const char* kNewScoreSql;
|
static const char* kNewScoreSql;
|
||||||
|
|
||||||
void UpdateCompilations(const QSqlDatabase& db,
|
void UpdateCompilations(const QSqlDatabase& db, SongList& deleted_songs,
|
||||||
SongList& deleted_songs, SongList& added_songs,
|
SongList& added_songs, const QUrl& url,
|
||||||
const QUrl& url, const bool sampler);
|
const bool sampler);
|
||||||
AlbumList GetAlbums(const QString& artist, const QString& album_artist,
|
AlbumList GetAlbums(const QString& artist, const QString& album_artist,
|
||||||
bool compilation = false,
|
bool compilation = false,
|
||||||
const QueryOptions& opt = QueryOptions());
|
const QueryOptions& opt = QueryOptions());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user