Quote:
Originally Posted by Jade Aislin
I want all the names in my ships to be in alphabetical order (a/b/c). However, the authors often label the ships out of order (b/a). Most of the code in my ship section is trying to fix this.
|
There's no way I can think of to do that with the regex replacement feature. But since I've been playing with some additional metadata config options anyway, I'll try adding this.
Attached is a version with new options:
- sort_ships option: Reorder ships so b/a and c/b/a become a/b and a/b/c. Only separates on '/', so use replace_metadata to change separator first if needed. Something like: ships=>[ ]*(/|&|&)[ ]*=>/ You can use ships_LIST to change the / back to something else if you want.
- join_string_<entry> option: FFDL list entries are comma separated by default. You can use this to change that. For example, if you want authors separated with ' & ' instead, use join_string_calibre_author:\s&\s. (\s == space)
- keep_in_order_<entry> options: FFDL sorts list entries by default (except for author/authorUrl/authorId). But if you want to use an extra entry derived from author, it ends up sorted. For example, if you added calibre_author: keep_in_order_calibre_author:true
- replace_metadata <entry>_LIST options: FFDL replace_metadata lines operate on individual list items for list entries. But now if you want to do a replacement on the joined string for the whole list, you can by using <entry>_LIST. Example, if you added calibre_author: calibre_author_LIST=>^(.{,100}).*$=>\1
Code:
# add a new entry that is a copy of author.
add_to_extra_valid_entries:,calibre_author
include_in_calibre_author:author
# Keep calibre_author in original order
keep_in_order_calibre_author:true
# separate calibre_author by ' & ' instead of ', '
join_string_calibre_author:\s&\s
# Limit calibre_author list to 100 characters and trim any
# trailing spaces.
add_to_replace_metadata:
calibre_author_LIST=>^(.{,100}).*$=>\1
calibre_author_LIST=>^(.*?) +$=>\1
ships=>[ ]*(/|&|&)[ ]*=>/
# Change ships with ' & ' and ' / ' to '/' separated.
# sort the ships.
sort_ships:true
(If you're curious, I was trying to get FFDL CLI output files to match the calibre file name output I use for my devices.)
UPDATE Jul 18, 2013 - Remove obsolete beta versions