|
|
#1 |
|
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,735
Karma: 2208556
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? |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,628
Karma: 28549046
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. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,735
Karma: 2208556
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
|
|
|
|
![]() |
|
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 |