Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-25-2010, 09:31 PM   #1
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
CustomIndexRecipe

Are there any examples using the CustomIndexRecipe class?

I have heaps of web content that I've downloaded using the Firefox Scrapbook plug-in and I want to use Calibre's ebook-convert command line tool to mass-edit them but can't quite figure out how to use CustomIndexRecipe.custom_index()

There don't seem to be any examples of this anywhere?

Thanks
EnergyLens is offline   Reply With Quote
Old 03-25-2010, 10:19 PM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by EnergyLens View Post
Are there any examples using the CustomIndexRecipe class?

I have heaps of web content that I've downloaded using the Firefox Scrapbook plug-in and I want to use Calibre's ebook-convert command line tool to mass-edit them but can't quite figure out how to use CustomIndexRecipe.custom_index()

There don't seem to be any examples of this anywhere?

Thanks
I assume you've read this:
Quote:
CustomIndexRecipe¶
class calibre.web.feeds.news.CustomIndexRecipe¶
This class is useful for getting content from websites that don’t follow the “multiple articles in several feeds” content model.

CustomIndexRecipe.custom_index()¶
Return the filesystem path to a custom HTML document that will serve as the index for this recipe. The index document will typically contain many <a href=”...”> tags that point to resources on the internet that should be downloaded.
I've also noticed the dearth of examples. No built-in recipes use it. What have you tried? It looks fairly straight forward. Just guessing, but I'd try using the CustomIndexRecipe in your class and then:
Code:
def custom_index(self):
    filepath = path_to_custom_index.html
    return filepath
I have my doubts that this is going to be very successful, but I suppose it depends on what's in your index. Maybe Kovid will comment. Let us know what you find out.
Starson17 is offline   Reply With Quote
Advert
Old 03-25-2010, 11:36 PM   #3
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: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont really need customindex for this. Just use basicnewsrecipe and override parse_index, return file:// URLs and you should be fine, though the backwards OS might give you a bit of trouble with filepath URLs
kovidgoyal is offline   Reply With Quote
Old 03-26-2010, 10:23 AM   #4
EnergyLens
Hack
EnergyLens began at the beginning.
 
Posts: 34
Karma: 12
Join Date: Dec 2009
Device: Kobo Aura HD, Kindle Paperwhite
Silly Questions

You were right about filepath URLs being tricky. I'm not a python programmer, so I just hack around from examples until I can make them work.

I found it was easier to just access the file system by using the web server locally on my Mac.

[silly questions deleted ... answered!]

Muchas Gracias!

Last edited by EnergyLens; 03-26-2010 at 10:32 AM.
EnergyLens is offline   Reply With Quote
Reply

Tags
calibre, customindex ebook-convert, scrapbook


Forum Jump


All times are GMT -4. The time now is 09:26 AM.


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