Make sure that the extracted "cover art" image file is valid.
This commit is contained in:
parent
16aaebec22
commit
5cac3faa8b
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 4
|
#define VER_LAMEXP_MINOR_LO 4
|
||||||
#define VER_LAMEXP_TYPE Alpha
|
#define VER_LAMEXP_TYPE Alpha
|
||||||
#define VER_LAMEXP_PATCH 1
|
#define VER_LAMEXP_PATCH 1
|
||||||
#define VER_LAMEXP_BUILD 780
|
#define VER_LAMEXP_BUILD 781
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QImage>
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
@ -582,12 +583,19 @@ void FileAnalyzer::retrieveCover(AudioFileModel &audioFile, const QString &fileP
|
|||||||
val = val.split(" ", QString::SkipEmptyParts, Qt::CaseInsensitive).first();
|
val = val.split(" ", QString::SkipEmptyParts, Qt::CaseInsensitive).first();
|
||||||
}
|
}
|
||||||
QByteArray coverData = QByteArray::fromBase64(val.toLatin1());
|
QByteArray coverData = QByteArray::fromBase64(val.toLatin1());
|
||||||
QFile coverFile(QString("%1/%2.%3").arg(lamexp_temp_folder2(), lamexp_rand_str(), extension));
|
if(!(QImage::fromData(coverData, extension.toUpper().toLatin1().constData()).isNull()))
|
||||||
if(coverFile.open(QIODevice::WriteOnly))
|
|
||||||
{
|
{
|
||||||
coverFile.write(coverData);
|
QFile coverFile(QString("%1/%2.%3").arg(lamexp_temp_folder2(), lamexp_rand_str(), extension));
|
||||||
coverFile.close();
|
if(coverFile.open(QIODevice::WriteOnly))
|
||||||
audioFile.setFileCover(coverFile.fileName(), true);
|
{
|
||||||
|
coverFile.write(coverData);
|
||||||
|
coverFile.close();
|
||||||
|
audioFile.setFileCover(coverFile.fileName(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("Image data seems to be invalid :-(");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user