View Single Post
Old 10-23-2010, 06:09 PM   #78
Junior Member
Mriswith2k began at the beginning.
Posts: 8
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Originally Posted by chaley View Post
General Metadata
Metadata: Put series into the title, using either initials or a shortened form. Strip leading articles from the series name (any) (inspired by Gary_M_Mugford)
The solution requires creating three composite columns. The first column is used to remove the leading articles. The second is used to compute the 'shorten' form. The third is to compute the 'initials' form. Once you have these columns, the plugboard selects between them. You can hide any or all of the three columns on the library view.

First column:
Name: #stripped_series. Template: {series:re(^(A|The|An)\s+,)||}
Second column (the shortened form):
Name: #shortened. Template: {#stripped_series:shorten(4,-,4)}
Third column (the initials form):
Name: #initials. Template: {#stripped_series:re(([^\s])[^\s]+(\s|$),\1)}
Plugboard expression:
Template:{#composite:lookup(.\s,#initials,.,#shortened,series)}{series_index:0>2s| [|] }{title}
Destination field: title
This set of fields and plugboard produces:
Series: The Lord of the Rings
Series index: 2
Title: The Two Towers
Output: LotR [02] The Two Towers

Series: Dahak
Series index: 1
Title: Mutineers Moon
Output: Dahak [01] Mutineers Moon

Series: Berserkers
Series Index: 4
Title: Berserker Throne
Output: Bers-kers [04] Berserker Throne

Series: Meg Langslow Mysteries
Series Index: 3
Title: Revenge of the Wrought-Iron Flamingos
Output: MLM [03] Revenge of the Wrought-Iron Flamingos

After trying to get that template setup to work for the last hour or three , I finally found what's broken in the template, the:

Template:{#composite:lookup(.\s,#initials,.,#shortened,series)}{series _index:0>2s| [|] }{title}
Destination field: title

should instead be

Template:{#stripped_series:lookup(.\s,#initials,.,#shortened,series)}{series _index:0>2s| [|] }{title}
Destination field: title

I assume you used '#composite' to test out the the original 'stripped_series' output and forgot about it since your output would still be coming out correct , cheers for making / collecting all these awesome templates as well, saved me from continuing renaming all my titles manually before sending them to my kindle >_>
Mriswith2k is offline   Reply With Quote