diff --git a/autotests/taglibextractortest.cpp b/autotests/taglibextractortest.cpp --- a/autotests/taglibextractortest.cpp +++ b/autotests/taglibextractortest.cpp @@ -238,37 +238,37 @@ QTest::addRow("mp3") << QFINDTESTDATA("samplefiles/no-meta/test.mp3") << QStringLiteral("audio/mp3") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; QTest::addRow("m4a") << QFINDTESTDATA("samplefiles/no-meta/test.m4a") << QStringLiteral("audio/mp4") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; QTest::addRow("flac") << QFINDTESTDATA("samplefiles/no-meta/test.flac") << QStringLiteral("audio/flac") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; QTest::addRow("opus") << QFINDTESTDATA("samplefiles/no-meta/test.opus") << QStringLiteral("audio/opus") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; QTest::addRow("ogg") << QFINDTESTDATA("samplefiles/no-meta/test.ogg") << QStringLiteral("audio/ogg") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; QTest::addRow("mpc") << QFINDTESTDATA("samplefiles/no-meta/test.mpc") << QStringLiteral("audio/x-musepack") - << expectedKeys << QStringLiteral("Excess properties") + << expectedKeys << QString() ; } diff --git a/src/extractors/taglibextractor.cpp b/src/extractors/taglibextractor.cpp --- a/src/extractors/taglibextractor.cpp +++ b/src/extractors/taglibextractor.cpp @@ -80,7 +80,7 @@ if (!mpegFile.ID3v2Tag() || mpegFile.ID3v2Tag()->isEmpty()) { return; } - + TagLib::ID3v2::FrameList lstID3v2; // Artist. @@ -258,7 +258,7 @@ if (!mpcFile.tag() || mpcFile.tag()->isEmpty()) { return; } - + TagLib::APE::ItemListMap lstMusepack = mpcFile.APETag()->itemListMap(); TagLib::APE::ItemListMap::ConstIterator itMPC; @@ -607,7 +607,7 @@ result->addType(Type::Audio); ExtractedData data; - + if ((mimeType == QStringLiteral("audio/mpeg")) || (mimeType == QStringLiteral("audio/mpeg3")) || (mimeType == QStringLiteral("audio/x-mpeg"))) { @@ -637,15 +637,15 @@ for (uint i = 0; i < data.genres.size(); i++) { QString genre = convertWCharsToQString(data.genres[i]).trimmed(); - - // Convert from int - bool ok = false; - int genreNum = genre.toInt(&ok); - if (ok) { - genre = convertWCharsToQString(TagLib::ID3v1::genre(genreNum)); + if (!genre.isEmpty()) { + // Convert from int + bool ok = false; + int genreNum = genre.toInt(&ok); + if (ok) { + genre = convertWCharsToQString(TagLib::ID3v1::genre(genreNum)); + } + result->add(Property::Genre, genre); } - - result->add(Property::Genre, genre); } const auto artistString = data.artists.isEmpty()