From e5ff6174421904e7aeee622cc6a3a0d74342d3c3 Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:25:14 +0100 Subject: [PATCH] [datareader.cpp] Indention, no `jpg` & `png` for now, iterator reuse Addresses comments dispersed over PR #75's lengthy discussion. --- src/datareader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 50f7de7..8baf56f 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -214,16 +214,16 @@ void DataReader::readFile(QString file) QDirIterator iterator(info.dir().path(), QDirIterator::Subdirectories); while (iterator.hasNext()) { iterator.next(); - // we are explicit about two common factors, - // suffix jpg or png, basename cover or folder + // we are explicit about two common factors, the suffix .jpeg (ToDo: add .jpg and .png + // throughout all source code), and basename cover or folder if (iterator.fileInfo().isFile()) { - if ( ( iterator.fileInfo().suffix() == "jpg" || - iterator.fileInfo().suffix() == "jpeg" ) && - ( iterator.fileInfo().baseName() == "cover" || - iterator.fileInfo().baseName() == "folder" ) - ) + if ( iterator.fileInfo().suffix() == "jpeg" && + // (… || iterator.fileInfo().suffix() == "jpg" || iterator.fileInfo().suffix() == "png") && + (iterator.fileInfo().baseName() == "cover" || + iterator.fileInfo().baseName() == "folder") + ) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(m_artist, m_album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(m_artist, m_album) + iterator.fileInfo().suffix(); qDebug() << "PROCESSING FILE: " << iterator.filePath() ; QFile::copy(iterator.filePath(), th2); }