![]() |
#1 |
Member
![]() 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 |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,221
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.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Member
![]() 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! |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,221
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Search github calibre
|
![]() |
![]() |
![]() |
#5 |
Member
![]() Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
|
Thank you for the info !
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Member
![]() 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! |
![]() |
![]() |
![]() |
#7 |
Enthusiast
![]() 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.
|
![]() |
![]() |
![]() |
#8 |
Member
![]() 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.
|
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,221
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.
|
![]() |
![]() |
![]() |
#10 |
Member
![]() Posts: 18
Karma: 10
Join Date: Jan 2012
Device: Nook
|
Do you have an existing recipe doing this ?
|
![]() |
![]() |
![]() |
#11 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,090
Karma: 6058305
Join Date: Sep 2010
Location: UK
Device: Kindle Paperwhite
|
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 |
![]() |
![]() |
![]() |
#12 |
Member
![]() 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! |
![]() |
![]() |
![]() |
#13 |
Member
![]() 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! |
![]() |
![]() |
![]() |
#14 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,221
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
|
![]() |
![]() |
![]() |
|
![]() |
||||
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 |