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()
|
dest_mode = self.replace_mode.currentIndex()
|
||||||
|
|
||||||
if self.destination_field_fm['is_csp']:
|
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'))
|
raise Exception(_('You must specify a destination identifier type'))
|
||||||
|
|
||||||
if self.destination_field_fm['is_multiple']:
|
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,
|
# convert the colon-separated pair strings back into a dict,
|
||||||
# which is what set_identifiers wants
|
# which is what set_identifiers wants
|
||||||
dst_id_type = unicode(self.s_r_dst_ident.text())
|
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)
|
v = ''.join(val)
|
||||||
ids = mi.get(dest)
|
ids = mi.get(dest)
|
||||||
ids[dst_id_type] = v
|
ids[dst_id_type] = v
|
||||||
val = ids
|
val = ids
|
||||||
else:
|
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:
|
else:
|
||||||
val = self.s_r_replace_mode_separator().join(val)
|
val = self.s_r_replace_mode_separator().join(val)
|
||||||
if dest == 'title' and len(val) == 0:
|
if dest == 'title' and len(val) == 0:
|
||||||
|
@ -504,7 +504,7 @@ from the value in the box</string>
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="restore_original">
|
<widget class="QCheckBox" name="restore_original">
|
||||||
<property name="toolTip">
|
<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
|
for e.g., EPUB to EPUB, calibre saves the original EPUB
|
||||||
as ORIGINAL_EPUB. This option tells calibre to restore
|
as ORIGINAL_EPUB. This option tells calibre to restore
|
||||||
the EPUB from ORIGINAL_EPUB. Useful if you did a bulk
|
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>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<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>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user