View Single Post
Old 07-22-2011, 07:24 PM   #12
tylau0
Connoisseur
tylau0 began at the beginning.
 
Posts: 82
Karma: 10
Join Date: Oct 2010
Device: Kindle
v1.0.3 (available at the top post) removes sections without any article. That should fix the issue you raised.

Quote:
Originally Posted by oneillpt View Post
Thanks. Even modified to use kindlegen with -c2 the asw files were still coming out about 25% larger than the corresponding mobi version. I'll try this version next.

I still find that the "The selected item could not be opened. If you purchased ..." message box can occur, although now in a way which does not prevent use of the ebook. It occurs with an extended version of one of the recipes I used earlier to test:
Spoiler:
Code:
class AdvancedUserRecipe1311083909(BasicNewsRecipe):
    title          = u'DiarioAltoAragon'
    oldest_article = 7
    max_articles_per_feed = 101
    keep_only_tags = [dict(name='div', attrs={'id':'bloguenoticia'})]

    feeds          = [(u'Portada', u'http://www.diariodelaltoaragon.es/rss.aspx'),
(u'Es Noticia', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=14'),
(u'Huesca', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=1'),
(u'Aragón', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=8'),
(u'España', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=5'),
(u'Mundo', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=9'),
(u'Cultura', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=10'),
(u'Última', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=13'),
(u'Opinión', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=4'),
(u'Sociedad', u'http://www.diariodelaltoaragon.es/rss.aspx?Id=11')]
    
    keep_only_tags = [dict(name='div', attrs={'id':'bloquenoticia'})]
    remove_tags = [
       dict(name='div', attrs={'id':['imagen_sin_bordes', 'ctl00ContentPlaceHolder1_pnPopUp', 
          'ctl00ContentPlaceHolder1_divGoogle', 'ctl00_ContentPlaceHolder1_UpdatePanelVotos']}),
       dict(name='iframe'),
       dict(name='a', attrs={'id':['click']}),
       dict(name='a', attrs={'class':['twitter-share-button']})
    ]

In this case only the first feed shows any articles (38 at the moment), but the Kindle table of contents includes all the remaining feeds, showing zero articles for each, and the ebook text shows the name of each feed followed by the single line "RSS de diariodelaltoaragon.es" (this seems to be correct as browsing the rss feeds in a web browser gets this single line for these feeds too). Moving down the left (sections) column of the Kindle toc past that first feed to the second which shows zero articles gives the message box, forcing closure of the ebook. The same thing happens when on the last (Calibre Table of Contents) page when attempting to open the Kindle table of contents, requiring paging back or skipping to previous article before the Kindle table of contents can be accessed.

In this case I found this problem by accident - all sections in the Kindle table of contents were visible on screen at the same time, so there was no need to scroll down the sections. In another case, the list of sections required a second page to display, and while scrolling down through a series of sections with zero articles the right hand (articles) column displayed the first articles for the next section with articles, and no message box occurred.
tylau0 is offline   Reply With Quote