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 01-25-2012, 07:23 AM   #1
cptnemo
Enthusiast
cptnemo began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Oct 2011
Device: Kindle 3
How add a simple cover to a custom news source?

Hello,

Sorry but I have tried hard following different indications in the forum to add to my custom recipes a simple cover image, different from the one produced by Calibre.

Could anyone provide me with an easy to copy and paste solutions to add a cover?

I tried to add this in the "Advanced Mode" box:

def get_cover_url(self):
cover_url = "actual url"
return cover_url

but Calibre gives me an error message.

Should I add something else?

Thanks!
cptnemo is offline   Reply With Quote
Old 01-25-2012, 02:04 PM   #2
tylau0
Connoisseur
tylau0 began at the beginning.
 
Posts: 82
Karma: 10
Join Date: Oct 2010
Device: Kindle
I don't see why your code snipplet doesn't work. But did not properly indent your code as follows?
Code:
class YourRecipe(BasicNewsRecipe):
    ...
    def get_cover_url(self):
        cover_url = "actual url"
        return cover_url
    ....
Also, it could be useful to figure out the error message by running the ebook-convert command-line program installed with Calibre. Details are here.
tylau0 is offline   Reply With Quote
Advert
Old 01-26-2012, 12:01 AM   #3
cptnemo
Enthusiast
cptnemo began at the beginning.
 
Posts: 35
Karma: 10
Join Date: Oct 2011
Device: Kindle 3
Thanks tylau0!

Now it is working...
cptnemo is offline   Reply With Quote
Old 09-12-2021, 08:55 PM   #4
Hodgy
Member
Hodgy began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Apr 2021
Device: KT2 7th gen
What would I type for "actual url" if I want to use a local image file? I know I need to use the whole path, but what goes before this? Thanks.
Hodgy is offline   Reply With Quote
Old 09-12-2021, 09:13 PM   #5
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,021
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Hodgy View Post
What would I type for "actual url" if I want to use a local image file? I know I need to use the whole path, but what goes before this? Thanks.
file:// <path>

see:
https://en.wikipedia.org/wiki/Unifor...rce_Identifier
theducks is offline   Reply With Quote
Advert
Old 09-13-2021, 02:54 AM   #6
Hodgy
Member
Hodgy began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Apr 2021
Device: KT2 7th gen
I'm still failing to get news recipe to download a cover. I have looked at similar problems on this forum and have tried:

1. adding the above code with the suggested line formatting:
def get_cover_url(self):
cover_url = "file///link/to/picture.png"
return cover_url

2. I inserted this line into the recipe in the 'class' section:
cover_url = 'file:///home/ian/Downloads/aljazeera.png'

In the job log I just see this entry at the bottom:
The cover image has an id != "cover". Renaming to work around bug in Nook Color

Does anyone have any helpful pointers? Thanks.
Hodgy is offline   Reply With Quote
Old 09-13-2021, 03:33 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,318
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You want

Code:
    def get_cover_url(self):
         return 'file:///home/ian/whatever.jpg'
You are missing the colon
kovidgoyal is offline   Reply With Quote
Old 09-13-2021, 03:44 AM   #8
unkn0wn
Guru
unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.unkn0wn understands the Henderson-Hasselbalch Equation.
 
Posts: 615
Karma: 85520
Join Date: May 2021
Device: kindle
Quote:
Originally Posted by Hodgy View Post
I'm still failing to get news recipe to download a cover. I have looked at similar problems on this forum and have tried:

1. adding the above code with the suggested line formatting:
def get_cover_url(self):
cover_url = "file///link/to/picture.png"
return cover_url

2. I inserted this line into the recipe in the 'class' section:
cover_url = 'file:///home/ian/Downloads/aljazeera.png'

In the job log I just see this entry at the bottom:
The cover image has an id != "cover". Renaming to work around bug in Nook Color

Does anyone have any helpful pointers? Thanks.
Why all this when you can just edit metadata and add the cover image after the file is created. As you are already pointing it to a file on your disk.
unkn0wn is offline   Reply With Quote
Old 09-13-2021, 11:41 AM   #9
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 31,021
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by unkn0wn View Post
Why all this when you can just edit metadata and add the cover image after the file is created. As you are already pointing it to a file on your disk.
recipes are commonly used with automated delivery.
There is no post fetch EDIT
theducks is offline   Reply With Quote
Old 10-21-2022, 11:49 AM   #10
GuillermoKindle
Junior Member
GuillermoKindle began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Oct 2022
Device: kindle paperwhite
Add a date stamp to a custom RSS recipe cover

@kovidgoyal Thanks ! I've finally added a custom cover, can I stamp a date in my custom covers just as Calibre does when it generates a default cover?
GuillermoKindle is offline   Reply With Quote
Old 10-21-2022, 10:51 PM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,318
Karma: 27111242
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You need to generate the cover programitcally in that case, how you do it depends on what exactly you want to do. your best bet would be to use a tool like imagemagick to do it. If you want to do it using calibre then look at the various functions at the bottom of the ebooks/covers.py file in the calibre source code.
kovidgoyal is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No "Add a custom news source" jmkizer Recipes 1 11-23-2011 05:48 PM
Using print_version for custom news source sexymax15 Recipes 0 06-15-2011 10:53 AM
Custom News Source scrumhalf Recipes 5 11-26-2010 11:30 AM
Custom news source - for forums RichD Calibre 0 01-12-2010 11:05 AM
Custom news source JayCeeEll Calibre 2 11-14-2009 04:01 AM


All times are GMT -4. The time now is 08:59 AM.


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