06-21-2010, 10:17 AM | #2176 |
Junior Member
Posts: 5
Karma: 12
Join Date: Jun 2010
Device: Kobo
|
|
06-21-2010, 12:04 PM | #2177 |
Zealot
Posts: 108
Karma: 6066
Join Date: Apr 2010
Location: Singapore
Device: iPad Air, Kindle DXG, Kindle Paperwhite
|
Recipe for People's Daily (in Chinese)
Last edited by rty; 06-22-2010 at 01:15 PM. |
Advert | |
|
06-21-2010, 12:11 PM | #2178 | |
Zealot
Posts: 108
Karma: 6066
Join Date: Apr 2010
Location: Singapore
Device: iPad Air, Kindle DXG, Kindle Paperwhite
|
Quote:
Help Starson ....please. Another multipage issue. I encountered another website that has multipage articles and the next page is linked via an image (button image) as follows: Code:
<a href="/GB/1027/11928295.html"> <img src="/img/next_b.gif" border="0"> </a> Here I was trying to find the image having src='/img/next_b.gif' and then grab the href for the URL but it doesn't seem to work. What did I do wrong? Help please? Spoiler:
Last edited by rty; 06-21-2010 at 12:21 PM. |
|
06-21-2010, 01:04 PM | #2179 |
Junior Member
Posts: 4
Karma: 10
Join Date: Jun 2010
Device: kobo
|
Rotating Images.
I have a custom recipe to download all my favorite comic strips. Similar to the xkcd.recipe.
The one thing I found annoying was the image in the epub were too wide and were getting cut off. So I rotated them. Now long 3 and 4 panel strips are landscape. here is the code snippet that I used to rotate the images. Hopefully others will find it useful. Code:
import calibre.utils.PythonMagickWand as pw Code:
def postprocess_html(self, soup, first): #process all the images. assumes that the new html has the correct path for tag in soup.findAll(lambda tag: tag.name.lower()=='img' and tag.has_key('src')): iurl = tag['src'] print 'resizing image' + iurl with pw.ImageMagick(): img = pw.NewMagickWand() p = pw.NewPixelWand() if img < 0: raise RuntimeError('Out of memory') if not pw.MagickReadImage(img, iurl): severity = pw.ExceptionType(0) msg = pw.MagickGetException(img, byref(severity)) raise IOError('Failed to read image from: %s: %s' %(iurl, msg)) width = pw.MagickGetImageWidth(img) height = pw.MagickGetImageHeight(img) if( width > height ) : print 'Rotate image' pw.MagickRotateImage(img, p, 90) if not pw.MagickWriteImage(img, iurl): raise RuntimeError('Failed to save image to %s'%iurl) pw.DestroyMagickWand(img) return soup |
06-21-2010, 02:28 PM | #2180 |
Connoisseur
Posts: 98
Karma: 22
Join Date: Mar 2010
Device: IRiver Story, Ipod Touch, Android SmartPhone
|
http://www.ilsole24ore.com/rss/primapagina.xml
Any ideas with this feed? The correct link is not under "guid", nor "link" or "links" tag. |
Advert | |
|
06-21-2010, 03:30 PM | #2181 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
06-21-2010, 09:50 PM | #2182 | |
Enthusiast
Posts: 49
Karma: 10
Join Date: Aug 2009
Device: none
|
Quote:
|
|
06-22-2010, 10:19 AM | #2183 |
Enthusiast
Posts: 49
Karma: 2062
Join Date: May 2010
Device: iPad (one)
|
A second request for subscriber content for the London Review of books, http://www.lrb.co.uk. Anyone?
|
06-22-2010, 02:22 PM | #2184 |
Connoisseur
Posts: 98
Karma: 22
Join Date: Mar 2010
Device: IRiver Story, Ipod Touch, Android SmartPhone
|
With this feed i have tried two ways, and every one has is pro and cons...
With get.article i can obtain the correct link, but i can't find the title of the article. With the parse_index ( index_to_soup) i can find the correct "title" but i don't get the link (in the soup there is a malformed "link" tag) an example of index to soup Spoiler:
So is there the possibility to use both solutions together? Or is there the possibility to extract the link near the malformet tag <link /> ??? p.s. probably the bug is related to the feed Spoiler:
Last edited by gambarini; 06-22-2010 at 02:36 PM. |
06-22-2010, 02:46 PM | #2185 |
Zealot
Posts: 108
Karma: 6066
Join Date: Apr 2010
Location: Singapore
Device: iPad Air, Kindle DXG, Kindle Paperwhite
|
Recipe for China Press USA (in Chinese)
Tested OK on B&N Nook. |
06-22-2010, 03:12 PM | #2186 | |
Connoisseur
Posts: 98
Karma: 22
Join Date: Mar 2010
Device: IRiver Story, Ipod Touch, Android SmartPhone
|
Quote:
So this is the code (beta version ) Spoiler:
|
|
06-23-2010, 12:12 PM | #2187 |
Zealot
Posts: 108
Karma: 6066
Join Date: Apr 2010
Location: Singapore
Device: iPad Air, Kindle DXG, Kindle Paperwhite
|
|
06-23-2010, 12:40 PM | #2188 | |
Guru
Posts: 800
Karma: 194644
Join Date: Dec 2007
Location: Argentina
Device: Kindle Voyage
|
Quote:
|
|
06-23-2010, 08:09 PM | #2189 |
Member
Posts: 12
Karma: 10
Join Date: May 2010
Device: Nook
|
Associated Press Broken
Anyone else notice that the AP recipe has been broken for some time now for the Nook?
It only shows the table of contents with the article summaries, but when you go to the specific article, all you get is a banner ad, a newspaper header and ad images but no article. In other articles you get some crazy coding like "#lightbox{position:absolute; top:40px; left:0 width:100%; z-index: 100; text-align:center; line height:0;} #lightbox{position:absolute; top:40px; left:0 width:100%; z-index: 100; text-align:center; line height:0;} #lightbox a img {border:none;} #outerImageContainer{ position: relative; background-color: #fff; width: 250px; height 250px; margin:0 auto;} #imageContainer{padding:10px;}" ...etc etc all this random code is what composes the articles. In other articles, you get actual text, but it is cut off, only showing half a page. Changing the font size does not matter and it still cuts off text mid sentence? Anyone know what's going on? All the other recipes that I use ever day are normal... |
06-23-2010, 08:41 PM | #2190 | ||
Member
Posts: 12
Karma: 10
Join Date: May 2010
Device: Nook
|
Quote:
Quote:
I tried the recipe out and it almost works. Unfortunately, the cartoon gets cut in half. Please see attached pic. Perhaps blending in rford's code above for rotating cartoons would work. I replaced his code with yours starting at def postprocess_html, but the recipe did not work at all (clearly it could not have been that easy, although I figured i'd try) Thanks again for your help and sorry once again for not fully searching the forum before asking for the request again. THANK YOUUUUU http://picturepush.com/public/3679162 Last edited by nook.life; 06-24-2010 at 01:21 PM. |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom column read ? | pchrist7 | Calibre | 2 | 10-04-2010 02:52 AM |
Archive for custom screensavers | sleeplessdave | Amazon Kindle | 1 | 07-07-2010 12:33 PM |
How to back up preferences and custom recipes? | greenapple | Calibre | 3 | 03-29-2010 05:08 AM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |