Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-14-2011, 10:59 PM   #1
ricardoff
Junior Member
ricardoff began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle 3
Request: International Viewpoint

http://www.internationalviewpoint.or...p?page=backend

I just can't make it work. I tried to make it get the print versions but couldn't. I'm a newbie.

Any help is welcome!
ricardoff is offline   Reply With Quote
Old 08-15-2011, 09:04 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ricardoff View Post
http://www.internationalviewpoint.or...p?page=backend

I just can't make it work. I tried to make it get the print versions but couldn't. I'm a newbie.

Any help is welcome!
Post what you've tried and how it failed if you want specific help on specific issues.
Starson17 is offline   Reply With Quote
Advert
Old 08-15-2011, 06:15 PM   #3
ricardoff
Junior Member
ricardoff began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle 3
This is what I tried to do:

RSS: http://www.internationalviewpoint.or...p?page=backend

Article: http://www.internationalviewpoint.or...hp?article2242

Print version: http://www.internationalviewpoint.or...d_article=2242

Code I used:
Code:
class AdvancedUserRecipe1313445974(BasicNewsRecipe):
    title          = u'International Viewpoint'
    oldest_article = 90
    max_articles_per_feed = 100

    feeds          = [(u'Articles', u'http://www.internationalviewpoint.org/spip.php?page=backend')]

def print_version(self, url):
      return url.replace('http://www.internationalviewpoint.org/spip.php?article', 'http://www.internationalviewpoint.org/spip.php?page=print_article&id_article=')
Why isn't it working? It gets the articles, but then it'll show links etc. and not the entire article.

Last edited by Starson17; 08-17-2011 at 09:37 AM. Reason: add code tags
ricardoff is offline   Reply With Quote
Old 08-17-2011, 09:36 AM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ricardoff View Post
This is what I tried to do:

RSS: http://www.internationalviewpoint.or...p?page=backend

Article: http://www.internationalviewpoint.or...hp?article2242

Print version: http://www.internationalviewpoint.or...d_article=2242

Code I used:

Why isn't it working? It gets the articles, but then it'll show links etc. and not the entire article.
If you post your code inside CODE tags (the hash/pound sign button) we can see your code and all indents. Inside QUOTE tags causes MR to strip the indents. As a moderator, I can edit your post to see the original indents, and I can see that you haven't indented
def print_version(self, url):
So that code is outside the
class AdvancedUserRecipe1313445974(BasicNewsRecipe):
and is never run.
Indent it the same amount as
title = u'International Viewpoint'
and indent everything below it the same additional amount.
Starson17 is offline   Reply With Quote
Old 08-17-2011, 12:28 PM   #5
ricardoff
Junior Member
ricardoff began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle 3
Thank you very much! I don't know what indent means but I'll look it up!
ricardoff is offline   Reply With Quote
Advert
Old 08-17-2011, 01:41 PM   #6
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ricardoff View Post
Thank you very much! I don't know what indent means but I'll look it up!
It means to put spaces in front of the lines of text and move them to the right, like this:
Code:
class AdvancedUserRecipe1313445974(BasicNewsRecipe):
    title          = u'International Viewpoint'
    oldest_article = 90
    max_articles_per_feed = 100

    feeds          = [(u'Articles', u'http://www.internationalviewpoint.org/spip.php?page=backend')]

    def print_version(self, url):
        return url.replace('http://www.internationalviewpoint.org/spip.php?article', 'http://www.internationalviewpoint.org/spip.php?page=print_article&id_article=')
Starson17 is offline   Reply With Quote
Old 08-17-2011, 01:44 PM   #7
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,155
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
Unlike many programming tools that use BEGIN / END or { } to group together sections of code, Python uses spaces or indentation to make the same sections of code.

So for instance C might do
Code:
printf("before if\n");
if ( a == 0) {
  printf("a is zero\n");
} else {
  printf("a is non zero\n");
}
printf("end of if\n");
Python would do
Code:
print "before if"
if a == 0:
  print "a is zero"
else:
  print "a is not zero"
print "after if"
PeterT is offline   Reply With Quote
Old 08-17-2011, 02:14 PM   #8
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by PeterT View Post
Unlike many programming tools that use BEGIN / END or { } to group together sections of code, Python uses spaces or indentation to make the same sections of code.
And to explain further: In the case of a recipe, the print_version code has to be part of the AvancedUserRecipe group of code ("class"). The originally posted recipe had def print version at the same level of indent as AvancedUserRecipe, so it wasn't part of the recipe class and wasn't being processed. It was being ignored.
Starson17 is offline   Reply With Quote
Old 08-19-2011, 04:16 PM   #9
ricardoff
Junior Member
ricardoff began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Aug 2011
Device: Kindle 3
Well, just for the record, it's working like a charm now! Maybe some improvements are possible, but it suits me. Thank you all!

Code:
class AdvancedUserRecipe1313445974(BasicNewsRecipe):
    title          = u'International Viewpoint 4'
    oldest_article = 90
    max_articles_per_feed = 100
    
    feeds          = [(u'Articles', u'http://www.internationalviewpoint.org/spip.php?page=backend')]

    def print_version(self, url):
          return url.replace('http://www.internationalviewpoint.org/spip.php?article', 'http://www.internationalviewpoint.org/spip.php?page=print_article&id_article=')
ricardoff is offline   Reply With Quote
Old 08-19-2011, 04:44 PM   #10
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by ricardoff View Post
Well, just for the record, it's working like a charm now!
Great! And thanks for posting in CODE tags.
Starson17 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Questions about mixed viewpoint stories Steven Lake Writers' Corner 10 10-19-2010 11:24 PM
Is my K2 International? Aeroraptor Amazon Kindle 13 12-13-2009 03:49 PM
Science Fiction Garrett, Randall: Viewpoint. V1. 8 Jan 2008 Xenophon BBeB/LRF Books (offline) 0 01-08-2008 05:10 PM
Sony taking DRM too far from a programmer's viewpoint Colin Dunstan News 9 11-10-2005 04:50 AM


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


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