View Single Post
Old 11-05-2012, 08:36 PM   #1000
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 164
Karma: 3100
Join Date: Sep 2011
Device: Kobo Auro H2O, PRS-T1
Quote:
Originally Posted by JimmXinu View Post
Yes, huge numbers of replace_metadata lines and complex patterns will slow down FFDL. I did not anticipate anyone would go to the lengths you guys are (when do you have time to read? ). I can help speed it up some, possibly a lot, with some simple internal optimizations. I will investigate.
I haven't noticed a slow down, but I'm still adding my replace_metadata lines. I read fiction from a number of different sites. However, some sites give two or more different names for the same character. There's also inconsistencies in fandom names. When I search for a story in a particular fandom or with a particular character, I don't want to search through different tags to find it. Any optimization can't hurt and I'd be greatful for it.



Quote:
Let's see if a brief review on how replace_metadata works will help.

The first and simplest is: pattern=>replacement

All metadata items that matches regexp 'pattern' will be replaced using the standard Python regexp library like so: "value = re.sub(pattern,replacement,value)"
Quote:
The third form is:
metakey[,metakey]=>pattern=>replacement&&conditionalkey=>condregex p

This essentially says, "For metadata items 'metakey', if metadata item 'conditionalkey' matches 'conditionalkey', replace 'pattern' with 'replacement'.

Now there are three conditions that must be true before the replacement is done. 1) It must be a metadata item 'metakey', 2) the value must match 'pattern' and 3) the value of metadata item 'conditionalkey' must match 'condregexp'.

Code:
 characters=>Sam W\.=>Sam Witwicky&&category=>Transformers
 characters=>Sam W\.=>Sam Winchester&&category=>Supernatural
Replacements are applied in order--so plan accordingly.
Thanks for explaining it. It helps to see how the code works. Although, I'm still a little confused on the 3rd example, I understand what it does.

Quote:
Another tip: If you want to be able to test your patterns without hitting your favorite stories again and again, you can use the fake test site and the extracharacters, extracategories, etc parameters. test1.com URLs will generate stories, but not go out to the network.

URL: http://test1.com?sid=12345

Code:
[test1.com]
extracharacters:Reginald Smythe-Smythe,Mokona,Harry P.

replace_metadata:
 characters=>Harry P\.=>Harry Potter
This is good to know. I've got a few different replacements that I'm not sure how to do. Using a testing site can't hurt. I've been reading that site you recommended and trying to figure out how to do a replacement by looking for something that isn't in the string.

I'm also having problems with the text program I use to edit my personal.ini as that program is converting some of the special characters (like the 'u' in Yūgi) to basic characters. Do you use a text program to work on your personal.ini or do you only edit it in the plugin window? If you use another program, what do you use?
Jade Aislin is offline