View Single Post
Old 02-17-2023, 04:20 PM   #8075
Amalthia
Wizard
Amalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beautyAmalthia does all things with Zen-like beauty
 
Amalthia's Avatar
 
Posts: 1,188
Karma: 32196
Join Date: Jan 2007
Location: Anchorage, AK
Device: Sony Reader PRS-505, PRS-650, PRS-T3, Pocketbook HD2
replace_metadata regex prevent infinite recursion

Hello,

I have a question about my "replace_metadata:" settings.

Code:
 
 fandoms=>.*陈情令 \|\ The Untamed.*=>陈情令 | The Untamed
 fandoms=>.*魔道祖师 \|\ Módào Zǔshī.*=>魔道祖师 | Módào Zǔshī
 fandoms=>.*魔道祖师 - 墨香铜臭 \|\ Módào Zǔshī - Mòxiāng Tóngxiù.*=>魔道祖师 - 墨香铜臭 | Módào Zǔshī - Mòxiāng Tóngxiù
 fandoms=>.*(陈情令 \|\ The Untamed|魔道祖师 - 墨香铜臭 \|\ Módào Zǔshī - Mòxiāng Tóngxiù|魔道祖师 \|\ Módào Zǔshī).*=>\1\,陈情令 | The Untamed
This code works in that it adds the tag "陈情令 | The Untamed" to all the Untamed fics from AO3, even if they don't have "The Untamed" in the fandom tag.

I still want to keep "Módào Zǔshī" tags because they can tell me if the primary source for the fan fiction is from the novel or comic. However, I'm adding "The Untamed" tag so I can locate all fics from this fandom with one tag.

The concern I have with my method is when I ran Calibre in Debug mode I got this error line:

Code:
FFF: INFO: 2023-02-17 11:50:25,615: story.py(883): Skipping replace_metadata line 'fandoms=>(陈情令 \|\ The Untamed|魔道祖师 - 墨香铜臭 \|\ Módào Zǔshī - Mòxiāng Tóngxiù|魔道祖师 \|\ Módào Zǔshī)=>\1\,陈情令 | The Untamed' on fandoms to prevent infinite recursion.
Is there a better way to run my replace_metadata: without potentially causing an infinite recursion, or needing 4 lines of code?

Thanks,
Amalthia
Amalthia is offline   Reply With Quote