diff --git a/src/core/song.cpp b/src/core/song.cpp index 33fcfc4fd..2b7d15288 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -152,6 +152,8 @@ const QString Song::kVariousArtists("various artists"); const QStringList Song::kArticles = QStringList() << "the " << "a " << "an "; +const QStringList Song::kAcceptedExtensions = QStringList() << "aac" << "ac3" << "dts"; + struct Song::Private : public QSharedData { explicit Private(Source source = Source_Unknown); @@ -1045,6 +1047,13 @@ void Song::InitFromFilePartial(const QString &filename) { d->source_ = Source_LocalFile; if (d->art_manual_.isEmpty()) InitArtManual(); } + else if (kAcceptedExtensions.contains(info.suffix(), Qt::CaseInsensitive)) { + d->valid_ = true; + d->source_ = Source_LocalFile; + d->filetype_ = FiletypeByExtension(info.suffix()); + d->title_ = info.fileName(); + if (d->art_manual_.isEmpty()) InitArtManual(); + } else { d->valid_ = false; d->error_ = QObject::tr("File %1 is not recognized as a valid audio file.").arg(filename); diff --git a/src/core/song.h b/src/core/song.h index 0edb61890..db2b40a44 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -127,6 +127,8 @@ class Song { static const QStringList kArticles; + static const QStringList kAcceptedExtensions; + static QString JoinSpec(const QString &table); static Source SourceFromURL(const QUrl &url); diff --git a/src/widgets/fileview.cpp b/src/widgets/fileview.cpp index cc1929a1c..d6b9c2632 100644 --- a/src/widgets/fileview.cpp +++ b/src/widgets/fileview.cpp @@ -50,7 +50,8 @@ const char *FileView::kFileFilter = "*.wav *.flac *.wv *.ogg *.oga *.opus *.spx *.ape *.mpc " "*.mp2 *.mp3 *.m4a *.mp4 *.aac *.asf *.asx *.wma " "*.aif *.aiff *.mka *.tta *.dsf *.dsd " - "*.cue *.m3u *.m3u8 *.pls *.xspf *.asxini "; + "*.cue *.m3u *.m3u8 *.pls *.xspf *.asxini " + ".ac3 .dts"; FileView::FileView(QWidget *parent) : QWidget(parent),