Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PICARD-3021: Context menu action to merge original and new metadata values #2574

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions picard/ui/metadatabox.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ def contextMenuEvent(self, event):
use_orig_value_action = QtGui.QAction(name, self)
use_orig_value_action.triggered.connect(partial(self._apply_update_funcs, useorigs))
menu.addAction(use_orig_value_action)
merge_tags_action = QtGui.QAction(_("Merge Original Values"), self)
merge_tags_action.triggered.connect(partial(self._merge_tags, selected_tag))
menu.addAction(merge_tags_action)
menu.addSeparator()
if single_tag:
menu.addSeparator()
Expand All @@ -491,6 +494,16 @@ def _apply_update_funcs(self, funcs):
f()
self.tagger.window.update_selection(new_selection=False, drop_album_caches=True)

def _merge_tags(self, tag):
with self.tagger.window.ignore_selection_changes:
for obj in self.objects:
values = list(obj.orig_metadata.getall(tag))
for new_value in obj.metadata.getall(tag):
if new_value not in values:
values.append(new_value)
obj.metadata[tag] = values
obj.update()

def _edit_tag(self, tag):
if self.tag_diff is not None:
EditTagDialog(self, tag).exec()
Expand Down
Loading