View Single Post
Old 06-16-2020, 04:14 PM   #2156
jhowell
Grand Sorcerer
jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.jhowell ought to be getting tired of karma fortunes by now.
 
jhowell's Avatar
 
Posts: 7,117
Karma: 92190133
Join Date: Nov 2011
Location: Charlottesville, VA
Device: Kindles
Quote:
Originally Posted by DNSB View Post
I suspect that this will block the automatic plugin update.
As far as I know the automatic plugin update is based on the information collected periodically by a separate program that also updates the Index of calibre plugins website. That gets its information from the "Version History:" spoiler in the first post of each plugin thread, which must be formatted exactly the right way. I suspect that the last update to the that post broke the formatting since it sees that latest version as "3.2.7 Released 17 May, 2020".

EDIT: It looks like it was changed from "Version History:" to "Version History".

Edit again: I was wrong it isn't the colon. It looks like the first plugin post is parsed looking for a specific sequence of HTML elements that should result if the proper BBCODE is used to format the Version History section.

Spoiler:
Code:
    def _read_version_history_html(self, forum_link):
        br = browser()
        br.set_handle_gzip(True)
        try:
            raw = br.open_novisit(forum_link).read()
            if not raw:
                return None
        except:
            traceback.print_exc()
            return None
        raw = raw.decode('utf-8', errors='replace')
        root = html.fromstring(raw)
        spoiler_nodes = root.xpath('//div[@class="smallfont" and strong="Spoiler"]')
        for spoiler_node in spoiler_nodes:
            try:
                if spoiler_node.getprevious() is None:
                    # This is a spoiler node that has been indented using[INDENT]
                    # Need to go up to parent div, then previous node to get header
                    heading_node = spoiler_node.getparent().getprevious()
                else:
                    # This is a spoiler node after a BR tag from the heading
                    heading_node = spoiler_node.getprevious().getprevious()
                if heading_node is None:
                    continue
                if heading_node.text_content().lower().find('version history') != -1:
                    div_node = spoiler_node.xpath('div')[0]
                    text = html.tostring(div_node, method='html', encoding='unicode')
                    return re.sub(r'<div\s.*?>', '<div>', text)
            except:
                if DEBUG:
                    prints('======= MobileRead Parse Error =======')
                    traceback.print_exc()
                    prints(html.tostring(spoiler_node))
        return None
Attached Thumbnails
Click image for larger version

Name:	KoboTouchExtended.jpg
Views:	232
Size:	69.2 KB
ID:	179934  

Last edited by jhowell; 06-16-2020 at 05:09 PM.
jhowell is online now   Reply With Quote