View Single Post
Old 11-04-2012, 02:26 AM   #991
seabream
Enthusiast
seabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheeseseabream can extract oil from cheese
 
Posts: 48
Karma: 1056
Join Date: Jul 2012
Location: Central Canada
Device: Sony PRS-T1, RIM Playbook & Z10, Samsung Note, MacOSX
Trying to understand the syntax JimmXinu, apologies for my lack of certainty. I have read the Calibre faq section on regular expressions, but part of the question has to do with how FFDL parses.

characters=>(.+)=>Character.Transformers.\1&&categ ory=>Transformers
says:
look in class: characters=>find (any text string of any length in an individual tag)=>output to the Character column the tag contents from the brackets prepended with the string “Transformers.” if the string was from the category Transformers. Is that correct?
Basically, I’m not sure whether “Character” is the destination, the class, or what.

So if I want to have FFDL take a character who appears in two related fandoms, like Willow R. in either Buffy: The Vampire Slayer and Angel, and convert it to ch Jossverse: Willow Rosenberg in general tags and Jossverse.B:tVS.Willow Rosenberg or Jossverse.Angel.Willow Rosenberg as appropriate (I split Buffy, Angel, in the hierarchical column but combine it in general tags) in the character column I would do:
Spoiler:
characters=>Willow R\.=>Willow Rosenberg
category=>Buffy: the Vampire Slayer\.=>Jossverse.B:tVS
category=>Angel=>Jossverse.Angel
characters=>(.+)=>edchars.Jossverse.B:tVS\1&&categ ory=>Jossverse.Buffy
characters=>(.+)=>edchars.Jossverse.Angel\1&&categ ory=>Jossverse.Angel
characters=>(.+)=>Character.ch Jossverse: \1&&category=>(Jossverse.Buffy|Jossverse.Angel)

? I suspect not, but I’m not sure how to do it. And granted that even if it worked, it would break in the crossover case mentioned by Jade Aislin above. There are embedded questions about at what points FFDL looks at the data downloaded vs. subsequently altered entries.
What I currently do (written prior to the introduction of 5 part lines, and only works for characters with unique names per fandom) is (excerpt):

Spoiler:

extra_valid_entries:edchars,edfand
edchars_label:Characters by fandom
edfand_label:Fandom

include_in_edchars:characters

custom_columns_settings:
edchars=>#characters,n
edfand=>#fandom,n

## FFNet uses different entries for Wesley in Angel and B:tVS, thus the first line
characters=>(^Wesley W\.$|^Wesley W\.P\.$)=>Wesley Wyndam-Pryce
characters=>Willow R\.=>Willow Rosenberg
characters=>(Angel|Anya Jenkins|Buffy Summers|Cordelia Chase|Dawn Summers|Darla|Drusilla|Faith Lehane|Fred Burkle|Illyria|Rupert Giles|Spike|Tara Maclay|Wesley Wyndam-Pryce|Willow Rosenberg|Xander Harris|Vi)=>ch Jossverse: \1
category=>Buffy: the Vampire Slayer\.=>Jossverse.B:tVS
category=>Angel=>Jossverse.Angel
edchars=>(ch Jossverse: )=>Jossverse.
category=>^(.+)$=>fand: \1
edfand=>(fand: )=>

and then manually add the Angel or B:tVS to the characters in the custom column.


Notes to Jade Aislin (or others doing specific substitutions):
Spoiler:

1: The 1 refers to the bit in the brackets. If you have more than one group of expressions it counts left to right, so the contents of the second set of brackets would be 2.

|: The pipe is a way to search for multiple strings. Use it as a separator, and it searches for what’s on either side. Note, don’t begin or end with it, or have two in a row or it will match blanks or anys.

^$: If you have two character strings where one contains the entirety of the other (e.g.: “Molly”, “Molly Davies”, then put the shorter one between a leading ^ and trailing $. The ^ matches the beginning of the tag and $ the end. Otherwise a story containing “Molly Davies” would have both searches match: characters=>(Molly|Molly Davies)=>fandom.\1 would give you fandom.Molly, fandom.Molly Davies
characters=>(^Molly$|Molly Davies)=>fandom.\1 would give you fandom.Molly Davies

\: While it usually causes a single special character directly after it, most commonly “.” to be treated as text, there are exceptions. e.g.: You have to use &Amp; for &
Also, note that some symbols, while similar don’t match in search strings. On AO3, for example, the tag _Jennifer “JJ” Jareau_ won’t match using the quotation mark generated using the keyboard writing in text edit. At a guess because it uses smart quotes. I haven’t gotten around to testing whether I can copy/paste the correct one.

On character lists: When I was starting out, I did exhaustive character lists for full name substitution and prepending for several fandoms on FFNet, but I found that when you get into the mid-three digits, metadata processing starts to get quite a bit slower, so I culled it to just the ones that would save me the most time on balance. (If people want copies of Glee, Harry Potter (so many characters!), Heroes, Rizzoli & Isles, The Hollows - Kim Harrison or The L Word, let me know via PM. Actually, if dailyalice wants to host them, I can send them when I have some time to do a bit of sorting.)

Last edited by seabream; 11-04-2012 at 02:28 AM. Reason: I cut more from the excerpt than I should have, so I added a bit back.
seabream is offline