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, 10:32 AM   #1
kiwidude
Calibre Plugins 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,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
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 online now   Reply With Quote
Old 03-05-2011, 10: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: 43,842
Karma: 22666666
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 online now   Reply With Quote
Old 03-05-2011, 10:56 AM   #3
kiwidude
Calibre Plugins 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,636
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
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 online now   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-29-2011 11:09 PM
Temp files... BadGandalf Calibre 17 10-24-2010 11:38 AM
Temp files Jeff L Calibre 3 10-14-2010 05:58 PM
LIT-to->EPUB conversion leaving behind temp files? Stinger Calibre 1 06-20-2010 09:31 PM
Calibre files left in Temp folder itimpi Calibre 8 05-06-2009 06:15 AM


All times are GMT -4. The time now is 10:38 PM.


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