Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 04-01-2011, 06:35 AM   #1
markoz
Junior Member
markoz began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
Recipe for ng.pl

Hi all,

I'm complete newbie user of calibre and has zero experience with programming.
I was trying to make my first custom recipe for a print version of national-geographic.pl articles.

I compared urls both non print and print version, and for me seems that I need to replace 'artykuly/pokaz' with 'drukuj-artykul'.
Examples:
http://www.national-geographic.pl/ar...ojny-z-zaraza/
http://www.national-geographic.pl/dr...ojny-z-zaraza/

I created the part after "def print_version" according to instruction I found - but it does not work - fetching basic, non print version of an article.

Can anyone help me please?

class al(BasicNewsRecipe):
author = 'mk'
description = 'National Geographic'
title = u'National Geographic'
oldest_article = 7
max_articles_per_feed = 5


feeds = [(u'National Geographic', u'http://www.national-geographic.pl/rss/')]

def print_version(self, url):
return url.replace('artykuly/pokaz', 'drukuj-artykul')
markoz is offline   Reply With Quote
Old 04-06-2011, 03:46 AM   #2
bubak
Enthusiast
bubak began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Dec 2010
Device: kindle
I assume your recipe has the correct indentation, what you've written would not run in Python. The feed links have a '0C' instead of '/', so your function must be

Code:
def print_version(self, url):
    return url.replace('artykuly0Cpokaz', 'drukuj-artykul')
bubak is offline   Reply With Quote
Advert
Old 04-08-2011, 02:56 AM   #3
markoz
Junior Member
markoz began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by bubak View Post
I assume your recipe has the correct indentation, what you've written would not run in Python. The feed links have a '0C' instead of '/', so your function must be

Code:
def print_version(self, url):
    return url.replace('artykuly0Cpokaz', 'drukuj-artykul')
Hi, thanks that's working!

Marcin
markoz is offline   Reply With Quote
Old 04-12-2011, 07:56 AM   #4
markoz
Junior Member
markoz began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by markoz View Post
Hi, thanks that's working!

Marcin
Where can I find table for replacing '_' with '0C' etc.?
markoz is offline   Reply With Quote
Old 04-13-2011, 05:03 PM   #5
bubak
Enthusiast
bubak began at the beginning.
 
Posts: 45
Karma: 10
Join Date: Dec 2010
Device: kindle
If you mean the encoding in this source, this is not the standard char to hex conversion, that would be 0x2f for '/', so you have to look e.g. in the trace output of ebook-convert to see what urls are involved.
bubak is offline   Reply With Quote
Advert
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recipe works when mocked up as Python file, fails when converted to Recipe ode Recipes 7 09-04-2011 04:57 AM
new recipe marbs Recipes 0 11-24-2010 04:59 AM
I need some help with a recipe jefferson_frantz Recipes 14 11-22-2010 02:06 PM
New recipe kiklop74 Recipes 0 10-05-2010 04:41 PM
New recipe kiklop74 Recipes 0 10-01-2010 02:42 PM


All times are GMT -4. The time now is 06:44 AM.


MobileRead.com is a privately owned, operated and funded community.