Skip to content

Commit

Permalink
[datareader.cpp] Indention, no jpg & png for now, iterator reuse
Browse files Browse the repository at this point in the history
Addresses comments dispersed over PR #75's lengthy discussion.
  • Loading branch information
Olf0 authored Mar 12, 2024
1 parent e40b964 commit e5ff617
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/datareader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e5ff617

Please sign in to comment.