View Single Post
Old 09-27-2016, 01:39 PM   #1508
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 Loba View Post
Is there a way to make it so if two tags are present it adds a third? Basically I need a boolean AND, but I can't seem to find a good way to do it.
If, say, both hunter!Cas and angel!Dean are present (not either/or) in freeformtags then it would add reverse!verse and AU and keep hunter!Cas and angel!Dean as well. I've considered the below, but it doesn't work as I have it written.

Code:
 freeformtags,category,genre=>^[Rr]everse.[Vv]erse|(angel!Dean)(hunter!Cas)$=>reverse!verse\,AU\,\1\,\2
I've fudged around with this for awhile, but am stumped. Thoughts?
Hrm... That's not going to work because replace_metadata operates on individual values. So it can only see one of angel!Dean or hunter!Cas at a time.

Unless you use <metadata>_LIST. The following works for me, but it assumes that freeformtags is sorted and that it's okay for the freeformtags entry in the title page to be out of order and possibly have duplicates of AU and reverse!verse. Calibre's Tags column and tag-like columns automatically order and remove duplicates.

Code:
 freeformtags_LIST=>(angel!Dean.*hunter!Cas)=>reverse!verse,AU,\1
(Note that using \, in _LIST substs is undefined. I'm not sure what it does exactly in that case.)

Quote:
Originally Posted by Loba View Post
Edit:
Also, there is a minorly inconvenient thing where whenever I make a fic series into an anthology it repeats the ship name and fandom name for each entry in the series. Like, an anthology with five parts of Harry/Draco fic would have the ship entry as Harry/Draco,Harry/Draco,Harry/Draco,Harry/Draco,Harry/Draco and I have to pop in manually and delete that and replace it with just Harry/Draco. I briefly entertained the idea that my ship column was the wrong type, but it doesn't seem to be that. I've only attempted anthologies pulled from ao3.
That suggests that your column is a text type, not a tag-like text type (see attached).

The anthology code concatenates most metadata items as strings (with ', ' between them) and counts on tag-like Calibre columns to automatically remove duplicates and alphabetize.
Attached Thumbnails
Click image for larger version

Name:	Capture.png
Views:	237
Size:	28.9 KB
ID:	151958  
JimmXinu is offline   Reply With Quote