mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 20:09:50 +01:00
Don't re-read song tags from files while loading a playlist if they're already avaiable in the library. Fixes issue #1165
This commit is contained in:
parent
ced9a8b6e2
commit
eca62e037b
@ -45,10 +45,12 @@ SongList AsxIniParser::Load(QIODevice *device, const QDir &dir) const {
|
||||
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(song.filename());
|
||||
if (library_song.is_valid())
|
||||
if (library_song.is_valid()) {
|
||||
ret << library_song;
|
||||
else
|
||||
} else {
|
||||
song.InitFromFile(song.filename(), -1);
|
||||
ret << song;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,30 +174,27 @@ SongList CueParser::Load(QIODevice* device, const QDir& dir) const {
|
||||
Song current;
|
||||
if (!ParseTrackLocation(entry.file, dir, ¤t)) {
|
||||
qWarning() << "failed to parse location in .cue file from " << dir_path;
|
||||
|
||||
} else {
|
||||
// overwrite the stuff, we may have read from the file, using
|
||||
// the .cue's metadata
|
||||
if(i + 1 < entries.size()) {
|
||||
// incorrect indices?
|
||||
if(!UpdateSong(entry, entries.at(i + 1).index, ¤t)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// incorrect index?
|
||||
if(!UpdateLastSong(entry, ¤t)) {
|
||||
continue;
|
||||
}
|
||||
Song song = LoadLibrarySong(current.filename());
|
||||
if (!song.is_valid()) {
|
||||
song.InitFromFile(current.filename(), -1);
|
||||
}
|
||||
|
||||
// overwrite the stuff, we may have read from the file, using
|
||||
// the .cue's metadata
|
||||
if(i + 1 < entries.size()) {
|
||||
// incorrect indices?
|
||||
if(!UpdateSong(entry, entries.at(i + 1).index, &song)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// incorrect index?
|
||||
if(!UpdateLastSong(entry, &song)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Song final;
|
||||
// TODO: make this work
|
||||
// load this song from the library if it's there
|
||||
// Song final = LoadLibrarySong(current.filename());
|
||||
|
||||
Song to_add = final.is_valid() ? final : current;
|
||||
|
||||
ret << to_add;
|
||||
ret << song;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,10 +58,6 @@ SongList M3UParser::Load(QIODevice* device, const QDir& dir) const {
|
||||
}
|
||||
} else {
|
||||
Song song;
|
||||
song.Init(current_metadata.title,
|
||||
current_metadata.artist,
|
||||
QString(), // Unknown album.
|
||||
current_metadata.length);
|
||||
|
||||
// Track location.
|
||||
if (!ParseTrackLocation(line, dir, &song)) {
|
||||
@ -69,10 +65,16 @@ SongList M3UParser::Load(QIODevice* device, const QDir& dir) const {
|
||||
} else {
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(song.filename());
|
||||
if (library_song.is_valid())
|
||||
if (library_song.is_valid()) {
|
||||
ret << library_song;
|
||||
else
|
||||
} else {
|
||||
song.Init(current_metadata.title,
|
||||
current_metadata.artist,
|
||||
QString(), // Unknown album.
|
||||
current_metadata.length);
|
||||
song.InitFromFile(song.filename(), -1);
|
||||
ret << song;
|
||||
}
|
||||
|
||||
current_metadata.artist.clear();
|
||||
current_metadata.title.clear();
|
||||
|
@ -54,7 +54,6 @@ bool ParserBase::ParseTrackLocation(const QString& filename_or_url,
|
||||
QString absolute_path = dir.absoluteFilePath(proper_path);
|
||||
song->set_filename(absolute_path);
|
||||
}
|
||||
song->InitFromFile(song->filename(), -1);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,11 @@ SongList PLSParser::Load(QIODevice *device, const QDir &dir) const {
|
||||
|
||||
// Load the song from the library if it's there.
|
||||
Song library_song = LoadLibrarySong(songs[n].filename());
|
||||
if (library_song.is_valid())
|
||||
if (library_song.is_valid()) {
|
||||
songs[n] = library_song;
|
||||
|
||||
} else {
|
||||
songs[n].InitFromFile(songs[n].filename(), -1);
|
||||
}
|
||||
} else if (key.startsWith("title")) {
|
||||
songs[n].set_title(value);
|
||||
} else if (key.startsWith("length")) {
|
||||
|
Loading…
Reference in New Issue
Block a user