Skip to content

Commit

Permalink
PlaylistDAO::getHiddenType(): don't query database if we already know…
Browse files Browse the repository at this point in the history
… the playlist type
  • Loading branch information
ronso0 committed Jan 2, 2024
1 parent 95ba470 commit e3442fc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/library/dao/playlistdao.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ int PlaylistDAO::getPlaylistId(const int index) const {
PlaylistDAO::HiddenType PlaylistDAO::getHiddenType(const int playlistId) const {
// qDebug() << "PlaylistDAO::getHiddenType"
// << QThread::currentThread() << m_database.connectionName();
if (playlistId != kInvalidPlaylistId) { // type is known, save a query
return PlaylistDAO::PLHT_UNKNOWN;
}

QSqlQuery query(m_database);
query.prepare(QStringLiteral(
Expand All @@ -533,8 +536,8 @@ PlaylistDAO::HiddenType PlaylistDAO::getHiddenType(const int playlistId) const {
} else {
LOG_FAILED_QUERY(query);
}
qDebug() << "PlaylistDAO::getHiddenType returns PLHT_UNKNOWN for playlistId "
<< playlistId;
// qDebug() << "PlaylistDAO::getHiddenType returns PLHT_UNKNOWN for playlist"
// << playlistId << getPlaylistName(playlistId);
return PLHT_UNKNOWN;
}

Expand Down Expand Up @@ -1077,7 +1080,7 @@ void PlaylistDAO::shuffleTracks(const int playlistId,
QList<int> newPositions = positions;
const int searchDistance = math_max(static_cast<int>(trackPositionIds.count()) / 4, 1);

qDebug() << "Shuffling Tracks";
qDebug() << "Shuffling tracks of playlist" << playlistId << getPlaylistName(playlistId);
qDebug() << "*** Search Distance: " << searchDistance;
//for (int z = 0; z < positions.count(); z++) {
//qDebug() << "*** Position: " << positions[z] << " | ID: " << allIds.value(positions[z]);
Expand Down

0 comments on commit e3442fc

Please sign in to comment.