1
0
mirror of https://github.com/strawberrymusicplayer/strawberry synced 2024-12-15 10:14:43 +01:00

Allow audio formats unsupported by taglib to be added

Fixes #669
This commit is contained in:
Jonas Kvinge 2021-03-21 19:19:35 +01:00
parent 59bffed47f
commit 6b6117653a
3 changed files with 13 additions and 1 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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),