Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old 03-05-2011, 11:32 AM   #1
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Temp files cleanup

I'm moving an email conversation with Kovid here...

I am working on the next version of my Search the Internet plugin, which will allow specifying a url that will be submitted via HTTP POST as some websites require that.

Kovid has suggested using mechanize to perform the POST, grab the response, write it to a temp file and launch the browser. The potential issue I have with this is knowing when I could delete the temp files?

The other idea I had was to write a temp file with a fake form in it and javascript to submit the form using onload. That way I know I can safely delete the temp file after opening in the launched browser. I've got this working, but of course it would not work for users who disable javascript in their browser. How prevalent that is I have no idea.

Can anyone suggest which approach to take?
kiwidude is offline   Reply With Quote
Old 03-05-2011, 11:35 AM   #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: 26,325
Karma: 5382313
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Dont bother deleting the temp file, it will be deleted automatically on calibre shutdown, as long as you create it with the PersistentTemporaryFile function.

I don't think a lot of people disable javascript and if they do, then most likely the other approach will fail for them as well, so I would suggest sticking with your method if you're happy with it.
kovidgoyal is offline   Reply With Quote
Old 03-05-2011, 11:56 AM   #3
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,230
Karma: 1345754
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Thanks Kovid, that "PersistentTemporaryFile" function will help. I figured with the recent posts there would be some infrastructure I could hook into for that.

I will go with my current approach and save learning mechanize for a rainy day
kiwidude 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
100,000 temp files ??? cybmole Calibre 7 01-30-2011 12:09 AM
Temp files... BadGandalf Calibre 17 10-24-2010 12:38 PM
Temp files Jeff L Calibre 3 10-14-2010 06:58 PM
LIT-to->EPUB conversion leaving behind temp files? Stinger Calibre 1 06-20-2010 10:31 PM
Calibre files left in Temp folder itimpi Calibre 8 05-06-2009 07:15 AM


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


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