Quote:
Originally Posted by ownedbycats
Well, unless the field (series_index) isn't available for editing with the SFE.
|
This stored template sets the series index to whatever the argument is:
Code:
python:
def evaluate(book, context):
args = context.arguments
if args is None or len(args) != 1:
return 'Invalid arguments'
try:
sidx = float(args[0])
except:
return 'Bad series index'
db = context.db
from calibre.gui2.ui import get_gui
gui = get_gui()
bids = gui.current_view().get_selected_ids()
results = []
for bid in bids:
db.set_series_index(bid, sidx)
results.append(db.title(bid, index_is_id=True))
db.refresh_ids(bids)
gui.current_view().model().refresh_ids(bids)
return 'Done: ' + ', '.join(results)
You call it by selecting books and running this template in the template tester:
Code:
program: change_series_index(0)
where the 0 is whatever you want.
You can also use it in an Action Chains formula action.
You can't use it in bulk edit search & replace.