Skip to content
chocolatechipcats edited this page Oct 26, 2023 · 34 revisions

Metadata Management

This page is for users to share their metadata settings with others.

Some users spend considerable time normalizing metadata using replace_metadata and include/exclude_metadata_pre/post ini settings to do things such as:

For Contributors

When adding content to this page, please start with a level 3 header (### Title), a description and then use a code block (indent each line with spaces or one tab) for the ini settings. If those settings are for a specific site, include the appropriate [section] to indicate that.

You should also separate settings for different functions / fandoms so users can pick and choose more easily.

For Users

When taking content from here for your own use, it's up to you to correctly add and combine them to your personal.ini settings. However, here are a few common pointers.

There are other wiki pages for the details of using replace_metadata and include/exclude_metadata_pre/post.

Using add_to_replace_metadata instead of replace_metadata lets you do exactly that--add to the replace_metadata instead of overriding it. That way you can use add_to_replace_metadata in both site sections and [defaults] and have both included. Otherwise replace_metadata from [fanfiction.net] (for example) will override replace_metadata from [defaults] (Using add_to_ with include/exclude_metadata_pre/post is more complex.)

If you have questions, the best place to ask is the FanFicFare Calibre Plugin Forum.

Contributed Settings

Removing Japanese Characters

My Kindle Voyage doesn't correctly list books with Japanese characters. Since I include tags with category in my title plugboard (search for Calibre Plugboards), I like to remove those characters.

[defaults]
add_to_replace_metadata:
# kindle voyage doesn't list books with extended chars correctly.
 /ハイスクールD×D=>
 マクロス Frontier [|] =>
 <?/?[一-龠々ぁ-んーァ-ヾ★!]+(&[一-龠々ぁ-んーァ-ヾ★!]+)?>?=>

Removing AO3 'No Warnings', 'Tags To Be Added'

I don't find AO3's non-warnings and 'Tags To Be Added' tag to be useful. This removes them.

[archiveofourown.org]
exclude_metadata_pre:
 freeformtags,genre==Other Additional Tags to Be Added
 warnings==Creator Chose Not To Use Archive Warnings
 warnings==No Archive Warnings Apply

Generic cleanup

Normalizing the data a bit so that filtering actually works.

category=> (- All Media Types|- Fandom|\(Movies\)|\(Movie [0-9]+\)|\(Comics\)|\(TV\))$=>
characters=>\(mentions of\) =>
characters=> \([Ch]haracter\)=>
characters=> ?\((cameo|briefly|if you squint|sort of)\)=>
characters=> - Character=>
characters=>^Other mentions$=>

ships=>(.*)[/&](.*) \(?[Ff]riendship(?: only)\)?=>\1 & \2
ships=> - Relationship=>

No one has ever said 'I'm looking for a story with exactly one OC, but no more!'

ships_CHARS,characters=>^OC(s|)$=>Original Character
ships_CHARS,characters=>^OFC(s|)$=>Original Female Character
ships_CHARS,characters=>^OMC(s|)$=>Original Male Character
ships_CHARS,characters=>^Original (.*)Character(\(s\)|s|)$=>Original \1Character

Normalizing content ratings

Two examples, one using MPAA ratings, the second using FR ratings (created on Twisting the Hellmouth and used on various websites; modified by me to sort properly by replacing "FR7" with "FR07").

For MPAA ratings:

[defaults]
add_to_replace_metadata:
 rating=>^15$=>PG-13
 rating=>^Adult Only$=>NC-17
 rating=>^Everyone$=>G
 rating=>^Explicit$=>NC-17
 rating=>^FR7$=>G
 rating=>^FR13$=>PG
 rating=>^FR15$=>PG-13
 rating=>^FR18$=>R
 rating=>^FR21$=>NC-17
 rating=>^G - General Audiences$=>G
 rating=>^General Audiences$=>G
 rating=>^K$=>G
 rating=>^K\+$=>PG
 rating=>^M$=>R
 rating=>^Mature$=>R
 rating=>^NC-17 - No One 17 and Under Admitted$=>NC-17
 rating=>^Not Rated$=>Unrated
 rating=>^PG - Parental Guidance Suggested$=>PG
 rating=>^PG-13 - Parents Strongly Cautioned$=>PG-13
 rating=>^R - Restricted$=>R
 rating=>^T$=>PG-13
 rating=>^Teen And Up Audiences$=>PG-13
 rating=>^Teens \+$=>PG-13
 rating=>^Teens$=>PG-13
 rating=>^Young Teens$=>PG
 rating=>^X - Adult: No readers under 18\. Contains Graphic Adult Themes/Extreme violence\.$=>NC-17
 rating=>^$=>Unrated

For FR ratings:

[defaults]
add_to_replace_metadata:
 rating=>^FR7$=>FR07
 rating=>^G$=>FR07
 rating=>^PG$=>FR13
 rating=>^PG-13$=>FR15
 rating=>^R$=>FR18
 rating=>^NC-17$=>FR21
 rating=>^15$=>FR15
 rating=>^Adult Only$=>FR21
 rating=>^Everyone$=>FR07
 rating=>^Explicit$=>FR21
 rating=>^G - General Audiences$=>FR07
 rating=>^General Audiences$=>FR07
 rating=>^K$=>FR07
 rating=>^K\+$=>FR13
 rating=>^M$=>FR18
 rating=>^Mature$=>FR18
 rating=>^NC-17 - No One 17 and Under Admitted$=>FR21
 rating=>^Not Rated$=>Unrated
 rating=>^$=>Unrated
 rating=>^PG - Parental Guidance Suggested$=>FR13
 rating=>^PG-13 - Parents Strongly Cautioned$=>FR15
 rating=>^R - Restricted$=>FR18
 rating=>^T$=>FR15
 rating=>^Teen And Up Audiences$=>FR15
 rating=>^Teens \+$=>FR15
 rating=>^Teens$=>FR15
 rating=>^Young Teens$=>FR13
 rating=>^X - Adult: No readers under 18\. Contains Graphic Adult Themes/Extreme violence\.$=>FR21

Removing redundant character entries

Some fandoms have characters of indeterminate gender (e.g. player characters in video games), and authors sometimes add both a general and gender-specific entry.

[defaults]
exclude_metadata_pre:
## Removes "CharacterName" if Male or Female CharacterName is already present.
 characters=~^CharacterName&&characters=~^(Male|Female) CharacterName

Cleaner comments

This does not seem to work for Fanfiction.net.

[defaults]
add_to_replace_metadata:
## Changes line breaks to paragraphs
 description=><br/>=></p><p>
## Applies justified alignment to paragraphs
 description=><p>=><p align="justify">

More selective chapterslashtotal [Archive of Our Own]

For Archive of Our Own, this will display '5/10' in its entirety, but only '5' for '5/5' or '5/?'. Replaces the default 'Chapters' on the titlepage.

[archiveofourown.org]
chapterslashtotal_label: Chapters
titlepage_entries: seriesHTML,category,genre,language,characters,ships,status,datePublished,dateUpdated,dateCreated,rating,warnings,chapterslashtotal,numWords,publisher,description
add_to_replace_metadata:
 chapterslashtotal=>^(\d+)/\1$=>\1
 chapterslashtotal=>/\?$=>

Copy collections to series [Archive of Our Own]

I like to include specific gift/exchange collections in my Series column rather than using a separate column.

[archiveofourown.org]

## Copies collections to series
include_in_series:series,collections

add_to_include_metadata_pre:
## Include specific collections as series. Here, I've included both an exact version (==) and regex (=~). 
 collections==Fic Exchange 2023
 collections=~(Fic Exchange \d{4})

add_to_exclude_metadata_pre:
## If a fic also has a series, it'll concatenate the entries. To avoid this, use exclude_metadata_pre with a storyUrl conditional.
 series==Unwanted Series&&storyUrl==https://archiveofourown.org/works/xxxx
## If you're using collection URLs, you will also want to remove the series URL.
 seriesUrl==https://archiveofourown.org/series/xxxx&&storyUrl==https://archiveofourown.org/works/xxxx

## Alternately, if you prefer to keep the series:
 collections==Fic Exchange 2023&&storyUrl==https://archiveofourown.org/works/xxxx

add_to_replace_metadata:
## I apply transformations to 'collections' but applying them to 'series' should also work
 collections=>ficexchange=>Fic Exchange

To also include collection URLs for use on the titlepage and with the 'Set Calibre Series URL' option, add these lines. (Be careful to merge the sections instead of creating duplicate ones.)

Collection URL requires a version of FanFicFare released after April 4, 2023, which added the static include_in_* required for the placeholder (as FanFicFare cannot replace an empty entry).

[archiveofourown.org]
## This creates an 'collectionUrl' entry and adds a placeholder. I chose to use 'abc' for easy replacement (no escapes!).
add_to_extra_valid_entries:,collectionUrl
include_in_collectionUrl:"abc"

## Adds collectionURL to series.
include_in_seriesUrl:seriesUrl,collectionUrl

add_to_replace_metadata:
## Change the placeholder 'abcs' to collection urls using conditionals
## If you are using a collection name that has been modified by replace_metadata, make sure this goes below it.
 collectionUrl=>abc=>https://archiveofourown.org/collections/FicExchangeLink&&collections==Fic Exchange 2023

add_to_exclude_metadata_post:
## If the placeholder isn't changed during replace_metadata, this will remove it to prevent general breakage
 collectionUrl==abc

Add subtitle to custom column

Done on a story-by-story basis, this will move part of the title to a custom subtitle column. Requires a version of FanFicFare released after April 4, 2023, which added the static include_in_* which is used to set the subtitle entry.

[defaults]

## Creates custom subtitle and fulltitle entries
add_to_extra_valid_entries:,subtitle

## Maps the custom 'subtitle' entry to a custom column.
custom_columns_settings: 
## Subtitle (defined in storyUrl sections)
 subtitle=>#subtitle

## For this example, the original title is "Title: Subtitle"
[http://test1.com?sid=12345]
add_to_replace_metadata:
 title=>^.*=>Title

include_in_subtitle:"Subtitle"

Note that this will also modify the title as seen on the cover page. You can either add subtitle to the titlepage entries, or replace title with this custom fulltitle entry:

[defaults]

## Creates custom subtitle and fulltitle entries
add_to_extra_valid_entries:,subtitle,fulltitle

## fulltitle copies unreplaced title for titlepages
include_in_fulltitle:title.NOREPL

[epub]

titlepage_start:<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <title>${fulltitle} by ${author}</title>
 <link href="stylesheet.css" type="text/css" charset="UTF-8" rel="stylesheet"/>
 </head>
 <body class="fff_titlepage">
 <h3><a href="${storyUrl}">${fulltitle}</a> by ${authorHTML}</h3>
 <div>

Fix Literotica titles ending in Ch or Pt

It's apparently become a common thing for Literotica stories to mistakenly have 'Ch' or 'Pt' included in the story title. This shows how to remove those:

[literotica.com]
add_to_replace_metadata:
 title=>^(.*?) (Ch|Pt)$=>\1

Add AO3 series descriptions

Archive of Our Own (and other OTW websites) allows the author to include a series description. This is not collected by the adapter, but it's possible to manually insert it to the beginning of the description by using a replace_metadata with a seriesURL conditional.

If you have keep_summary_html:true (which is default), it's suggested to use HTML.

[archiveofourown.org]

add_to_replace_metadata:
 description=>^(.*)$=><p style="font-style: italic">This is the series description. This example is italicized to make it distinct from the story description, just remove the style tag if you don't want that.</p> \1&&seriesUrl==https://archiveofourown.org/series/000000