Always save metadata in playlist for Tidal, Qobuz and Subsonic songs
Fixes #851
This commit is contained in:
parent
5a50285dee
commit
f4d8d73970
|
@ -131,14 +131,14 @@ void M3UParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(Playlist::kSettingsGroup);
|
s.beginGroup(Playlist::kSettingsGroup);
|
||||||
bool writeMetadata = s.value(Playlist::kWriteMetadata, true).toBool();
|
bool write_metadata = s.value(Playlist::kWriteMetadata, true).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
for (const Song &song : songs) {
|
for (const Song &song : songs) {
|
||||||
if (song.url().isEmpty()) {
|
if (song.url().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (writeMetadata) {
|
if (write_metadata || (song.is_stream() && !song.is_radio())) {
|
||||||
QString meta = QString("#EXTINF:%1,%2 - %3\n").arg(song.length_nanosec() / kNsecPerSec).arg(song.artist(), song.title());
|
QString meta = QString("#EXTINF:%1,%2 - %3\n").arg(song.length_nanosec() / kNsecPerSec).arg(song.artist(), song.title());
|
||||||
device->write(meta.toUtf8());
|
device->write(meta.toUtf8());
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
||||||
|
|
||||||
QSettings s;
|
QSettings s;
|
||||||
s.beginGroup(Playlist::kSettingsGroup);
|
s.beginGroup(Playlist::kSettingsGroup);
|
||||||
bool writeMetadata = s.value(Playlist::kWriteMetadata, true).toBool();
|
bool write_metadata = s.value(Playlist::kWriteMetadata, true).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
StreamElement tracklist("trackList", &writer);
|
StreamElement tracklist("trackList", &writer);
|
||||||
|
@ -159,7 +159,7 @@ void XSPFParser::Save(const SongList &songs, QIODevice *device, const QDir &dir,
|
||||||
StreamElement track("track", &writer);
|
StreamElement track("track", &writer);
|
||||||
writer.writeTextElement("location", filename_or_url);
|
writer.writeTextElement("location", filename_or_url);
|
||||||
|
|
||||||
if (writeMetadata) {
|
if (write_metadata || (song.is_stream() && !song.is_radio())) {
|
||||||
writer.writeTextElement("title", song.title());
|
writer.writeTextElement("title", song.title());
|
||||||
if (!song.artist().isEmpty()) {
|
if (!song.artist().isEmpty()) {
|
||||||
writer.writeTextElement("creator", song.artist());
|
writer.writeTextElement("creator", song.artist());
|
||||||
|
|
Loading…
Reference in New Issue