mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Allow arbitrary changes to the identifiers field in bulk edit search/replace
This commit is contained in:
parent
79231df21c
commit
0491992a26
@ -712,7 +712,8 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
|
||||
dest_mode = self.replace_mode.currentIndex()
|
||||
|
||||
if self.destination_field_fm['is_csp']:
|
||||
if not unicode(self.s_r_dst_ident.text()):
|
||||
dest_ident = unicode(self.s_r_dst_ident.text())
|
||||
if not dest_ident or (src == 'identifiers' and dest_ident == '*'):
|
||||
raise Exception(_('You must specify a destination identifier type'))
|
||||
|
||||
if self.destination_field_fm['is_multiple']:
|
||||
@ -816,13 +817,18 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog):
|
||||
# convert the colon-separated pair strings back into a dict,
|
||||
# which is what set_identifiers wants
|
||||
dst_id_type = unicode(self.s_r_dst_ident.text())
|
||||
if dst_id_type:
|
||||
if dst_id_type and dst_id_type != '*':
|
||||
v = ''.join(val)
|
||||
ids = mi.get(dest)
|
||||
ids[dst_id_type] = v
|
||||
val = ids
|
||||
else:
|
||||
val = dict([(t.split(':')) for t in val])
|
||||
try:
|
||||
val = dict([(t.split(':')) for t in val])
|
||||
except:
|
||||
raise Exception(_('Invalid identifier string. It must be a '
|
||||
'comma-separated list of pairs of '
|
||||
'strings separated by a colon'))
|
||||
else:
|
||||
val = self.s_r_replace_mode_separator().join(val)
|
||||
if dest == 'title' and len(val) == 0:
|
||||
|
@ -504,7 +504,7 @@ from the value in the box</string>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="restore_original">
|
||||
<property name="toolTip">
|
||||
<string>When doing a same format to same format conversion,
|
||||
<string>When doing a same format to same format conversion,
|
||||
for e.g., EPUB to EPUB, calibre saves the original EPUB
|
||||
as ORIGINAL_EPUB. This option tells calibre to restore
|
||||
the EPUB from ORIGINAL_EPUB. Useful if you did a bulk
|
||||
@ -1006,7 +1006,10 @@ not multiple and the destination field is multiple</string>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Choose which identifier type to operate upon</string>
|
||||
<string><p>Choose which identifier type to operate upon. If the
|
||||
source field is something other than 'identifiers' you can enter
|
||||
a * if you want to replace the entire set of identifiers with
|
||||
the result of the search/replace.</p></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
x
Reference in New Issue
Block a user