Support more CUE filenames

Fixes #835
This commit is contained in:
Jonas Kvinge
2021-11-27 20:28:00 +01:00
parent a97dbab2ae
commit 8f49d1591f
5 changed files with 41 additions and 19 deletions

View File

@@ -379,3 +379,16 @@ bool CueParser::TryMagic(const QByteArray &data) const {
return false;
}
QString CueParser::FindCueFilename(const QString &filename) {
QStringList cue_files = QStringList() << filename + ".cue"
<< filename.section('.', 0, -2) + ".cue";
for (const QString &cuefile : cue_files) {
if (QFileInfo::exists(cuefile)) return cuefile;
}
return QString();
}

View File

@@ -70,6 +70,8 @@ class CueParser : public ParserBase {
SongList Load(QIODevice *device, const QString &playlist_path = "", const QDir &dir = QDir(), const bool collection_search = true) const override;
void Save(const SongList &songs, QIODevice *device, const QDir &dir = QDir(), Playlist::Path path_type = Playlist::Path_Automatic) const override;
static QString FindCueFilename(const QString &filename);
private:
// A single TRACK entry in .cue file.
struct CueEntry {