Merge/remove metadata?

94 views
Skip to first unread message

Matt C

unread,
May 2, 2013, 11:53:05 AM5/2/13
to fanfic-d...@googlegroups.com
I can't seem to find a way to fix the category/genre/ship overlap. With sites like sinful-desire.org, the category column will often be filled like this, "Alternate Universe, Sam/Dean, Supernatural." How do I get Alternate Universe and Sam/Dean moved to the genre and ships column respectively?

Is there a way to remove metadata? AO3 will sometimes have duplicate characters or ships, only spelt differently. (E.g., Derek Hale/Danny, Danny/Derek, Derek/Danny, [...]) Can I remove the duplicates? Or can I merge it into one tag?

Also, when I try to change a character name that includes parentheses, it doesn't change the metadata? So "characters=>^Kali (Supernatural)=>Kali" remains as "Kali (Supernatural)".

Jim Miller

unread,
May 2, 2013, 2:15:47 PM5/2/13
to fanfic-d...@googlegroups.com
On 5/2/2013 10:53 AM, Matt C wrote:
> I can't seem to find a way to fix the category/genre/ship overlap. With
> sites like sinful-desire.org, the category column will often be filled
> like this, "Alternate Universe, Sam/Dean, Supernatural." How do I get
> Alternate Universe and Sam/Dean moved to the genre and ships column
> respectively?

The only way I know of involves using replace_metadata rules for each
column to explicit match only the parts you want for each. It took a
fair bit of trial and error to figure out, but this seems to work:

[www.sinful-desire.org]
add_to_extra_valid_entries:mygenre,myships,mycategory

include_in_mygenre:category
include_in_myships:category
include_in_mycategory:category

replace_metadata:
mygenre=>^.*?(|Alternate Universe|Fantasy|Crossover)$=>\1
myships=>^.*?(|Sam/Dean|Chloe B. & J. Rizzoli)$=>\1
mycategory=>^.*?(|Supernatural|Harry Potter)$=>\1

custom_columns_settings:
mygenre=>#genre
myships=>#ships
mycategory=>#category

> Is there a way to remove metadata? AO3 will sometimes have duplicate
> characters or ships, only spelt differently. (E.g., Derek Hale/Danny,
> Danny/Derek, Derek/Danny, [...]) Can I remove the duplicates? Or can I
> merge it into one tag?

Again, the main tool to manipulate metadata in FFDL is replace_metadata.

ships=>^(Derek
Hale/Danny|Derek/Danny)$=>Danny/Derek&&category=>WhateverShowTheyComeFrom

Exact duplicates will be removed automatically. You'll either have to
add each variation you come across or learn enough about regular
expressions to generalize it more.

> Also, when I try to change a character name that includes parentheses,
> it doesn't change the metadata? So "characters=>^Kali
> (Supernatural)=>Kali" remains as "Kali (Supernatural)".

In regular expressions you have to escape parenthesis if they're part of
the string:

characters=>^Kali \(Supernatural\)=>Kali

Here's a version that will make any "name (series)" into just "name"

characters=>^(.+) \(.+\)=>\1


Matt C

unread,
May 3, 2013, 5:36:27 PM5/3/13
to fanfic-d...@googlegroups.com
Thank you ever so much.

I have one follow-up question. With the site-specific metadata it overrides the global replace_metadata (i.e., I have ' ships=>^Sam/Dean=>Dean Winchester/Sam Winchester', but it remains as Sam/Dean for sinful-desire.org).

I can't seem to find a way around this -- is there one?

Jim Miller

unread,
May 3, 2013, 6:02:47 PM5/3/13
to fanfic-d...@googlegroups.com
On 5/3/2013 4:36 PM, Matt C wrote:
> I have one follow-up question. With the site-specific metadata it
> overrides the global replace_metadata (i.e., I have '
> ships=>^Sam/Dean=>Dean Winchester/Sam Winchester', but it remains as
> Sam/Dean for sinful-desire.org).
>
> I can't seem to find a way around this -- is there one?

There is! It's a relatively new feature. Now ini params can be
extended by using the "add_to_" version.

What happens is that the most 'specific' section is used for
replace_metadata. In ascending order: defaults, www.site, site, epub,
www.site:epub, site:epub, overrides.

But then it goes back through the list of sections in reverse order
looking for add_to_replace_metadata and appends them.

So if you have something like this:

[defaults]
add_to_replace_metadata:
ships=>^Sam/Dean=>Dean Winchester/Sam Winchester

[www.sinful-desire.org]
...

replace_metadata:
mygenre=>^.*?(|Alternate Universe|Fantasy|Crossover)$=>\1
myships=>^.*?(|Sam/Dean|Chloe B. & J. Rizzoli)$=>\1
mycategory=>^.*?(|Supernatural|Harry Potter)$=>\1


The final effect is the same as if you had:

replace_metadata:
mygenre=>^.*?(|Alternate Universe|Fantasy|Crossover)$=>\1
myships=>^.*?(|Sam/Dean|Chloe B. & J. Rizzoli)$=>\1
mycategory=>^.*?(|Supernatural|Harry Potter)$=>\1
ships=>^Sam/Dean=>Dean Winchester/Sam Winchester

OTOH, if you used add_to_replace_metadata for both sections, you'd end
up with:

replace_metadata:
ships=>^Sam/Dean=>Dean Winchester/Sam Winchester
mygenre=>^.*?(|Alternate Universe|Fantasy|Crossover)$=>\1
myships=>^.*?(|Sam/Dean|Chloe B. & J. Rizzoli)$=>\1
mycategory=>^.*?(|Supernatural|Harry Potter)$=>\1

...which will behave differently if you're changing the same metadata.

However, now that I look at it, I bet this doesn't solve your problem if
you put myships directly into the calibre column. You'd need to add the
Sam/Dean=>Dean Winchester/Sam Winchester line to a specific myships
replacement.

Alternatively, a couple ideas I haven't tried that might work:

Adding myships to the defaults edit, too:

[defaults]
add_to_replace_metadata:
ships,myships=>^Sam/Dean=>Dean Winchester/Sam Winchester

Or possibly including myships in ships:

[www.sinful-desire.org]
include_in_ships:myships

...and setting the column from ships.

Matt C

unread,
May 4, 2013, 3:48:52 AM5/4/13
to fanfic-d...@googlegroups.com
Thanks!

I tried both methods, and they both worked:


[defaults]
add_to_replace_metadata:
  ships,myships=>^Sam/Dean=>Dean Winchester/Sam Winchester


[www.sinful-desire.org]
replace_metadata:
  myships=>^Sam/Dean=>Dean Winchester/Sam Winchester

Saluli

unread,
Jul 7, 2015, 11:36:52 PM7/7/15
to fanfic-d...@googlegroups.com
I really wasn't understanding how to do this. Now I will give it a new try.
Reply all
Reply to author
Forward
0 new messages