PLS Parser: Implement no-metadata playlist saving.

This commit is contained in:
James D. Smith 2022-03-15 23:27:29 -06:00
parent dc51176437
commit ec103561c5
1 changed files with 10 additions and 2 deletions

View File

@ -69,12 +69,20 @@ void PLSParser::Save(const SongList& songs, QIODevice* device, const QDir& dir,
s << "Version=2" << endl;
s << "NumberOfEntries=" << songs.count() << endl;
QSettings settings;
settings.beginGroup(Playlist::kSettingsGroup);
bool writeMetadata = settings.value(Playlist::kWriteMetadata, true).toBool();
settings.endGroup();
int n = 1;
for (const Song& song : songs) {
s << "File" << n << "=" << URLOrFilename(song.url(), dir, path_type)
<< endl;
s << "Title" << n << "=" << song.title() << endl;
s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << endl;
if (writeMetadata) {
s << "Title" << n << "=" << song.title() << endl;
s << "Length" << n << "=" << song.length_nanosec() / kNsecPerSec << endl;
}
++n;
}
}