Update temporary metadata when tags are changed
This commit is contained in:
@@ -76,6 +76,18 @@ void PlaylistItem::SetTemporaryMetadata(const Song &metadata) {
|
||||
temp_metadata_ = metadata;
|
||||
}
|
||||
|
||||
void PlaylistItem::UpdateTemporaryMetadata(const Song &metadata) {
|
||||
|
||||
Song old_metadata = temp_metadata_;
|
||||
temp_metadata_ = metadata;
|
||||
|
||||
// Keep samplerate, bitdepth and bitrate from the old metadata if it's not present in the new.
|
||||
if (temp_metadata_.samplerate() <= 0 && old_metadata.samplerate() > 0) temp_metadata_.set_samplerate(old_metadata.samplerate());
|
||||
if (temp_metadata_.bitdepth() <= 0 && old_metadata.bitdepth() > 0) temp_metadata_.set_bitdepth(old_metadata.bitdepth());
|
||||
if (temp_metadata_.bitrate() <= 0 && old_metadata.bitrate() > 0) temp_metadata_.set_bitrate(old_metadata.bitrate());
|
||||
|
||||
}
|
||||
|
||||
void PlaylistItem::ClearTemporaryMetadata() {
|
||||
temp_metadata_ = Song();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user