'Call this from populate_article_metadata with the src attribute of an
<img> tag from the article that is appropriate for use as the thumbnail
representing the article in the Table of Contents. Whether the
thumbnail is actually used is device dependent (currently only used by
the Kindles). Note that the referenced image must be one that was
successfully downloaded, otherwise it will be ignored.'

def add_toc_thumbnail(self, article, src):

    if ((not src) or (not hasattr(article, 'toc_thumbnail'))):
        return
    src = src.replace('\\', '/')
    if (re.search('feed_\\d+/article_\\d+/images/img', src, flags=re.I) is None):
        self.log.warn(('Ignoring    invalid    TOC    thumbnail    image:    %r' % src))
        return
    article.toc_thumbnail = re.sub('^.*?feed', 'feed', src, flags=re.IGNORECASE)
