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 12-04-2013, 08:39 PM   #1
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Custom Cover

I know that I can have the following to select a custom cover:
def get_cover_url(self):
return '.../custom_cove.png'
What do I do to include the "date" as part of the custom cover?

Thanks
cnfmsu is offline   Reply With Quote
Old 12-04-2013, 10:13 PM   #2
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,222
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
If you want to generate your own cover with arbitrary text on it, then you have to use some imaging library to do it, for an example, see the calibre_cover() function in the calibre source code.
kovidgoyal is offline   Reply With Quote
Advert
Old 12-05-2013, 04:00 PM   #3
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Where can I find the source,
Would you able to provide a link to the source?

Thanks!
cnfmsu is offline   Reply With Quote
Old 12-05-2013, 10:49 PM   #4
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,222
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Search github calibre
kovidgoyal is offline   Reply With Quote
Old 12-10-2013, 10:53 AM   #5
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Thank you for the info !
cnfmsu is offline   Reply With Quote
Advert
Old 12-10-2013, 09:54 PM   #6
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Hi Kovid,

I have 1 more question on links within the ARTICLE. For external links (external to the website), it works fine as they are the full URL address. However, for internal links (internal to the website), they don't not have the prefix for the website. Mostly they starts with "/".

I guess I need something like for the whole article:
if url.startswith('/'): url = 'http://www.sitename.com'+url

Please tell me how to handle this?
Do you have any example of such recipe?

Thanks!
cnfmsu is offline   Reply With Quote
Old 12-12-2013, 03:33 PM   #7
joeindallas
Enthusiast
joeindallas began at the beginning.
 
Posts: 30
Karma: 10
Join Date: Jan 2011
Device: Kindle 3
If you are just using this custom recipe personally and using Calibre on one machine to run recipes and deliver to you personally you can just point to a local image file instead of hosting it on a server. I have a horribly coded recipe for grabbing basketball and local Dallas sports that I can share with you. I would be way too embarrassed to post it here with all of these professionals (who do it out of the goodness of their hearts) but I can send it via pm if you're interested.
joeindallas is offline   Reply With Quote
Old 12-12-2013, 09:18 PM   #8
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Most of the links are not image. They are referring to other articel in same website. It is hard to have them loaded locally.
cnfmsu is offline   Reply With Quote
Old 12-12-2013, 09:27 PM   #9
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,222
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Implement preprocess_html in your recipe, loop through all links, check if they start with / and prefix them with the hostname part.
kovidgoyal is offline   Reply With Quote
Old 12-12-2013, 09:38 PM   #10
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Do you have an existing recipe doing this ?
cnfmsu is offline   Reply With Quote
Old 12-17-2013, 05:41 AM   #11
avantman42
Wizard
avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.avantman42 ought to be getting tired of karma fortunes by now.
 
avantman42's Avatar
 
Posts: 1,090
Karma: 6058305
Join Date: Sep 2010
Location: UK
Device: Kindle Paperwhite
Quote:
Originally Posted by cnfmsu View Post
Do you have an existing recipe doing this ?
I'm working on a recipe at the moment that needs to do this. Here's what I've got:

Code:
# pre-process HTML: Some links are relative. Change them to absolute
def preprocess_html(self, soup):
	for link in soup.findAll('a'):
		if link['href'].startswith('http') == False:
			# Link is relative. Make it absolute
			link['href'] = 'http://www.example.com/' + link['href']
	
	return soup
You'll need to change http://www.example.com/ to whatever URL your site uses.
avantman42 is offline   Reply With Quote
Old 12-17-2013, 08:27 PM   #12
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
avantman42,

I have it working by adding "href=True" to the soup.findAll as the 2nd parm on the above code.

Thank you!
cnfmsu is offline   Reply With Quote
Old 12-29-2013, 10:58 PM   #13
cnfmsu
Member
cnfmsu began at the beginning.
 
Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
Hi Kovid,

I have another issue with the standard cover page. The title on the cover page is showing ??????.
This is what I have on the recipes:
title = u'\u533b\u5b66\u8877\u4e2d\u53c2\u897f\u5f55'
The book name is displayed correctly under "calibre libary".

I think it is to do with the last character. It works fine with:
title = u'\u533b\u5b66\u8877\u4e2d\u53c2\u897f'

Would you please take a look at this.

Thanks and have a happy new year!
cnfmsu is offline   Reply With Quote
Old 12-30-2013, 11:00 PM   #14
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,222
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You need to have a font capable of rendering those characters and specify it via Preferences->Tweaks->specify which font to use when generating a default cover or masthead
kovidgoyal is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom book cover cnfmsu Recipes 1 09-07-2012 11:18 PM
PRS-300 Pictures: Pink 300 + Sony red cover + custom cover h0bbes Sony Reader 5 01-04-2010 12:41 PM
Making a custom cover nobylspoon Sony Reader 0 09-01-2009 09:37 AM
What I want for a custom leather cover ZenEngineer Sony Reader 4 05-01-2009 02:27 AM
Suggestions for Custom Cover tarifelagund Sony Reader 3 01-16-2009 06:27 PM


All times are GMT -4. The time now is 06:11 PM.


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