@@ -82,6 +82,7 @@ CollectionWatcher::CollectionWatcher(Song::Source source, QObject *parent)
|
||||
song_tracking_(false),
|
||||
mark_songs_unavailable_(source_ == Song::Source_Collection),
|
||||
expire_unavailable_songs_days_(60),
|
||||
overwrite_playcount_(false),
|
||||
overwrite_rating_(false),
|
||||
stop_requested_(false),
|
||||
abort_requested_(false),
|
||||
@@ -153,6 +154,7 @@ void CollectionWatcher::ReloadSettings() {
|
||||
mark_songs_unavailable_ = false;
|
||||
}
|
||||
expire_unavailable_songs_days_ = s.value("expire_unavailable_songs", 60).toInt();
|
||||
overwrite_playcount_ = s.value("overwrite_playcount", false).toBool();
|
||||
overwrite_rating_ = s.value("overwrite_rating", false).toBool();
|
||||
s.endGroup();
|
||||
|
||||
@@ -734,7 +736,7 @@ void CollectionWatcher::UpdateCueAssociatedSongs(const QString &file,
|
||||
const Song matching_cue_song = sections_map[new_cue_song.beginning_nanosec()];
|
||||
new_cue_song.set_id(matching_cue_song.id());
|
||||
if (!new_cue_song.has_embedded_cover()) new_cue_song.set_art_automatic(image);
|
||||
new_cue_song.MergeUserSetData(matching_cue_song, true);
|
||||
new_cue_song.MergeUserSetData(matching_cue_song, true, true);
|
||||
AddChangedSong(file, matching_cue_song, new_cue_song, t);
|
||||
used_ids.insert(matching_cue_song.id());
|
||||
}
|
||||
@@ -777,7 +779,7 @@ void CollectionWatcher::UpdateNonCueAssociatedSong(const QString &file,
|
||||
song_on_disk.set_id(matching_song.id());
|
||||
song_on_disk.set_fingerprint(fingerprint);
|
||||
if (!song_on_disk.has_embedded_cover()) song_on_disk.set_art_automatic(image);
|
||||
song_on_disk.MergeUserSetData(matching_song, !overwrite_rating_);
|
||||
song_on_disk.MergeUserSetData(matching_song, !overwrite_playcount_, !overwrite_rating_);
|
||||
AddChangedSong(file, matching_song, song_on_disk, t);
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ class CollectionWatcher : public QObject {
|
||||
bool song_tracking_;
|
||||
bool mark_songs_unavailable_;
|
||||
int expire_unavailable_songs_days_;
|
||||
bool overwrite_playcount_;
|
||||
bool overwrite_rating_;
|
||||
|
||||
bool stop_requested_;
|
||||
|
||||
@@ -1541,9 +1541,9 @@ void Song::ToXesam(QVariantMap *map) const {
|
||||
|
||||
}
|
||||
|
||||
void Song::MergeUserSetData(const Song &other, const bool merge_rating) {
|
||||
void Song::MergeUserSetData(const Song &other, const bool merge_playcount, const bool merge_rating) {
|
||||
|
||||
if (other.playcount() > 0) {
|
||||
if (merge_playcount && other.playcount() > 0) {
|
||||
set_playcount(other.playcount());
|
||||
}
|
||||
|
||||
|
||||
@@ -187,7 +187,7 @@ class Song {
|
||||
|
||||
// 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.
|
||||
void MergeUserSetData(const Song &other, const bool merge_rating);
|
||||
void MergeUserSetData(const Song &other, const bool merge_playcount, const bool merge_rating);
|
||||
|
||||
// Save
|
||||
void BindToQuery(SqlQuery *query) const;
|
||||
|
||||
@@ -393,7 +393,7 @@ QList<EditTagDialog::Data> EditTagDialog::LoadData(const SongList &songs) {
|
||||
Song copy(song);
|
||||
TagReaderClient::Instance()->ReadFileBlocking(copy.url().toLocalFile(), ©);
|
||||
if (copy.is_valid()) {
|
||||
copy.MergeUserSetData(song, false);
|
||||
copy.MergeUserSetData(song, false, false);
|
||||
ret << Data(copy);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,6 +221,7 @@ void CollectionSettingsPage::Load() {
|
||||
|
||||
ui_->checkbox_save_playcounts->setChecked(s.value("save_playcounts", false).toBool());
|
||||
ui_->checkbox_save_ratings->setChecked(s.value("save_ratings", false).toBool());
|
||||
ui_->checkbox_overwrite_playcount->setChecked(s.value("overwrite_playcount", false).toBool());
|
||||
ui_->checkbox_overwrite_rating->setChecked(s.value("overwrite_rating", false).toBool());
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
@@ -301,6 +302,7 @@ void CollectionSettingsPage::Save() {
|
||||
|
||||
s.setValue("save_playcounts", ui_->checkbox_save_playcounts->isChecked());
|
||||
s.setValue("save_ratings", ui_->checkbox_save_ratings->isChecked());
|
||||
s.setValue("overwrite_playcount", ui_->checkbox_overwrite_playcount->isChecked());
|
||||
s.setValue("overwrite_rating", ui_->checkbox_overwrite_rating->isChecked());
|
||||
|
||||
s.setValue("delete_files", ui_->checkbox_delete_files->isChecked());
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>1490</height>
|
||||
<height>1513</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -560,6 +560,13 @@ If there are no matches then it will use the largest image in the directory.</st
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_overwrite_playcount">
|
||||
<property name="text">
|
||||
<string>Overwrite database playcount when songs are re-read from disk</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkbox_overwrite_rating">
|
||||
<property name="text">
|
||||
|
||||
Reference in New Issue
Block a user