View Single Post
Old 09-16-2011, 03:31 AM   #1
fenuks
Enthusiast
fenuks began at the beginning.
 
Posts: 34
Karma: 10
Join Date: Aug 2011
Device: Amazon Kindle 3
How to force calibre to download images?

Hello. I made recipe for page which uses flash player to display images (cgm.pl). In preprocess_html function I extract image ID from flash tag and replace it with image tag. Problem is that that images aren't downloaded. I meant they aren't downloaded to file. When I open it calibre ebook viewer download all photos to memory. How to force calibre to download those images to file? Thanks for help!

preprocess_html function
Spoiler:
Code:
def preprocess_html(self, soup):
        gallery=soup.find('div', attrs={'class':'galleryFlash'})
        if gallery:
            img=gallery.find('embed')
            if img:
                img=img['src'][35:]
                gallery.replaceWith('<img src="http://www.cgm.pl/_vault/_gallery/_photo/'+img+'" />')
            
        return soup


flash tag
Spoiler:
Code:
<div class="galleryFlash">
                                        <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="689" height="442" id="single_photo" align="middle">
                                            <param name="allowScriptAccess" value="sameDomain">
                                            <param name="movie" value="_flash/single_photo.swf?photo_file=21578.jpg">

                                            <param name="quality" value="high">
                                            <param name="bgcolor" value="#000000">
                                            <embed src="_flash/single_photo.swf?photo_file=21578.jpg" quality="high" bgcolor="#000000" width="689" height="442" name="single_photo" align="middle" allowscriptaccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">
                                        </object>
                                    </div>
fenuks is offline   Reply With Quote