Skip to content

Commit d6265d4

Browse files
committed
PLS Parser: Apply playlist metadata to song only if it is not in the library.
1 parent d8cd1e0 commit d6265d4

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

src/playlistparsers/plsparser.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,21 @@ SongList PLSParser::Load(QIODevice* device, const QString& playlist_path,
4343
if (key.startsWith("file")) {
4444
Song song = LoadSong(value, 0, dir);
4545

46-
// Use the title and length we've already loaded if any
47-
if (!songs[n].title().isEmpty()) song.set_title(songs[n].title());
48-
if (songs[n].length_nanosec() != -1)
49-
song.set_length_nanosec(songs[n].length_nanosec());
46+
// Use the title and length we've already loaded if any and only if the
47+
// song is not in the library.
48+
if (!song.is_library_song()) {
49+
if (!songs[n].title().isEmpty()) song.set_title(songs[n].title());
50+
if (songs[n].length_nanosec() != -1)
51+
song.set_length_nanosec(songs[n].length_nanosec());
52+
}
5053

5154
songs[n] = song;
5255
} else if (key.startsWith("title")) {
53-
songs[n].set_title(value);
56+
if (!songs[n].is_library_song()) songs[n].set_title(value);
5457
} else if (key.startsWith("length")) {
5558
qint64 seconds = value.toLongLong();
56-
if (seconds > 0) {
59+
if ((seconds > 0) && !songs[n].is_library_song())
5760
songs[n].set_length_nanosec(seconds * kNsecPerSec);
58-
}
5961
}
6062
}
6163

0 commit comments

Comments
 (0)