Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Closed Thread
 
Thread Tools Search this Thread
Old 01-26-2011, 05:21 PM   #1
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,520
Karma: 24495784
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Techniques to use plugboards, custom columns and templates

Several people are doing interesting and useful things with templates, plugboards, and composite fields. This thread is a place to put the information.

Plugboards can be accessed from Preferences->Metadata plugboards
You can create your own custom columns from Preferences->Add your own column

A useful tutorial on the calibre template language is to be found here.


Kindle/Kobo

Metadata: Show series - series Index - Title as Title (Kindle/Kobo) (economix)
Spoiler:
I have been playing around with the Metadata plugboards to get the titles on a Kindle 3 to show series information. I used the following template:
format: mobi
device: kindle2
template: {series}{series_index:0>2s| - | - }{title}
destination: title

This works very nicely for books that are part of a series e.g.:
Quote:
A Song of Ice & Fire - 01 - A Game of Thrones
A Song of Ice & Fire - 02 - A Clash of Kings
A Song of Ice & Fire - 03 - A Storm of Swords
A Song of Ice & Fire - 04 - A Feast for Crows

Metadata: Show series [series index] - title as title (Kindle) (Scott Nielsen)
Spoiler:
format: mobi
device: kindle2
template: {series:|| }{series_index:0>2s|[|] - }{title}
destination: title

Metadata: Show author name as Initial and Surname (Kindle) (inspired by brewjono)
Spoiler:
1) Verify author_sort values are Surname, Firstname order.
2) Uncheck 'use author sort' in the mobi output plugin.
3) Create a plugboard
format: mobi
device: kindle2
template: {author_sort:re(\, (.).*?( &|$),\, \1\2)}
destination: authors

Reading/read status custom column (Kindle) (pchrist7, w/ideas from beckywc):
Spoiler:
Extract reading/read status from kindle annotations and show them in a custom column. See this post for details and instructions..


Filename (Save Templates)

Filename: author sort/series/title - version (WinCE/Mobile (Mobipocket))(sweetpea)
Spoiler:
Using a version custom column in filenames
{author_sort}/{series}/{title} - v{#version:0>2s}

Filename: Create file paths grouping authors into [A - D]-like categories (WinCE/Mobile (Mobipocket)) (Sweetpea)
Spoiler:
{author_sort:switch(^[A-D],[A - D],^[E-J],[E - J],^[K-O],[K - O],^[P-T],[P - T],^[U-Z],[U - Z],[Other])}

Filename: Create path based on series index (sweetpea, inspired by Arco Witter)
Spoiler:
If you have a lot of books in a series, and want them in a folder hierarchy like series/00-09/author/title, series/10-19/author/title. You want just author/title if there is no series.
Create a composite column called (for example) #s_index.
Column: #s_dex
Template: {series_index:0>2s}

Save template:
Code:
 {series}{#s_dex:switch(0.,00-09,1.,10-19,2.,20-29,3.,30-39,4.,40-49,5.,50-59,6.,60-69,7.,70-79,8.,80-89,9.,90-99,)|/|/}{author}/{title}


Sony Metadata

Metadata: Show author and title for title (Sony) (Sweetpea)
Spoiler:
format: device-db
device: any device (or PRS505)
template: {authors} - {title}
destination: title

Metadata: Show title [series [series index]] as title, limiting series to 8 letters (Sony) (chaley)
Spoiler:
Put 8 characters of the series plus the series index at the end of the title. The plugboard is:
Code:
format: device-db
device: PRS505
template: {title}{series:<.8s| [|}{series_index:| [|]]}
destination: title

Metadata: Show series - series index - title, with series as initials (Sony) (inspired by speakingtohe)
Spoiler:
The plugboard is:
format: device-db
device: PRS505
template: {series:re(([^\s])[^\s]+(\s|$),\1)}{series_index:0>2s| - | - }{title}
destination: title

Metadata: Given a yes/no 'Read' custom column, have the collections display Read, Reading, Unread (Sony) (sweetpea)
Spoiler:
Assume that you have a custom yes/no column where you keep whether or not a book is read. Yes means the book is read, No means that the book is being read, and Unknown (empty) means that the book is to be read. This recipe will create a column containing Read/Reading/Unread that can be used to create a collection.

Create a composite custom column, named as you will. In this example we assume that the yes/no column is named #read. The new column's template will be:
template: {#read:switch(Yes,Read,No,Reading,Unread)}
Then put the new composite column's name into the fields to be used for series list in the Sony's device customization.


Apple iDevice Metadata

Metadata: Several examples (Apple devices) (GRiker)
See this 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)
Spoiler:
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:
Code:
Name: #stripped_series. Template: {series:re(^(A|The|An)\s+,)||}
Second column (the shortened form):
Code:
Name: #shortened. Template: {#stripped_series:shorten(4,-,4)}
Third column (the initials form):
Code:
Name: #initials. Template: {#stripped_series:re([\s]?([^\s])[^\s]+(\s|$),\1)}
Plugboard expression:
Code:
Template:{#stripped_series: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


Common composite custom columns

All the recipes below require the creation of a custom column of type 'Column built from other columns', called a composite column. Creation instructions are under the spoiler.
Spoiler:
1. Go to preferences, Interface (the first row), Add your own columns.
2) Click the green plus sign.
3) Choose a lookup name. This will be the name you use for searching and in templates. It must be letters, all lowercase. Note that when you use the lookup name you must prefix it with a '#' character. Do not enter that character here.
4) Choose a column heading. This is what will appear at the top of the column.
5) Choose a column type. For the recipes below, that type must be 'Column built from other columns'.
6) Enter the template from the recipe into the template box.
7) Press OK, Apply, etc. Restart calibre.

Display the ISBN. Template: {isbn}

Display the formats for a book. Template: {formats}

Display Yes if the book has an EPUB format. Template:{formats:contains(EPUB, Yes,)}

Display the author sort. Template: {author_sort}

Display the title sort. Template: {title_sort}

Last edited by kovidgoyal; 07-09-2017 at 11:15 PM.
kovidgoyal is online now  
Closed Thread


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Curious - what custom columns are you creating/using? texasnightowl Calibre 16 05-28-2015 11:26 AM
Been away for a few releases...question about custom columns support texasnightowl Calibre 3 10-14-2010 10:48 AM
Custom Columns - the Future? Starson17 Calibre 2 07-13-2010 10:56 AM
Testers wanted for 'series' custom columns chaley Calibre 15 06-26-2010 09:43 AM
Creating custom columns is broken in 0.7.3 chaley Calibre 6 06-20-2010 04:40 AM


All times are GMT -4. The time now is 07:02 AM.


MobileRead.com is a privately owned, operated and funded community.