View Single Post
Old 07-25-2023, 01:11 AM   #8722
culytera
Zealot
culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.culytera ought to be getting tired of karma fortunes by now.
 
Posts: 132
Karma: 295674
Join Date: Jul 2021
Device: iPhone
Quote:
Originally Posted by JimmXinu View Post
FYI, I personally consider trying to normalize AO3 tags a lost cause. I'll help with individual issues that can be articulated and tested, but I'm not interested in it in general.

In this case, you can't use use category_LIST in conditionals for category, that would recurse.
Yeah I'm just gonna trust (and hope) that the author properly tags the fic in the right order. I normally don't read fics that have overly complicated tags anyway.

Quote:
Originally Posted by ownedbycats View Post
I don't think you can use a category conditional on a category replace though. I'm not sure why, perhaps to prevent accidental recursive loops.
Right I forgot about that, I think I tried to do something similar before but couldn't figure it out either back then. This was just to reduce redundancy in the title page. At least my tag browser will look cleaner now thanks to _LIST being allowed in subject tags.

Now I'll just do:
- Find "Inquisition/II/Origins" & "Andromeda/Trilogy" among Dragon Age & Mass Effect category entries
- If found, ignore "Dragon Age" & "Mass Effect" as the main category and get the first accepted entry as the main category
- If not found, use "Dragon Age" & "Mass Effect" as the main category for the tag browser

Seemed to work well!
Relevant code:
Spoiler:
Code:
replace_metadata:
 category=> (- All Media Types|- Fandom|\(Movies\)|\(Movie [0-9]+\)|\(Comics\)|\(TV\)|\(Video Games?\))$=>
 prefix_category=>^(.*?)$=>[c] \1
## Accept only Dragon Age: Inquisition/Dragon Age II/Dragon Age: Origins for prefix_category if Dragon Age is also one of the categories
 prefix_category_LIST=>(\[c\] Dragon Age\,\s?)\[c\] Dragon Age(:? (Inquisition|II|Origins))=>[c] Dragon Age\2
 prefix_category_LIST=>(\[c\] Mass Effect\,\s?)\[c\] Mass Effect(:? (Trilogy|Andromeda))=>[c] Mass Effect\2
## Get the first category entry for tag browser
 prefix_category_LIST=>^(\[c\].*?)(\,.*)=>\1

## first ship, first category, rating, status with the added prefixes in Calibre's tags
include_subject_tags:prefix_ships_LIST,prefix_category_LIST,prefix_rating,prefix_status,prefix_wordcount
culytera is offline   Reply With Quote