Skip to content

Commit

Permalink
PR: feedback integrated: 1. alternate logic for applying folder/cover…
Browse files Browse the repository at this point in the history
… image copy, basename check. 2. remove media indexing sailjail perms, 3. move cache dir creation from migrate to main
  • Loading branch information
poetaster committed Mar 10, 2024
1 parent 68dc7f1 commit fce86cd
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion flowplayer.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 3 additions & 5 deletions src/FlowPlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
Expand Down Expand Up @@ -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<QQuickView> window(SailfishApp::createView());
window->setTitle("FlowPlayer");
Expand Down
12 changes: 9 additions & 3 deletions src/datareader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() ;
Expand Down
4 changes: 2 additions & 2 deletions translations/ca.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Artista desconegut</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Àlbum desconegut</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Ukendt kunstner</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Ukendt album</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Unbekannter Künstler</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Unbekanntes Album</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Artista desconocido</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Album desconocido</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/flowplayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation type="unfinished"></translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Artiste inconnu</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Album inconnu</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Artista sconosciuto</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Album sconosciuto</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Onbekende artiest</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Onbekende album</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Неизвестный исполнитель</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Неизвестный альбом</translation>
</message>
Expand Down
4 changes: 2 additions & 2 deletions translations/sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@
<context>
<name>DataReader</name>
<message>
<location filename="../src/datareader.cpp" line="230"/>
<location filename="../src/datareader.cpp" line="236"/>
<source>Unknown artist</source>
<translation>Okänd artist</translation>
</message>
<message>
<location filename="../src/datareader.cpp" line="231"/>
<location filename="../src/datareader.cpp" line="237"/>
<source>Unknown album</source>
<translation>Okänt album</translation>
</message>
Expand Down

0 comments on commit fce86cd

Please sign in to comment.