Add option for overwriting database rating
This commit is contained in:
@@ -150,6 +150,7 @@ void CollectionWatcher::ReloadSettings() {
|
|||||||
song_tracking_ = s.value("song_tracking", false).toBool();
|
song_tracking_ = s.value("song_tracking", false).toBool();
|
||||||
mark_songs_unavailable_ = song_tracking_ ? true : s.value("mark_songs_unavailable", true).toBool();
|
mark_songs_unavailable_ = song_tracking_ ? true : s.value("mark_songs_unavailable", true).toBool();
|
||||||
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
|
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
|
||||||
|
overwrite_rating_ = s.value("overwrite_rating", false).toBool();
|
||||||
s.endGroup();
|
s.endGroup();
|
||||||
|
|
||||||
best_image_filters_.clear();
|
best_image_filters_.clear();
|
||||||
@@ -726,7 +727,7 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
|
|||||||
const Song matching_cue_song = sections_map[new_cue_song.beginning_nanosec()];
|
const Song matching_cue_song = sections_map[new_cue_song.beginning_nanosec()];
|
||||||
new_cue_song.set_id(matching_cue_song.id());
|
new_cue_song.set_id(matching_cue_song.id());
|
||||||
if (!new_cue_song.has_embedded_cover()) new_cue_song.set_art_automatic(image);
|
if (!new_cue_song.has_embedded_cover()) new_cue_song.set_art_automatic(image);
|
||||||
new_cue_song.MergeUserSetData(matching_cue_song);
|
new_cue_song.MergeUserSetData(matching_cue_song, true);
|
||||||
AddChangedSong(file, matching_cue_song, new_cue_song, t);
|
AddChangedSong(file, matching_cue_song, new_cue_song, t);
|
||||||
used_ids.insert(matching_cue_song.id());
|
used_ids.insert(matching_cue_song.id());
|
||||||
}
|
}
|
||||||
@@ -769,7 +770,7 @@ void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
|
|||||||
song_on_disk.set_id(matching_song.id());
|
song_on_disk.set_id(matching_song.id());
|
||||||
song_on_disk.set_fingerprint(fingerprint);
|
song_on_disk.set_fingerprint(fingerprint);
|
||||||
if (!song_on_disk.has_embedded_cover()) song_on_disk.set_art_automatic(image);
|
if (!song_on_disk.has_embedded_cover()) song_on_disk.set_art_automatic(image);
|
||||||
song_on_disk.MergeUserSetData(matching_song);
|
song_on_disk.MergeUserSetData(matching_song, !overwrite_rating_);
|
||||||
AddChangedSong(file, matching_song, song_on_disk, t);
|
AddChangedSong(file, matching_song, song_on_disk, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -213,6 +213,7 @@ class CollectionWatcher : public QObject {
|
|||||||
bool song_tracking_;
|
bool song_tracking_;
|
||||||
bool mark_songs_unavailable_;
|
bool mark_songs_unavailable_;
|
||||||
int expire_unavailable_songs_days_;
|
int expire_unavailable_songs_days_;
|
||||||
|
bool overwrite_rating_;
|
||||||
|
|
||||||
bool stop_requested_;
|
bool stop_requested_;
|
||||||
bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working.
|
bool rescan_in_progress_; // True if RescanTracksNow() has been called and is working.
|
||||||
|
|||||||
@@ -1680,13 +1680,13 @@ void Song::ToXesam(QVariantMap *map) const {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Song::MergeUserSetData(const Song &other) {
|
void Song::MergeUserSetData(const Song &other, const bool merge_rating) {
|
||||||
|
|
||||||
if (other.playcount() > 0) {
|
if (other.playcount() > 0) {
|
||||||
set_playcount(other.playcount());
|
set_playcount(other.playcount());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (other.rating() > 0) {
|
if (merge_rating && other.rating() > 0.0F) {
|
||||||
set_rating(other.rating());
|
set_rating(other.rating());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ class Song {
|
|||||||
|
|
||||||
// Copies important statistics from the other song to this one, overwriting any data that already exists.
|
// Copies important statistics from the other song to this one, overwriting any data that already exists.
|
||||||
// Useful when you want updated tags from disk but you want to keep user stats.
|
// Useful when you want updated tags from disk but you want to keep user stats.
|
||||||
void MergeUserSetData(const Song &other);
|
void MergeUserSetData(const Song &other, const bool merge_rating);
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
void BindToQuery(SqlQuery *query) const;
|
void BindToQuery(SqlQuery *query) const;
|
||||||
|
|||||||
@@ -393,7 +393,7 @@ QList<EditTagDialog::Data> EditTagDialog::LoadData(const SongList &songs) {
|
|||||||
Song copy(song);
|
Song copy(song);
|
||||||
TagReaderClient::Instance()->ReadFileBlocking(copy.url().toLocalFile(), ©);
|
TagReaderClient::Instance()->ReadFileBlocking(copy.url().toLocalFile(), ©);
|
||||||
if (copy.is_valid()) {
|
if (copy.is_valid()) {
|
||||||
copy.MergeUserSetData(song);
|
copy.MergeUserSetData(song, false);
|
||||||
ret << Data(copy);
|
ret << Data(copy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ void CollectionSettingsPage::Load() {
|
|||||||
|
|
||||||
ui_->checkbox_save_playcounts->setChecked(s.value("save_playcounts", false).toBool());
|
ui_->checkbox_save_playcounts->setChecked(s.value("save_playcounts", false).toBool());
|
||||||
ui_->checkbox_save_ratings->setChecked(s.value("save_ratings", false).toBool());
|
ui_->checkbox_save_ratings->setChecked(s.value("save_ratings", false).toBool());
|
||||||
|
ui_->checkbox_overwrite_rating->setChecked(s.value("overwrite_rating", false).toBool());
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||||
ui_->checkbox_delete_files->setChecked(s.value("delete_files", false).toBool());
|
ui_->checkbox_delete_files->setChecked(s.value("delete_files", false).toBool());
|
||||||
@@ -279,6 +280,7 @@ void CollectionSettingsPage::Save() {
|
|||||||
|
|
||||||
s.setValue("save_playcounts", ui_->checkbox_save_playcounts->isChecked());
|
s.setValue("save_playcounts", ui_->checkbox_save_playcounts->isChecked());
|
||||||
s.setValue("save_ratings", ui_->checkbox_save_ratings->isChecked());
|
s.setValue("save_ratings", ui_->checkbox_save_ratings->isChecked());
|
||||||
|
s.setValue("overwrite_rating", ui_->checkbox_overwrite_rating->isChecked());
|
||||||
|
|
||||||
s.setValue("delete_files", ui_->checkbox_delete_files->isChecked());
|
s.setValue("delete_files", ui_->checkbox_delete_files->isChecked());
|
||||||
|
|
||||||
|
|||||||
@@ -560,6 +560,13 @@ If there are no matches then it will use the largest image in the directory.</st
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkbox_overwrite_rating">
|
||||||
|
<property name="text">
|
||||||
|
<string>Overwrite database rating when songs are re-read from disk</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="layout_statistics_button">
|
<layout class="QHBoxLayout" name="layout_statistics_button">
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user