Ignore engine metadata notifications if the song was previously loaded via taglib.
Fixes issue #880 Fixes issue #864 Fixes issue #574
This commit is contained in:
parent
953f36dac0
commit
2d19c2899a
@ -155,7 +155,8 @@ Song::Private::Private()
|
||||
mtime_(-1),
|
||||
ctime_(-1),
|
||||
filesize_(-1),
|
||||
filetype_(Type_Unknown)
|
||||
filetype_(Type_Unknown),
|
||||
init_from_file_(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -219,6 +220,8 @@ void Song::InitFromFile(const QString& filename, int directory_id) {
|
||||
if(fileref->isNull())
|
||||
return;
|
||||
|
||||
d->init_from_file_ = true;
|
||||
|
||||
QFileInfo info(filename);
|
||||
d->basefilename_ = info.fileName();
|
||||
d->filesize_ = info.size();
|
||||
@ -369,6 +372,8 @@ void Song::GuessFileType(TagLib::FileRef* fileref) {
|
||||
void Song::InitFromQuery(const SqlRow& q, int col) {
|
||||
d->valid_ = true;
|
||||
|
||||
d->init_from_file_ = true;
|
||||
|
||||
#define tostr(n) (q.value(n).isNull() ? QString::null : q.value(n).toString())
|
||||
#define toint(n) (q.value(n).isNull() ? -1 : q.value(n).toInt())
|
||||
#define tofloat(n) (q.value(n).isNull() ? -1 : q.value(n).toDouble())
|
||||
@ -788,6 +793,11 @@ void Song::InitFromLastFM(const lastfm::Track& track) {
|
||||
void Song::MergeFromSimpleMetaBundle(const Engine::SimpleMetaBundle &bundle) {
|
||||
d->valid_ = true;
|
||||
|
||||
if (d->init_from_file_) {
|
||||
// This Song was already loaded using taglib. Our tags are probably better than the engine's.
|
||||
return;
|
||||
}
|
||||
|
||||
UniversalEncodingHandler detector(NS_FILTER_NON_CJK);
|
||||
QTextCodec* codec = detector.Guess(bundle);
|
||||
|
||||
|
@ -270,6 +270,9 @@ class Song {
|
||||
QString art_manual_; // Set by the user - should take priority
|
||||
|
||||
QImage image_;
|
||||
|
||||
// Whether this song was loaded from a file using taglib.
|
||||
bool init_from_file_;
|
||||
};
|
||||
|
||||
void ParseOggTag(const TagLib::Ogg::FieldListMap& map, const QTextCodec* codec, QString* disc, QString* compilation);
|
||||
|
Loading…
x
Reference in New Issue
Block a user