View Single Post
Old 06-09-2014, 07:39 PM   #2886
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,043
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by JimmXinu View Post
I've arbitrarily chosen '{{,}}' as a separator to indicate to split the replacement string at that point(s) into a list and append the new entries to the end of the list. Because they go to the end, they will in turn have replace_metadata applied.

There's a risk of infinite recursion, that I haven't thought about very deeply yet.

If you're curious, here's my test case:
Spoiler:

Story URL test1.com?sid=1001 and setting default to Update Calibre Only speeds testing considerable.
Code:
[test1.com]
replace_metadata:
 category=>Marvel Cinematic Universe=>Marvel Cinematic MultiVerse
 category=>Thor \(Movies\)=>Thor{{,}}Marvel Cinematic Universe
 genre=>Action=>MovieAction&&category=>MultiVerse

[teststory:1001]
add_to_category_list:Thor (Movies)
add_to_genre_list:Action
chaptertitles:Prologue,Chapter 1\, Xenos on Cinnabar,Chapter 2\, Sinmay on Kintikin,3. Chapter 3,Chapter 4,Chapter 5,Chapter 6,Chapter 7,Chapter 8
Yields:
Category: Marvel Cinematic MultiVerse, Thor
Genre: MovieAction
I've been testing this and while introducing cycles doesn't cause infinite loops, the behavior isn't easily predicted.

But for straightforward cases, it seems to work as intended.

The attached version moves the in/exclude_metadata_post checks after the '{{,}}' splitting.

Last edited by JimmXinu; 06-12-2014 at 06:49 PM. Reason: Remove obsolete beta versions
JimmXinu is offline