Quote:
Originally Posted by kovidgoyal
Not sure what AI you were using but after getting the file name, this is literally 5 lines of code.
Code:
from calibre.ebooks.oeb.polish import get_container
from calibre.ebooks.oeb.polish.replace import remove_links_to
c = get_container(path, tweak_mode=True)
def predicate(name, href, fragment=None): return name == fname_to_remove
remove_links_to(c,
c.remove_item(name_to_remove)
c.commit(path_to_save_to)
|
@Kovid, if you're still reading this thread...
I've been using the calibre get_container function for many years and I'm slightly concerned by this tweak_mode=True parameter. I'm pretty sure I've never used it (at least not knowingly). Yet I have, over the years, written various plugins (User and Editor) which appeared to work OK.
What have I missed? Can you explain, in simple terms, when it should be used and when it's OK to leave it as default tweak_mode=False. Many thanks.