View Single Post
Old 06-09-2014, 11:00 AM   #2885
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,025
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by davidfor View Post
You can use the same test in the replace_metadata more than once. You could try something like:

Code:
replace_metadata:
 fandoms=>Thor \(Movies\)=>Thor
 fandoms=>Thor \(Movies\)=>Marvel Cinematic Universe
 fandoms=>Captain America \(Movies\)=>Captain America 
 fandoms=>Captain America \(Movies\)=>Marvel Cinematic Universe
It doesn't work that way. Each replace line is applied sequentially.

In the case shown above, "Thor (Movies)" is changed into "Thor" and then doesn't match the next 'Thor \(Movies\)' pattern any more.

I expect davidfor is actually using the technique where you add a new metadata item with extra_valid_entries, populate it with a copy of an existing one, then change each separately and merge back together.

Quote:
Originally Posted by davidfor View Post
The thing that I fell is missing for this is being able to supply more that one tag. There have been a couple of times where what I really wanted was to split the found tag into two. The solution was to put two lines in, but it does mean I have two copies of the same match string to maintain if things change.
I've looked at that a bit before and again now. I've found a way that appears to work.

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

Last edited by JimmXinu; 06-10-2014 at 10:08 AM. Reason: Correct typo - was Remove obsolete beta versions
JimmXinu is offline