diff --git a/models/sqllibrarymodel.cpp b/models/sqllibrarymodel.cpp index 73ca007be..26329470a 100644 --- a/models/sqllibrarymodel.cpp +++ b/models/sqllibrarymodel.cpp @@ -452,6 +452,16 @@ QModelIndex SqlLibraryModel::findSongIndex(const Song &song) } } } + + // Hmm... Find song details in db via file path - fixes SingleTracks songs + if (!song.file.isEmpty()) { + QList dbSongs=db->songs(QStringList() << song.file); + if (!dbSongs.isEmpty() && dbSongs.first().albumId()!=song.albumId()) { + Song dbSong=dbSongs.first(); + dbSong.file=QString(); // Prevent recursion! + return findSongIndex(dbSong); + } + } return QModelIndex(); }