Quote:
Originally Posted by capink
Append the following code under the run() method
|
Another way to do this without having to hard code the custom column name, is to append this instead to the run() method:
Code:
db = gui.current_db
for book_id in chain.scope().get_book_ids():
fmt_paths = []
fname = chain.evaluate_template(opts.template, book_id)
if single_dir:
fname = os.path.basename(fname)
if opts.formats == 'all':
formats = db.formats(book_id, index_is_id=True)
else:
formats = settings['formats']
for fmt in [fmt.strip().lower() for fmt in formats.split(',')]:
fmt_paths.append(os.path.join(path, f'{fname}.{fmt.lower()}'))
chain.set_book_var(book_id, 'save_to_disk_path', ','.join(fmt_paths))
Now, in your chain, add a second "Single Field Edit", choose the custom column from the dropdown menu and add the following template:
Code:
program:
book_vars('save_to_disk_path')