From 68dc7f170040418cc9ba1a8f6f9f6225ed88f5ed Mon Sep 17 00:00:00 2001 From: Mark Washeim Date: Wed, 6 Mar 2024 11:58:04 +0100 Subject: [PATCH 01/18] [Feature] add initial addition for cover art if a jpg is found in the directory as tracks are added to the db. also, correct old Generic paths, and test with sailjail. --- flowplayer.desktop | 6 ++- src/FlowPlayer.cpp | 5 +++ src/coversearch.cpp | 2 +- src/datareader.cpp | 25 +++++++++++ src/datos.cpp | 4 +- src/loadwebimage.cpp | 16 +++---- src/missing.cpp | 4 +- src/utils.cpp | 22 +++++----- translations/ca.ts | 81 ++++++++++++++++++++--------------- translations/da.ts | 81 ++++++++++++++++++++--------------- translations/de.ts | 70 +++++++++++++++++------------- translations/es.ts | 87 ++++++++++++++++++++++---------------- translations/flowplayer.ts | 62 +++++++++++++++------------ translations/fr.ts | 87 ++++++++++++++++++++++---------------- translations/it.ts | 81 ++++++++++++++++++++--------------- translations/nl.ts | 87 ++++++++++++++++++++++---------------- translations/ru.ts | 87 ++++++++++++++++++++++---------------- translations/sv.ts | 70 +++++++++++++++++------------- 18 files changed, 519 insertions(+), 358 deletions(-) diff --git a/flowplayer.desktop b/flowplayer.desktop index f87a750..8291ad7 100644 --- a/flowplayer.desktop +++ b/flowplayer.desktop @@ -6,4 +6,8 @@ Exec=flowplayer Name=FlowPlayer [X-Sailjail] -Sandboxing=Disabled +OrganizationName=sailfishos-applications +# ApplicationName does not have to be identical to Name +ApplicationName=flowplayer +# Add the required permissions here +Permissions=UserDirs;Audio;MediaIndexing;Bluetooth;Internet;RemovableMedia diff --git a/src/FlowPlayer.cpp b/src/FlowPlayer.cpp index bea8eac..3d04616 100644 --- a/src/FlowPlayer.cpp +++ b/src/FlowPlayer.cpp @@ -75,6 +75,11 @@ static void migrateCache() } QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).rmdir("flowplayer"); } + // if the media-art directory does not exist, make it. + if (!QFileInfo(newCache).isDir()) { + QDir().mkpath( newCache ); + QDir().mkpath( newCache + "/media-art" ); + } } int main(int argc, char *argv[]) diff --git a/src/coversearch.cpp b/src/coversearch.cpp index 7a53c57..f01e95c 100644 --- a/src/coversearch.cpp +++ b/src/coversearch.cpp @@ -357,7 +357,7 @@ void CoverSearch::paintImg(QString image, int index) void CoverSearch::saveImage(QString artist, QString album, QString imagepath) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(imagepath); image.save(th2, "JPEG"); diff --git a/src/datareader.cpp b/src/datareader.cpp index 17a858c..2b9c332 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -1,4 +1,5 @@ #include "datareader.h" +#include "globalutils.h" #include #include @@ -19,12 +20,15 @@ #include +#include #include +#include #include #include #include #include #include +#include extern bool databaseWorking; extern bool isDBOpened; @@ -185,6 +189,8 @@ TagLib::File* DataReader::getFileByMimeType(QString file) void DataReader::readFile(QString file) { + QString oFile = file; + file.remove("file://"); TagLib::File* tf = getFileByMimeType(file); @@ -202,6 +208,25 @@ void DataReader::readFile(QString file) m_tracknum = QString::number(tagFile->tag()->track()); if (m_title=="") m_title = QFileInfo(file).baseName(); + + // if we have artist and album, we check for a cover image. + if (m_artist != "" && m_album != "") { + QFileInfo info(file); + QDirIterator iterator(info.dir().path(), QDirIterator::Subdirectories); + while (iterator.hasNext()) { + iterator.next(); + if (!iterator.fileInfo().isDir()) { + if ( iterator.filePath().toLower().endsWith(".jpg") || + iterator.filePath().toLower().endsWith(".jpeg") ) + { + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(m_artist, m_album) + ".jpeg"; + qDebug() << "PROCESSING FILE: " << iterator.filePath() ; + QFile::copy(iterator.filePath(), th2 ); + } + } + } + } + if (m_artist=="") m_artist = tr("Unknown artist"); if (m_album=="") m_album = tr("Unknown album"); diff --git a/src/datos.cpp b/src/datos.cpp index 67e9fbe..f202fbf 100644 --- a/src/datos.cpp +++ b/src/datos.cpp @@ -29,7 +29,7 @@ bool namefileLessThan(const QStringList &d1, const QStringList &d2) QString Datos::getThumbnail(QString data, int index) { - QString th1 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ data + ".jpeg"; + QString th1 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ data + ".jpeg"; /*QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/flowplayer/62/album-"+ data + ".jpeg"; @@ -320,7 +320,7 @@ void Datos::DatosPrivate::populateItems() item->band = q->listado[i][3]; item->songs = q->listado[i][4]; item->hash = doubleHash(item->acount=="1"? item->artist : item->title, item->title); - item->coverart = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ item->hash + ".jpeg"; + item->coverart = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ item->hash + ".jpeg"; item->isSelected = false; } else if (groupFilter=="artist") { item->artist = q->listado[i][1]=="1"? tr("1 album") : tr("%1 albums").arg( q->listado[i][1].toInt()); diff --git a/src/loadwebimage.cpp b/src/loadwebimage.cpp index d438547..600a1c9 100644 --- a/src/loadwebimage.cpp +++ b/src/loadwebimage.cpp @@ -80,7 +80,7 @@ bool WebThread::checkInternal() if (QFileInfo(dir + "/folder.jpg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/folder.jpg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -89,7 +89,7 @@ bool WebThread::checkInternal() else if (QFileInfo(dir + "/folder.jpeg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/folder.jpeg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -98,7 +98,7 @@ bool WebThread::checkInternal() else if (QFileInfo(dir + "/cover.jpg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/cover.jpg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -107,7 +107,7 @@ bool WebThread::checkInternal() if (QFileInfo(dir + "/Folder.jpg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/Folder.jpg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -116,7 +116,7 @@ bool WebThread::checkInternal() else if (QFileInfo(dir + "/Folder.jpeg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/Folder.jpeg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -125,7 +125,7 @@ bool WebThread::checkInternal() else if (QFileInfo(dir + "/Cover.jpg").exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(artist, album) + ".jpeg"; QImage image(dir + "/Cover.jpg"); image.save(th2, "JPEG"); emit imgLoaded(th2, files[0][2].toInt()); @@ -292,7 +292,7 @@ QString WebThread::saveToDisk(QIODevice *reply) QString art = files[0][0]; QString alb = files[0][1]; - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(art, alb) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(art, alb) + ".jpeg"; QImage image = QImage::fromData(reply->readAll()); image.save(th2, "JPEG"); @@ -304,7 +304,7 @@ QString WebThread::saveToDiskExtern(QIODevice *reply) { QImage image = QImage::fromData(reply->readAll()); - QString path = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/flowplayer/" + hash(curImage) + ".jpeg"; + QString path = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/flowplayer/" + hash(curImage) + ".jpeg"; image.save(path, "JPEG"); diff --git a/src/missing.cpp b/src/missing.cpp index bb33a50..23e6eaf 100644 --- a/src/missing.cpp +++ b/src/missing.cpp @@ -78,10 +78,10 @@ void Missing::loadData() if (dato1!=tr("Unknown album") && dato2!=tr("Unknown artist")) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(dato2, dato1) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(dato2, dato1) + ".jpeg"; if ( ! QFileInfo(th2).exists() ) { - QString th3 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(dato1, dato1); + ".jpeg"; + QString th3 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(dato1, dato1); + ".jpeg"; if ( ! QFileInfo(th3).exists() ) { //qDebug() << dato1 << " doesn't exist. Adding to list"; diff --git a/src/utils.cpp b/src/utils.cpp index 1ce7f78..a21d363 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -83,7 +83,7 @@ void Utils::readLyrics(QString artist, QString song) QString sng = cleanItem(song); if ( ( art!="" ) && ( sng!="" ) ) { - QString th1 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; + QString th1 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; if ( QFileInfo(th1).exists() ) { @@ -116,10 +116,10 @@ QString Utils::thumbnail(QString artist, QString album, QString count) QString art = count=="1"? artist : album; QString alb = album; - QString th1 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(art, alb) + ".jpeg"; + QString th1 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(art, alb) + ".jpeg"; if (!QFileInfo(th1).exists()) { - QString th2 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-"+ doubleHash(alb, alb) + ".jpeg"; + QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(alb, alb) + ".jpeg"; if (QFileInfo(th2).exists()) return th2; } @@ -355,11 +355,11 @@ void Utils::downloaded(QNetworkReply *respuesta) void Utils::saveLyrics(QString artist, QString song, QString lyrics) { QDir d; - d.mkdir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/lyrics"); + d.mkdir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/lyrics"); QString art = cleanItem(artist); QString sng = cleanItem(song); - QString f = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; + QString f = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; if ( QFileInfo(f).exists() ) QFile::remove(f); @@ -377,11 +377,11 @@ void Utils::saveLyrics(QString artist, QString song, QString lyrics) void Utils::saveLyrics2(QString artist, QString song, QString lyrics) { QDir d; - d.mkdir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/lyrics"); + d.mkdir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/lyrics"); QString art = cleanItem(artist); QString sng = cleanItem(song); - QString f = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; + QString f = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/lyrics/"+art+"-"+sng+".txt"; if ( QFileInfo(f).exists() ) QFile::remove(f); @@ -421,10 +421,10 @@ void Utils::Finished(int requestId, bool) QImage img; img.loadFromData(bytes); - QString th1 = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/album-" + doubleHash(albumArtArtist, albumArtAlbum) + ".jpeg"; - if ( QFileInfo(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/preview.jpeg").exists() ) + QString th1 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-" + doubleHash(albumArtArtist, albumArtAlbum) + ".jpeg"; + if ( QFileInfo(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/preview.jpeg").exists() ) removePreview(); - img.save(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/preview.jpeg"); + img.save(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/preview.jpeg"); downloadedAlbumArt = th1; emit coverDownloaded(); } @@ -434,7 +434,7 @@ void Utils::Finished(int requestId, bool) void Utils::removePreview() { - QFile f(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + "/media-art/preview.jpeg"); + QFile f(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/preview.jpeg"); f.remove(); } diff --git a/translations/ca.ts b/translations/ca.ts index 95741bd..5a4ac02 100644 --- a/translations/ca.ts +++ b/translations/ca.ts @@ -9,19 +9,24 @@ Quant a - - Taglib is used for reading, writing and manipulating audio file tags - S'utilitza Taglib per llegir, escriure i manipular etiquetes dels fitxers d'àudio + + Original author: + + + + + Contributors: + - - If your language is not available you can contribute here: - Si el vostre idioma no està disponible podeu contribuir aquí: + + If you want to create a new translation or improve an extant one: + - - You can contribute to keep this project alive making a small donation - Podeu contribuir a mantenir aquest projecte actiu fent una petita donació + + You can support the original author of FlowPlayer by donating: + @@ -221,12 +226,12 @@ DataReader - + Unknown artist Artista desconegut - + Unknown album Àlbum desconegut @@ -234,17 +239,17 @@ Datos - + Various artists Artistes diversos - + 1 album 1 àlbum - + %1 albums %1 àlbums @@ -335,48 +340,48 @@ LFM - - + + Error fetching artist information Error en l'obtenció de la informació de l'artista - + The artist could not be found No s'ha pogut trobar l'artista - + Error fetching album information Error en l'obtenció de la informació de l'àlbum - + The album could not be found No s'ha pogut trobar l'àlbum - + No album information available No s'ha trobat informació de l'àlbum - + Error fetching track information Error en l'obtenció de la informació de la pista - + The track could not be found No s'ha pogut trobar la pista - + No track information available No s'ha trobat informació de la pista - + Fetching artist information S'està obtenint la informació de l'artista @@ -614,12 +619,12 @@ Meta - + Unknown artist Artista desconegut - + Unknown album Àlbum desconegut @@ -674,17 +679,17 @@ Missing - + Various artists Artistes diversos - + Unknown album Àlbum desconegut - + Unknown artist Artista desconegut @@ -706,12 +711,12 @@ MyPlaylist - + Unknown artist Artista desconegut - + Unknown album Àlbum desconegut @@ -843,15 +848,23 @@ No hi ha cap emissora desada + + PickFolder + + + Select folder + Selecciona una carpeta + + Playlist - + Unknown artist Artista desconegut - + Unknown album Àlbum desconegut @@ -859,7 +872,7 @@ PlaylistManager - + Custom playlists Personalitza les llistes de reproducció diff --git a/translations/da.ts b/translations/da.ts index d367991..37827e1 100644 --- a/translations/da.ts +++ b/translations/da.ts @@ -9,19 +9,24 @@ Om - - Taglib is used for reading, writing and manipulating audio file tags - TagLib bruges til at læse, skrive og manipulere audiofilmærker + + Original author: + + + + + Contributors: + - - If your language is not available you can contribute here: - Hvis dit sprog ikke et tilgængeligt, kan du bidrage her: + + If you want to create a new translation or improve an extant one: + - - You can contribute to keep this project alive making a small donation - Du kan bidrage til at holde dette projekt i live ved at give en lille donation + + You can support the original author of FlowPlayer by donating: + @@ -221,12 +226,12 @@ DataReader - + Unknown artist Ukendt kunstner - + Unknown album Ukendt album @@ -234,17 +239,17 @@ Datos - + Various artists Forskellige kunstnere - + 1 album 1 album - + %1 albums %1 albums @@ -335,48 +340,48 @@ LFM - - + + Error fetching artist information Fejl ved hentning af kunstnerinformation - + The artist could not be found Kunstneren kunne ikke findes - + Error fetching album information Fejl ved hentning af albuminformation - + The album could not be found Albummet kunne ikke findes - + No album information available Ingen albuminformation tilgængelig - + Error fetching track information Fejl ved hentning af sporinformation - + The track could not be found Sporet kan ikke findes - + No track information available Ingen information om spor tilgængelig - + Fetching artist information Henter info om kunstner @@ -614,12 +619,12 @@ Meta - + Unknown artist Ukendt kunstner - + Unknown album Ukendt album @@ -674,17 +679,17 @@ Missing - + Various artists Forskellige kunstnere - + Unknown album Ukendt album - + Unknown artist Ukendt kunstner @@ -706,12 +711,12 @@ MyPlaylist - + Unknown artist Ukendt kunstner - + Unknown album Ukendt album @@ -843,15 +848,23 @@ Ingen gemte stationer + + PickFolder + + + Select folder + Vælg folder + + Playlist - + Unknown artist Ukendt kunstner - + Unknown album Ukendt album @@ -859,7 +872,7 @@ PlaylistManager - + Custom playlists Brugerdefinerede afspilningslister diff --git a/translations/de.ts b/translations/de.ts index 18b68f8..9d57eea 100644 --- a/translations/de.ts +++ b/translations/de.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,12 +9,12 @@ Über - + Original author: Ursprünglicher Autor: - + Contributors: Beitragende: @@ -22,7 +24,7 @@ Wenn Du eine neue Übersetzung erstellen oder eine bestehende verbessern möchtest: - + You can support the original author of FlowPlayer by donating: Du kannst den ursprünglichen Autor von FlowPlayer durch eine Spende unterstützen: @@ -224,12 +226,12 @@ DataReader - + Unknown artist Unbekannter Künstler - + Unknown album Unbekanntes Album @@ -237,17 +239,17 @@ Datos - + Various artists Diverse Künstler - + 1 album 1 Album - + %1 albums %1 Alben @@ -338,48 +340,48 @@ LFM - - + + Error fetching artist information Fehler beim Abruf der Künstlerinformationen - + The artist could not be found Der Künstler konnte nicht gefunden werden - + Error fetching album information Fehler beim Abruf der Albuminformationen - + The album could not be found Das Album konnte nicht gefunden werden - + No album information available Keine Informationen zum Album verfügbar - + Error fetching track information Fehler beim Abruf der Titelinformationen - + The track could not be found Der Titel konnte nicht gefunden werden - + No track information available Keine Titelinformationen verfügbar - + Fetching artist information Hole Künstlerinformationen @@ -617,12 +619,12 @@ Meta - + Unknown artist Unbekannter Künstler - + Unknown album Unbekanntes Album @@ -677,17 +679,17 @@ Missing - + Various artists Diverse Künstler - + Unknown album Unbekanntes Album - + Unknown artist Unbekannter Künstler @@ -709,12 +711,12 @@ MyPlaylist - + Unknown artist Unbekannter Künstler - + Unknown album Unbekanntes Album @@ -846,15 +848,23 @@ Keine Sender vorhanden + + PickFolder + + + Select folder + Ordner auswählen + + Playlist - + Unknown artist Unbekannter Künstler - + Unknown album Unbekanntes Album @@ -862,7 +872,7 @@ PlaylistManager - + Custom playlists Eigene Playlisten @@ -1390,4 +1400,4 @@ Cover nicht gefunden - \ No newline at end of file + diff --git a/translations/es.ts b/translations/es.ts index b74922b..444f6be 100644 --- a/translations/es.ts +++ b/translations/es.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,19 +9,24 @@ Acerca - - Taglib is used for reading, writing and manipulating audio file tags - La librería Taglib es usada para leer, escribir y manipular las etiquetas de los archivos de audio + + Original author: + - - If your language is not available you can contribute here: - Si su idioma no se encuentra disponible puede contribuír aquí: + + Contributors: + - - You can contribute to keep this project alive making a small donation - Usted puede contribuír a mantener este proyecto haciendo una pequeña donación + + If you want to create a new translation or improve an extant one: + + + + + You can support the original author of FlowPlayer by donating: + @@ -219,12 +226,12 @@ DataReader - + Unknown artist Artista desconocido - + Unknown album Album desconocido @@ -232,17 +239,17 @@ Datos - + Various artists Artistas varios - + 1 album 1 álbum - + %1 albums %1 álbumes @@ -333,48 +340,48 @@ LFM - - + + Error fetching artist information Error al descargar información del artista - + The artist could not be found No se encontró el artista - + Error fetching album information Error al descargar información del álbum - + The album could not be found No se encontró el álbum - + No album information available No hay información del álbum disponible - + Error fetching track information Error al descargar información de la canción - + The track could not be found No se encontró la canción - + No track information available No hay información de la canción disponible - + Fetching artist information Descargando información del artista @@ -612,12 +619,12 @@ Meta - + Unknown artist Artista desconocido - + Unknown album Album desconocido @@ -672,17 +679,17 @@ Missing - + Various artists Artistas varios - + Unknown album Album desconocido - + Unknown artist Artista desconocido @@ -704,12 +711,12 @@ MyPlaylist - + Unknown artist Artista desconocido - + Unknown album Album desconocido @@ -841,15 +848,23 @@ No hay estaciones guardadas + + PickFolder + + + Select folder + Seleccionar carpeta + + Playlist - + Unknown artist Artista desconocido - + Unknown album Album desconocido @@ -857,7 +872,7 @@ PlaylistManager - + Custom playlists Listas personalizadas @@ -1385,4 +1400,4 @@ Carátula no encontrada - \ No newline at end of file + diff --git a/translations/flowplayer.ts b/translations/flowplayer.ts index f02e64e..96f58a9 100644 --- a/translations/flowplayer.ts +++ b/translations/flowplayer.ts @@ -19,12 +19,12 @@ - + If you want to create a new translation or improve an extant one: - + You can support the original author of FlowPlayer by donating: @@ -226,12 +226,12 @@ DataReader - + Unknown artist - + Unknown album @@ -239,17 +239,17 @@ Datos - + Various artists - + 1 album - + %1 albums @@ -340,48 +340,48 @@ LFM - - + + Error fetching artist information - + The artist could not be found - + Error fetching album information - + The album could not be found - + No album information available - + Error fetching track information - + The track could not be found - + No track information available - + Fetching artist information @@ -619,12 +619,12 @@ Meta - + Unknown artist - + Unknown album @@ -679,17 +679,17 @@ Missing - + Various artists - + Unknown album - + Unknown artist @@ -711,12 +711,12 @@ MyPlaylist - + Unknown artist - + Unknown album @@ -848,15 +848,23 @@ + + PickFolder + + + Select folder + + + Playlist - + Unknown artist - + Unknown album @@ -864,7 +872,7 @@ PlaylistManager - + Custom playlists diff --git a/translations/fr.ts b/translations/fr.ts index ffcabd5..5222942 100644 --- a/translations/fr.ts +++ b/translations/fr.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,19 +9,24 @@ A propos - - Taglib is used for reading, writing and manipulating audio file tags - Taglib est utilisé pour lire, écrire et manipuler les tags de fichier audio + + Original author: + - - If your language is not available you can contribute here: - Si votre langue n'est pas disponible, vous pouvez contribuer ici: + + Contributors: + - - You can contribute to keep this project alive making a small donation - Vous pouvez aider à maintenir ce projet en vie en faisant une petite donation + + If you want to create a new translation or improve an extant one: + + + + + You can support the original author of FlowPlayer by donating: + @@ -219,12 +226,12 @@ DataReader - + Unknown artist Artiste inconnu - + Unknown album Album inconnu @@ -232,17 +239,17 @@ Datos - + Various artists Artistes divers - + 1 album 1 album - + %1 albums %1 album @@ -333,48 +340,48 @@ LFM - - + + Error fetching artist information Erreur lors de la recherche d'informations sur l'artiste - + The artist could not be found L'artiste n'a pas été trouvé - + Error fetching album information Erreur lors de la recherche d'informations sur l'album - + The album could not be found L'album ne peut être trouvé - + No album information available Pas d'information disponible sur l'album - + Error fetching track information Erreur lors de la recherche d'informations sur la piste - + The track could not be found La piste ne peut être trouvée - + No track information available Pas d'information disponible sur la piste - + Fetching artist information Recherche d'informations sur l'artiste @@ -612,12 +619,12 @@ Meta - + Unknown artist Artiste inconnu - + Unknown album Album inconnu @@ -672,17 +679,17 @@ Missing - + Various artists Artistes divers - + Unknown album Album inconnu - + Unknown artist Artiste inconnu @@ -704,12 +711,12 @@ MyPlaylist - + Unknown artist Artiste inconnu - + Unknown album Album inconnu @@ -841,15 +848,23 @@ Aucune station sauvegardée + + PickFolder + + + Select folder + Choisir le dossier + + Playlist - + Unknown artist Artiste inconnu - + Unknown album Album inconnu @@ -857,7 +872,7 @@ PlaylistManager - + Custom playlists Playlists personnalisées @@ -1385,4 +1400,4 @@ Pochette non trouvée - \ No newline at end of file + diff --git a/translations/it.ts b/translations/it.ts index 6aecc5e..165cb7b 100644 --- a/translations/it.ts +++ b/translations/it.ts @@ -9,19 +9,24 @@ Info - - Taglib is used for reading, writing and manipulating audio file tags - Taglib è utilizzato per la lettura, la scrittura e la manipolazione dei tag + + Original author: + + + + + Contributors: + - - If your language is not available you can contribute here: - Se la tua lingua non è disponibile, puoi contribuire qui: + + If you want to create a new translation or improve an extant one: + - - You can contribute to keep this project alive making a small donation - Puoi contribuire al mantenimento di questo progetto effettuando una donazione + + You can support the original author of FlowPlayer by donating: + @@ -221,12 +226,12 @@ DataReader - + Unknown artist Artista sconosciuto - + Unknown album Album sconosciuto @@ -234,17 +239,17 @@ Datos - + Various artists Artisti vari - + 1 album 1 album - + %1 albums %1 album @@ -335,48 +340,48 @@ LFM - - + + Error fetching artist information Errore nel recuperare le info sull'artista - + The artist could not be found L'artista non può essere trovato - + Error fetching album information Errore nel recuperare le info sull'album - + The album could not be found L'album non può essere trovato - + No album information available Nessuna info sull'album disponibile - + Error fetching track information Errore nel recuperare le info sulla traccia - + The track could not be found La traccia non può essere trovata - + No track information available Nessuna info sulla traccia disponibile - + Fetching artist information Recupero info sull'artista @@ -614,12 +619,12 @@ Meta - + Unknown artist Artista sconosciuto - + Unknown album Album sconosciuto @@ -674,17 +679,17 @@ Missing - + Various artists Artisti vari - + Unknown album Album sconosciuto - + Unknown artist Artista sconosciuto @@ -706,12 +711,12 @@ MyPlaylist - + Unknown artist Artista sconosciuto - + Unknown album Album sconosciuto @@ -843,15 +848,23 @@ Nessuna stazione salvata + + PickFolder + + + Select folder + Seleziona cartella + + Playlist - + Unknown artist Artista sconosciuto - + Unknown album Album sconosciuto @@ -859,7 +872,7 @@ PlaylistManager - + Custom playlists Playlist personalizzata diff --git a/translations/nl.ts b/translations/nl.ts index 5de5edd..6031e56 100644 --- a/translations/nl.ts +++ b/translations/nl.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,19 +9,24 @@ Over - - Taglib is used for reading, writing and manipulating audio file tags - Taglib wordt gebruikt voor het lezen, schrijven en het manipuleren van audio file-tags + + Original author: + - - If your language is not available you can contribute here: - Als uw taal niet beschikbaar is, kunt u hier uw bijdrage leveren: + + Contributors: + - - You can contribute to keep this project alive making a small donation - Met een kleine donatie, kunt u uw bijdrage leveren en het project in leven houden. + + If you want to create a new translation or improve an extant one: + + + + + You can support the original author of FlowPlayer by donating: + @@ -219,12 +226,12 @@ DataReader - + Unknown artist Onbekende artiest - + Unknown album Onbekende album @@ -232,17 +239,17 @@ Datos - + Various artists Diverse artiesten - + 1 album 1 album - + %1 albums %1 albums @@ -333,48 +340,48 @@ LFM - - + + Error fetching artist information Fout bij het ophalen van informatie over de artiest - + The artist could not be found Artiest kan niet worden gevonden - + Error fetching album information Fout bij het ophalen van informatie over de album - + The album could not be found Album kan niet worden gevonden - + No album information available Album informatie niet beschikbaar - + Error fetching track information Fout bij het ophalen van informatie over de track - + The track could not be found Track kan niet worden gevonden - + No track information available Track informatie niet beschikbaar - + Fetching artist information Informatie ophalen over de artiest @@ -612,12 +619,12 @@ Meta - + Unknown artist Onbekende artiest - + Unknown album Onbekende album @@ -672,17 +679,17 @@ Missing - + Various artists Diverse artiesten - + Unknown album Onbekende album - + Unknown artist Onbekende artiest @@ -704,12 +711,12 @@ MyPlaylist - + Unknown artist Onbekende artiest - + Unknown album Onbekende album @@ -841,15 +848,23 @@ Geen opgeslagen stations + + PickFolder + + + Select folder + Selecteer map + + Playlist - + Unknown artist Onbekende artiest - + Unknown album Onbekende album @@ -857,7 +872,7 @@ PlaylistManager - + Custom playlists Handmatige afspeellijsten @@ -1385,4 +1400,4 @@ Cover niet gevonden - \ No newline at end of file + diff --git a/translations/ru.ts b/translations/ru.ts index 3444c10..c1221e0 100644 --- a/translations/ru.ts +++ b/translations/ru.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,19 +9,24 @@ О программе - - Taglib is used for reading, writing and manipulating audio file tags - Taglib используется для чтения и записи тегов аудиофайлов + + Original author: + - - If your language is not available you can contribute here: - Если ваш язык недоступен, вы можете помочь в переводе здесь: + + Contributors: + - - You can contribute to keep this project alive making a small donation - Вы можете внести свой вклад в жизнь проекта, сделав небольшое пожертвование + + If you want to create a new translation or improve an extant one: + + + + + You can support the original author of FlowPlayer by donating: + @@ -219,12 +226,12 @@ DataReader - + Unknown artist Неизвестный исполнитель - + Unknown album Неизвестный альбом @@ -232,17 +239,17 @@ Datos - + Various artists Различные исполнители - + 1 album 1 альбом - + %1 albums %1 альбомов @@ -333,48 +340,48 @@ LFM - - + + Error fetching artist information Ошибка при получении сведений об исполнителе - + The artist could not be found Исполнитель не может быть найден - + Error fetching album information Ошибка при получении информации об альбоме - + The album could not be found Альбом не найден - + No album information available Нет информации об альбоме - + Error fetching track information Ошибка при получении информации о треке - + The track could not be found Трек не найден - + No track information available Нет информации о треке - + Fetching artist information Поиск сведений об исполнителе @@ -612,12 +619,12 @@ Meta - + Unknown artist Неизвестный исполнитель - + Unknown album Неизвестный альбом @@ -672,17 +679,17 @@ Missing - + Various artists Различные исполнители - + Unknown album Неизвестный альбом - + Unknown artist Неизвестный исполнитель @@ -704,12 +711,12 @@ MyPlaylist - + Unknown artist Неизвестный исполнитель - + Unknown album Неизвестный альбом @@ -841,15 +848,23 @@ Нет сохраненных радиостанций + + PickFolder + + + Select folder + Выбрать папку + + Playlist - + Unknown artist Неизвестный исполнитель - + Unknown album Неизвестный альбом @@ -857,7 +872,7 @@ PlaylistManager - + Custom playlists Собственные плейлисты @@ -1385,4 +1400,4 @@ Обложка не найдена - \ No newline at end of file + diff --git a/translations/sv.ts b/translations/sv.ts index 8da0235..3c33220 100644 --- a/translations/sv.ts +++ b/translations/sv.ts @@ -1,4 +1,6 @@ - + + + AboutPage @@ -7,12 +9,12 @@ Om - + Original author: Ursprunglig utvecklare: - + Contributors: Bidragande parter: @@ -22,7 +24,7 @@ Om du vill skapa en ny översättning eller förbättra en befintlig: - + You can support the original author of FlowPlayer by donating: Du kan stödja den ursprungliga utvecklaren av FlowPlayer genom att donera: @@ -224,12 +226,12 @@ DataReader - + Unknown artist Okänd artist - + Unknown album Okänt album @@ -237,17 +239,17 @@ Datos - + Various artists Diverse artister - + 1 album 1 album - + %1 albums %1 album @@ -338,48 +340,48 @@ LFM - - + + Error fetching artist information Fel vid hämtning av artistinformation - + The artist could not be found Artisten kunde inte hittas - + Error fetching album information Fel vid hämtning av albuminformation - + The album could not be found Albumet kunde inte hittas - + No album information available Ingen albuminformation tillgänglig - + Error fetching track information Fel vid hämtning av spårinformation - + The track could not be found Spåret kunde inte hittas - + No track information available Ingen spårinformation tillgänglig - + Fetching artist information Hämtar artistinformation @@ -617,12 +619,12 @@ Meta - + Unknown artist Okänd artist - + Unknown album Okänt album @@ -677,17 +679,17 @@ Missing - + Various artists Diverse artister - + Unknown album Okänt album - + Unknown artist Okänd artist @@ -709,12 +711,12 @@ MyPlaylist - + Unknown artist Okänd artist - + Unknown album Okänt album @@ -846,15 +848,23 @@ Inga sparade stationer + + PickFolder + + + Select folder + Välj mapp + + Playlist - + Unknown artist Okänd artist - + Unknown album Okänt album @@ -862,7 +872,7 @@ PlaylistManager - + Custom playlists Anpassade spelningslistor @@ -1390,4 +1400,4 @@ Inget omslag hittades - \ No newline at end of file + From fce86cd7f915f3c4606ef2019c7a416e3939521e Mon Sep 17 00:00:00 2001 From: Mark Washeim Date: Sun, 10 Mar 2024 14:22:01 +0100 Subject: [PATCH 02/18] PR: feedback integrated: 1. alternate logic for applying folder/cover image copy, basename check. 2. remove media indexing sailjail perms, 3. move cache dir creation from migrate to main --- flowplayer.desktop | 2 +- src/FlowPlayer.cpp | 8 +++----- src/datareader.cpp | 12 +++++++++--- translations/ca.ts | 4 ++-- translations/da.ts | 4 ++-- translations/de.ts | 4 ++-- translations/es.ts | 4 ++-- translations/flowplayer.ts | 4 ++-- translations/fr.ts | 4 ++-- translations/it.ts | 4 ++-- translations/nl.ts | 4 ++-- translations/ru.ts | 4 ++-- translations/sv.ts | 4 ++-- 13 files changed, 33 insertions(+), 29 deletions(-) diff --git a/flowplayer.desktop b/flowplayer.desktop index 8291ad7..25e8bb3 100644 --- a/flowplayer.desktop +++ b/flowplayer.desktop @@ -10,4 +10,4 @@ OrganizationName=sailfishos-applications # ApplicationName does not have to be identical to Name ApplicationName=flowplayer # Add the required permissions here -Permissions=UserDirs;Audio;MediaIndexing;Bluetooth;Internet;RemovableMedia +Permissions=UserDirs;Audio;Bluetooth;Internet;RemovableMedia diff --git a/src/FlowPlayer.cpp b/src/FlowPlayer.cpp index 3d04616..72948e0 100644 --- a/src/FlowPlayer.cpp +++ b/src/FlowPlayer.cpp @@ -75,11 +75,6 @@ static void migrateCache() } QDir(QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)).rmdir("flowplayer"); } - // if the media-art directory does not exist, make it. - if (!QFileInfo(newCache).isDir()) { - QDir().mkpath( newCache ); - QDir().mkpath( newCache + "/media-art" ); - } } int main(int argc, char *argv[]) @@ -118,6 +113,9 @@ int main(int argc, char *argv[]) app->installTranslator(&translator); + // ensure the media cache dir is created + const QString mediaCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art"; + QDir().mkpath( mediaCacheDir ); QScopedPointer window(SailfishApp::createView()); window->setTitle("FlowPlayer"); diff --git a/src/datareader.cpp b/src/datareader.cpp index 2b9c332..8cafa23 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -215,9 +215,15 @@ void DataReader::readFile(QString file) QDirIterator iterator(info.dir().path(), QDirIterator::Subdirectories); while (iterator.hasNext()) { iterator.next(); - if (!iterator.fileInfo().isDir()) { - if ( iterator.filePath().toLower().endsWith(".jpg") || - iterator.filePath().toLower().endsWith(".jpeg") ) + // we are explicit about two common factors, + // suffix jpg or png, basename cover or folder + if (iterator.fileInfo().isFile()) { + if ( ( iterator.fileInfo().suffix() == "jpg" || + iterator.fileInfo().suffix() == "jpeg" || + 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"; qDebug() << "PROCESSING FILE: " << iterator.filePath() ; diff --git a/translations/ca.ts b/translations/ca.ts index 5a4ac02..44b7e9d 100644 --- a/translations/ca.ts +++ b/translations/ca.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Artista desconegut - + Unknown album Àlbum desconegut diff --git a/translations/da.ts b/translations/da.ts index 37827e1..dc3b060 100644 --- a/translations/da.ts +++ b/translations/da.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Ukendt kunstner - + Unknown album Ukendt album diff --git a/translations/de.ts b/translations/de.ts index 9d57eea..5b76964 100644 --- a/translations/de.ts +++ b/translations/de.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Unbekannter Künstler - + Unknown album Unbekanntes Album diff --git a/translations/es.ts b/translations/es.ts index 444f6be..1cdd8b0 100644 --- a/translations/es.ts +++ b/translations/es.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Artista desconocido - + Unknown album Album desconocido diff --git a/translations/flowplayer.ts b/translations/flowplayer.ts index 96f58a9..f6f67c9 100644 --- a/translations/flowplayer.ts +++ b/translations/flowplayer.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist - + Unknown album diff --git a/translations/fr.ts b/translations/fr.ts index 5222942..fa54b0d 100644 --- a/translations/fr.ts +++ b/translations/fr.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Artiste inconnu - + Unknown album Album inconnu diff --git a/translations/it.ts b/translations/it.ts index 165cb7b..4035c22 100644 --- a/translations/it.ts +++ b/translations/it.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Artista sconosciuto - + Unknown album Album sconosciuto diff --git a/translations/nl.ts b/translations/nl.ts index 6031e56..876da77 100644 --- a/translations/nl.ts +++ b/translations/nl.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Onbekende artiest - + Unknown album Onbekende album diff --git a/translations/ru.ts b/translations/ru.ts index c1221e0..0b6ea5c 100644 --- a/translations/ru.ts +++ b/translations/ru.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Неизвестный исполнитель - + Unknown album Неизвестный альбом diff --git a/translations/sv.ts b/translations/sv.ts index 3c33220..ac93779 100644 --- a/translations/sv.ts +++ b/translations/sv.ts @@ -226,12 +226,12 @@ DataReader - + Unknown artist Okänd artist - + Unknown album Okänt album From 58c2f07d63ac1b74953fb438709a7f2589ad97e0 Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:20:57 +0100 Subject: [PATCH 03/18] [FlowPlayer.cpp] Improve style as suggested by @dcaliste --- src/FlowPlayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FlowPlayer.cpp b/src/FlowPlayer.cpp index 72948e0..dfb80e5 100644 --- a/src/FlowPlayer.cpp +++ b/src/FlowPlayer.cpp @@ -115,7 +115,7 @@ int main(int argc, char *argv[]) // ensure the media cache dir is created const QString mediaCacheDir = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art"; - QDir().mkpath( mediaCacheDir ); + QDir().mkpath(mediaCacheDir); QScopedPointer window(SailfishApp::createView()); window->setTitle("FlowPlayer"); From 6f54866a593a4dd6cf775e83521d2edbd5f92a83 Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:28:19 +0100 Subject: [PATCH 04/18] [datareader.cpp] Improve style as suggested by @dcaliste --- src/datareader.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 8cafa23..9709fe3 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -218,12 +218,13 @@ void DataReader::readFile(QString file) // we are explicit about two common factors, // suffix jpg or png, basename cover or folder if (iterator.fileInfo().isFile()) { - if ( ( iterator.fileInfo().suffix() == "jpg" || - iterator.fileInfo().suffix() == "jpeg" || - iterator.fileInfo().suffix() == "png" ) && - ( iterator.fileInfo().baseName() == "cover" || - iterator.fileInfo().baseName() == "folder" ) - ) + if ( (iterator.fileInfo().suffix() == "jpg" || + iterator.fileInfo().suffix() == "jpeg" || + 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"; qDebug() << "PROCESSING FILE: " << iterator.filePath() ; From 0e9075f74baf1bf3e1fddeb9b87a9ff1b4e132f9 Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:30:41 +0100 Subject: [PATCH 05/18] [flowplayer.desktop] Omit SailJail sandboxing configuration for now --- flowplayer.desktop | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/flowplayer.desktop b/flowplayer.desktop index 25e8bb3..f87a750 100644 --- a/flowplayer.desktop +++ b/flowplayer.desktop @@ -6,8 +6,4 @@ Exec=flowplayer Name=FlowPlayer [X-Sailjail] -OrganizationName=sailfishos-applications -# ApplicationName does not have to be identical to Name -ApplicationName=flowplayer -# Add the required permissions here -Permissions=UserDirs;Audio;Bluetooth;Internet;RemovableMedia +Sandboxing=Disabled From 96084f22e73af419d40fad02f03c2ef759c761d7 Mon Sep 17 00:00:00 2001 From: olf Date: Mon, 11 Mar 2024 22:39:46 +0100 Subject: [PATCH 06/18] [datareader.cpp] Improve style as suggested by @dcaliste --- src/datareader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 9709fe3..da7d17a 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -228,7 +228,7 @@ void DataReader::readFile(QString file) { QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-"+ doubleHash(m_artist, m_album) + ".jpeg"; qDebug() << "PROCESSING FILE: " << iterator.filePath() ; - QFile::copy(iterator.filePath(), th2 ); + QFile::copy(iterator.filePath(), th2); } } } From d1ad038095e46a2b9f60ceb081399aeb9e24beea Mon Sep 17 00:00:00 2001 From: Mark Washeim Date: Tue, 12 Mar 2024 20:45:39 +0100 Subject: [PATCH 07/18] Review: remove png processing --- src/datareader.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 8cafa23..918273a 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -219,8 +219,7 @@ void DataReader::readFile(QString file) // suffix jpg or png, basename cover or folder if (iterator.fileInfo().isFile()) { if ( ( iterator.fileInfo().suffix() == "jpg" || - iterator.fileInfo().suffix() == "jpeg" || - iterator.fileInfo().suffix() == "png" ) && + iterator.fileInfo().suffix() == "jpeg" || ) && ( iterator.fileInfo().baseName() == "cover" || iterator.fileInfo().baseName() == "folder" ) ) From 62eb7eb4d46285f7e7b3c0fb22374c6060c26d94 Mon Sep 17 00:00:00 2001 From: Mark Washeim Date: Tue, 12 Mar 2024 20:50:21 +0100 Subject: [PATCH 08/18] Update datareader.cpp remove unused QImage and png matching. --- src/datareader.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index da7d17a..fa10ead 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -22,7 +22,6 @@ #include #include -#include #include #include #include @@ -219,9 +218,7 @@ void DataReader::readFile(QString file) // suffix jpg or png, basename cover or folder if (iterator.fileInfo().isFile()) { if ( (iterator.fileInfo().suffix() == "jpg" || - iterator.fileInfo().suffix() == "jpeg" || - iterator.fileInfo().suffix() == "png" - ) && + iterator.fileInfo().suffix() == "jpeg" ) && (iterator.fileInfo().baseName() == "cover" || iterator.fileInfo().baseName() == "folder") ) From e40b96426a712b8c3bd3bd80e65a202f892bae21 Mon Sep 17 00:00:00 2001 From: Mark Washeim Date: Tue, 12 Mar 2024 20:55:42 +0100 Subject: [PATCH 09/18] Fix:logic of the || on png --- src/datareader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 07cc751..50f7de7 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -218,7 +218,7 @@ void DataReader::readFile(QString file) // suffix jpg or png, basename cover or folder if (iterator.fileInfo().isFile()) { if ( ( iterator.fileInfo().suffix() == "jpg" || - iterator.fileInfo().suffix() == "jpeg" || ) && + iterator.fileInfo().suffix() == "jpeg" ) && ( iterator.fileInfo().baseName() == "cover" || iterator.fileInfo().baseName() == "folder" ) ) From e5ff6174421904e7aeee622cc6a3a0d74342d3c3 Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:25:14 +0100 Subject: [PATCH 10/18] [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); } From 3973296e0f469f570a1a043466c90d7e503022ae Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:28:22 +0100 Subject: [PATCH 11/18] [datareader.cpp] Rectify comment --- src/datareader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 8baf56f..7f56351 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -215,7 +215,7 @@ void DataReader::readFile(QString file) while (iterator.hasNext()) { iterator.next(); // we are explicit about two common factors, the suffix .jpeg (ToDo: add .jpg and .png - // throughout all source code), and basename cover or folder + // throughout all C++ source code files), and basename cover or folder if (iterator.fileInfo().isFile()) { if ( iterator.fileInfo().suffix() == "jpeg" && // (… || iterator.fileInfo().suffix() == "jpg" || iterator.fileInfo().suffix() == "png") && From 7d251e0703c6698493773cc02948c6b268dad02f Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:45:16 +0100 Subject: [PATCH 12/18] [datareader.cpp] Improve comments & break long code line in two --- src/datareader.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 7f56351..820dd08 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -214,16 +214,17 @@ void DataReader::readFile(QString file) QDirIterator iterator(info.dir().path(), QDirIterator::Subdirectories); while (iterator.hasNext()) { iterator.next(); - // we are explicit about two common factors, the suffix .jpeg (ToDo: add .jpg and .png - // throughout all C++ source code files), and basename cover or folder + // we are explicit about two common factors, the suffix `jpeg` (ToDo: add `jpg` and `png` + // throughout all C++ source files), and basename cover or folder if (iterator.fileInfo().isFile()) { if ( iterator.fileInfo().suffix() == "jpeg" && - // (… || iterator.fileInfo().suffix() == "jpg" || iterator.fileInfo().suffix() == "png") && + // See ToDo above: (… || 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) + iterator.fileInfo().suffix(); + 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); } From 5665c32af76ef90416df419220f5a6337c645a17 Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:48:28 +0100 Subject: [PATCH 13/18] [datareader.cpp] Break two more long lines in two --- src/datareader.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 820dd08..edfafe3 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -218,13 +218,15 @@ void DataReader::readFile(QString file) // throughout all C++ source files), and basename cover or folder if (iterator.fileInfo().isFile()) { if ( iterator.fileInfo().suffix() == "jpeg" && - // See ToDo above: (… || iterator.fileInfo().suffix() == "jpg" || iterator.fileInfo().suffix() == "png") && + // See ToDo above: (… || 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) + iterator.fileInfo().suffix(); + "/media-art/album-" + doubleHash(m_artist, m_album) + \ + iterator.fileInfo().suffix(); qDebug() << "PROCESSING FILE: " << iterator.filePath() ; QFile::copy(iterator.filePath(), th2); } From fc9d26c4e6b20b8b0d1a196b1bf67c9540f8be25 Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:53:33 +0100 Subject: [PATCH 14/18] [datareader.cpp] Remove superfluous backslashes "\" --- src/datareader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index edfafe3..2f3043f 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -218,14 +218,14 @@ void DataReader::readFile(QString file) // throughout all C++ source files), and basename cover or folder if (iterator.fileInfo().isFile()) { if ( iterator.fileInfo().suffix() == "jpeg" && - // See ToDo above: (… || iterator.fileInfo().suffix() == "jpg" || \ + // See ToDo above: (… || 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) + \ + 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); From 72261f18e8cd6b9efb3099679eca4f5c8039ab6f Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 21:57:05 +0100 Subject: [PATCH 15/18] [datareader.cpp] Omit superfluous space character " " --- src/datareader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 2f3043f..05a8454 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -227,7 +227,7 @@ void DataReader::readFile(QString file) QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/media-art/album-" + doubleHash(m_artist, m_album) + iterator.fileInfo().suffix(); - qDebug() << "PROCESSING FILE: " << iterator.filePath() ; + qDebug() << "PROCESSING FILE: " << iterator.filePath(); QFile::copy(iterator.filePath(), th2); } } From fa06e7ba7aaf026fab283fa60f0466a94646c1e8 Mon Sep 17 00:00:00 2001 From: olf Date: Tue, 12 Mar 2024 22:32:52 +0100 Subject: [PATCH 16/18] [datareader.cpp] Extend comment --- src/datareader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 05a8454..183d8b3 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -215,7 +215,7 @@ void DataReader::readFile(QString file) while (iterator.hasNext()) { iterator.next(); // we are explicit about two common factors, the suffix `jpeg` (ToDo: add `jpg` and `png` - // throughout all C++ source files), and basename cover or folder + // throughout all C++ source files, see issue #78), and basename cover or folder if (iterator.fileInfo().isFile()) { if ( iterator.fileInfo().suffix() == "jpeg" && // See ToDo above: (… || iterator.fileInfo().suffix() == "jpg" || From 73b543ac4f32b5da7b4994dde236f2fec36e45a3 Mon Sep 17 00:00:00 2001 From: Damien Caliste Date: Thu, 14 Mar 2024 10:55:45 +0100 Subject: [PATCH 17/18] Don't recurse in subdirs when looking for covers. --- src/datareader.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/datareader.cpp b/src/datareader.cpp index 183d8b3..17b10c7 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -20,7 +20,6 @@ #include -#include #include #include #include @@ -211,23 +210,21 @@ void DataReader::readFile(QString file) // if we have artist and album, we check for a cover image. if (m_artist != "" && m_album != "") { QFileInfo info(file); - QDirIterator iterator(info.dir().path(), QDirIterator::Subdirectories); + QDirIterator iterator(info.dir()); while (iterator.hasNext()) { iterator.next(); - // we are explicit about two common factors, the suffix `jpeg` (ToDo: add `jpg` and `png` + // we are explicit about two common factors, the type JPEG (ToDo: add PNG // throughout all C++ source files, see issue #78), and basename cover or folder if (iterator.fileInfo().isFile()) { - if ( iterator.fileInfo().suffix() == "jpeg" && - // See ToDo above: (… || iterator.fileInfo().suffix() == "jpg" || + if ( (iterator.fileInfo().suffix() == "jpeg" || + iterator.fileInfo().suffix() == "jpg") && + // See ToDo above: (… || // iterator.fileInfo().suffix() == "png") && (iterator.fileInfo().baseName() == "cover" || - iterator.fileInfo().baseName() == "folder") - ) - { + iterator.fileInfo().baseName() == "folder") ) { QString th2 = QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + - "/media-art/album-" + doubleHash(m_artist, m_album) + - iterator.fileInfo().suffix(); - qDebug() << "PROCESSING FILE: " << iterator.filePath(); + "/media-art/album-" + doubleHash(m_artist, m_album) + ".jpeg"; + qDebug() << "COPYING FILE ART: " << iterator.filePath() << m_artist << m_album; QFile::copy(iterator.filePath(), th2); } } From b5b4ad28d786be9d97ce7714e27db6aa76c7f7bf Mon Sep 17 00:00:00 2001 From: olf Date: Thu, 14 Mar 2024 18:46:31 +0100 Subject: [PATCH 18/18] [datareader.cpp] Insert comment and align with current TS files --- src/datareader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/datareader.cpp b/src/datareader.cpp index 17b10c7..c15bf09 100644 --- a/src/datareader.cpp +++ b/src/datareader.cpp @@ -187,6 +187,8 @@ TagLib::File* DataReader::getFileByMimeType(QString file) void DataReader::readFile(QString file) { + // Is oFile used somewhere? (I failed to find a location.) + // If not, what is this new line good for? For details, see PR #75. QString oFile = file; file.remove("file://");