Thread: Save to Disk
View Single Post
Old 09-03-2015, 01:11 AM   #3
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
A valiant effort.

Looks fairly decent, but I prefer general program mode (very flexible if you know what you are doing) so I reimplemented it entirely from scratch -- why keep extra custom columns around if they can be consolidated in one? Besides, every custom template column slows down the database as it is built and rebuilt dynamically.

Save to Disk template:
Code:
program:

# Define the series and series index, using readorder if possible.
# Fallback on "Novels".
series = first_non_empty(
	field('#readorder'),
	series_sort(),
	'Novels'
);
sidx = ifempty(
	finish_formatting(field('#readorder_index'), '0>3s', '[', '] '),
	finish_formatting(field('series_index'), '0>2s', '', ' - ')
);

author = strcat(
	substr(field('author_sort'), 0, 1), '/',
	field('author_sort'), '/'
);

final_result = strcat(
	# If readorder does *not* exist, prepend author info.
	test(
		field('#readorder'),
		'',
		author
	),
	series, '/', sidx, field('title')
);

Last edited by eschwartz; 09-03-2015 at 01:26 AM.
eschwartz is offline   Reply With Quote