From 28c4557d22476c7080ad8f812389080bd00aaa1b Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Tue, 25 Oct 2016 19:37:27 -0500 Subject: [PATCH] Allow '_u#.xhtml' file names in updates. For Calibre Convert on Anthologies, then manually split. --- fanficfare/epubutils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fanficfare/epubutils.py b/fanficfare/epubutils.py index 2329dc4..5634cea 100644 --- a/fanficfare/epubutils.py +++ b/fanficfare/epubutils.py @@ -110,12 +110,14 @@ def get_update_data(inputio, if( item.getAttribute("media-type") == "application/xhtml+xml" ): href=relpath+item.getAttribute("href") #print("---- item href:%s path part: %s"%(href,get_path_part(href))) - if re.match(r'.*/log_page\.x?html',href): + if re.match(r'.*/log_page(_u\d+)?\.x?html',href): try: logfile = epub.read(href).decode("utf-8") except: pass # corner case I bumped into while testing. - if re.match(r'.*/(file|chapter)\d+\.x?html',href): + if re.match(r'.*/(file|chapter)\d+(_u\d+)?\.x?html',href): + # (_u\d+)? is from calibre convert naming files + # 3/OEBPS/file0005_u3.xhtml etc. if getsoups: soup = bs.BeautifulSoup(epub.read(href).decode("utf-8"),"html5lib") for img in soup.findAll('img'):