View Single Post
Old 11-15-2011, 04:40 PM   #1
MikeBlyth
Junior Member
MikeBlyth began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Nov 2011
Location: Jos, Nigeria
Device: Kindle
Can't get print_version to do anything

I'm brand new to Calibre and haven't used Python for years. I am following the tutorial for custom news feeds. I notice that BBC printable pages are now of the form ...something?print=true, so I have added to the basic recipe

Code:
def print_version(self, url):
    return url.append(u'?print=true')
But nothing seems to happen. In fact, no matter what print_version returns, even garbage, the recipe still runs just the same. Using ebook-convert for debugging, the URLs fetched are unchanged. If I put a divide by zero line in there, still no error, so it seems the function is not even being called. I must be doing something fundamentally wrong!

Full recipe:
Code:
class AdvancedUserRecipe1321386207(BasicNewsRecipe):
    title          = u'BBC'
    oldest_article = 3
    max_articles_per_feed = 2
    auto_cleanup = True
    no_stylesheets = True
    feeds          = [(u'BBC Front Page', u'http://newsrss.bbc.co.uk/rss/newsonline_world_edition/front_page/rss.xml')]

def print_version(self, url):
    return url.append(u'?print=true')
MikeBlyth is offline   Reply With Quote