Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 12-01-2010, 12:29 PM   #1
weebl
Junior Member
weebl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2010
Device: none
How to replace a masthead

I am working on a recipe for the Poughkeepsie Journal and I would like to replace a masthead. I am a new at this and the method I tried is not working.

I've tried the following:

Code:
class AdvancedUserRecipe1291143841(BasicNewsRecipe):
    title          = u'Poughkeepsipe Journal'
    oldest_article = 7
    max_articles_per_feed = 100
    no_stylesheets = True
    timefmt = ' [%a, %d %b, %Y]'
    feeds          = [(u'Local News', u'http://poughkeepsiejournal.com/apps/pbcs.dll/oversikt?Category=RSS01&mime=xml'), (u'Local Business', u'http://poughkeepsiejournal.com/apps/pbcs.dll/oversikt?Category=RSS02&mime=xml'), (u'Local Sports', u'http://poughkeepsiejournal.com/apps/pbcs.dll/oversikt?Category=RSS03&mime=xml'), (u'Life', u'http://poughkeepsiejournal.com/apps/pbcs.dll/oversikt?Category=RSS04&mime=xml')]
    def print_version(self, url):
          return url.replace('http://www.poughkeepsiejournal.com', 'http://www.poughkeepsiejournal.com/print')
          return url.replace('http://www.poughkeepsiejournal.com/graphics/mastlogo.gif','http://www.poughkeepsiejournal.com/graphics/branding.gif')
The portion that is not working is replacing the mastlogo.gif with the branding.gif.

Thanks for any help

Last edited by weebl; 12-01-2010 at 12:44 PM.
weebl is offline   Reply With Quote
Old 12-01-2010, 01:44 PM   #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 weebl View Post
I am working on a recipe for the Poughkeepsie Journal and I would like to replace a masthead. I am a new at this and the method I tried is not working.
This is a recipe question and really ought to be in the recipe subforum, but ....

Quote:
I've tried the following:
Code:
    def print_version(self, url):
          return url.replace('http://www.poughkeepsiejournal.com', 'http://www.poughkeepsiejournal.com/print')
          return url.replace('http://www.poughkeepsiejournal.com/graphics/mastlogo.gif','http://www.poughkeepsiejournal.com/graphics/branding.gif')
The portion that is not working is replacing the mastlogo.gif with the branding.gif.

Thanks for any help
You can't have two returns above. Delete the one that reads:
Code:
          return url.replace('http://www.poughkeepsiejournal.com/graphics/mastlogo.gif','http://www.poughkeepsiejournal.com/graphics/branding.gif')
Add your masthead to the main code (outside print_version) as follows:
Code:
    masthead_url          = 'http://www.poughkeepsiejournal.com/graphics/branding.gif'

Last edited by Starson17; 12-01-2010 at 01:49 PM.
Starson17 is offline   Reply With Quote
Advert
Old 12-01-2010, 02:24 PM   #3
weebl
Junior Member
weebl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by Starson17 View Post
This is a recipe question and really ought to be in the recipe subforum, but ....



You can't have two returns above. Delete the one that reads:
Code:
          return url.replace('http://www.poughkeepsiejournal.com/graphics/mastlogo.gif','http://www.poughkeepsiejournal.com/graphics/branding.gif')
Add your masthead to the main code (outside print_version) as follows:
Code:
    masthead_url          = 'http://www.poughkeepsiejournal.com/graphics/branding.gif'
Thanks, I posted in this forum because I thought it may be Calibre recipe specific. I really need to eliminate the masthead provided by the webpage, "mastlogo.gif" as it does not have the background set and displays poorly with a white background. So I thought I would replace it with the "branding.gif". Is there a better method to do so?
weebl is offline   Reply With Quote
Old 12-01-2010, 02:56 PM   #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 weebl View Post
Thanks, I posted in this forum because I thought it may be Calibre recipe specific. I really need to eliminate the masthead provided by the webpage, "mastlogo.gif" as it does not have the background set and displays poorly with a white background. So I thought I would replace it with the "branding.gif". Is there a better method to do so?
This is the Calibre main forum, so your question, which is Calibre recipe specific should be in the Calibre recipe subforum.

Yes, there's a better method - just eliminate the image you don't want with remove_tags. See here.
Starson17 is offline   Reply With Quote
Old 12-01-2010, 08:55 PM   #5
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by weebl View Post
Thanks, I posted in this forum because I thought it may be Calibre recipe specific.
It is Calibre Recipe specific that is why you were asked to post this in the Calibre Recipes sub-forum listed at the top of the main calibre forum.

I'm glad you got the help you were looking for.
DoctorOhh is offline   Reply With Quote
Advert
Old 12-01-2010, 10:14 PM   #6
weebl
Junior Member
weebl began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Dec 2010
Device: none
Quote:
Originally Posted by dwanthny View Post
It is Calibre Recipe specific that is why you were asked to post this in the Calibre Recipes sub-forum listed at the top of the main calibre forum.

I'm glad you got the help you were looking for.
My mistake, sorry, I did my best at moving it over to the other forum.
weebl is offline   Reply With Quote
Old 12-02-2010, 09:01 AM   #7
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 weebl View Post
My mistake, sorry, I did my best at moving it over to the other forum.
It's OK. We were all beginners once, and there's no need to apologize. It's not immediately obvious how this place is organized, or what questions should go where. We always put a post in a thread that is misfiled, not because anyone wants to reprimand you, but because many others will see that post before they make a new post in the wrong place. It just helps to keep things organized and speeds up getting help when questions are posted in the right area.
Starson17 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Masthead image missing since 0.7.30 siebert Calibre 1 11-27-2010 01:40 PM
New Recipe features supporting Kindle masthead images GRiker Calibre 6 08-27-2010 04:08 PM
What will you replace your Kindle with. pilotbob Which one should I buy? 33 03-16-2009 11:26 AM
Replace battery ?? singring Fictionwise eBookwise 1 02-11-2008 01:45 PM
Replace Handstory elveejay Lounge 3 06-04-2005 10:10 PM


All times are GMT -4. The time now is 05:16 PM.


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