Epub: close file (windows temp file cleanup)
This commit is contained in:
parent
16a051c3b6
commit
a1daa8de55
@ -52,6 +52,7 @@ class rclEPUB:
|
|||||||
data = data.encode('UTF-8')
|
data = data.encode('UTF-8')
|
||||||
self.em.setmimetype('text/html')
|
self.em.setmimetype('text/html')
|
||||||
if len(self.contents) == 0:
|
if len(self.contents) == 0:
|
||||||
|
self.closefile()
|
||||||
eof = rclexecm.RclExecM.eofnext
|
eof = rclexecm.RclExecM.eofnext
|
||||||
else:
|
else:
|
||||||
eof = rclexecm.RclExecM.noteof
|
eof = rclexecm.RclExecM.noteof
|
||||||
@ -97,6 +98,9 @@ class rclEPUB:
|
|||||||
alltxt += txt
|
alltxt += txt
|
||||||
return alltxt
|
return alltxt
|
||||||
|
|
||||||
|
def closefile(self):
|
||||||
|
self.book.close()
|
||||||
|
|
||||||
def openfile(self, params):
|
def openfile(self, params):
|
||||||
"""Open the EPUB file, create a contents array"""
|
"""Open the EPUB file, create a contents array"""
|
||||||
self.currentindex = -1
|
self.currentindex = -1
|
||||||
@ -118,6 +122,7 @@ class rclEPUB:
|
|||||||
def getnext(self, params):
|
def getnext(self, params):
|
||||||
if self.catenate:
|
if self.catenate:
|
||||||
alltxt = self.dumpall()
|
alltxt = self.dumpall()
|
||||||
|
self.closefile()
|
||||||
if alltxt:
|
if alltxt:
|
||||||
return (True, alltxt, "", rclexecm.RclExecM.eofnext)
|
return (True, alltxt, "", rclexecm.RclExecM.eofnext)
|
||||||
else:
|
else:
|
||||||
@ -128,9 +133,13 @@ class rclEPUB:
|
|||||||
return self._selfdoc()
|
return self._selfdoc()
|
||||||
|
|
||||||
if self.currentindex >= len(self.contents):
|
if self.currentindex >= len(self.contents):
|
||||||
|
self.closefile()
|
||||||
return (False, "", "", rclexecm.RclExecM.eofnow)
|
return (False, "", "", rclexecm.RclExecM.eofnow)
|
||||||
else:
|
else:
|
||||||
ret= self.extractone(self.contents[self.currentindex])
|
ret = self.extractone(self.contents[self.currentindex])
|
||||||
|
if ret[3] == rclexecm.RclExecM.eofnext or \
|
||||||
|
ret[3] == rclexecm.RclExecM.eofnow:
|
||||||
|
self.closefile()
|
||||||
self.currentindex += 1
|
self.currentindex += 1
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|||||||
@ -73,6 +73,7 @@ class EPUBConcatExtractor(RclBaseHandler):
|
|||||||
data += doc
|
data += doc
|
||||||
|
|
||||||
data += b'</body></html>'
|
data += b'</body></html>'
|
||||||
|
self.book.close()
|
||||||
return data
|
return data
|
||||||
|
|
||||||
proto = rclexecm.RclExecM()
|
proto = rclexecm.RclExecM()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user