mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixed resource leak in HelloWorld plugin?
This commit is contained in:
parent
8da7110fc8
commit
487a598d29
@ -22,7 +22,7 @@ class HelloWorld(FileTypePlugin):
|
|||||||
|
|
||||||
def run(self, path_to_ebook):
|
def run(self, path_to_ebook):
|
||||||
from calibre.ebooks.metadata.meta import get_metadata, set_metadata
|
from calibre.ebooks.metadata.meta import get_metadata, set_metadata
|
||||||
file = open(path_to_ebook, 'r+b')
|
with open(path_to_ebook, 'r+b') as file:
|
||||||
ext = os.path.splitext(path_to_ebook)[-1][1:].lower()
|
ext = os.path.splitext(path_to_ebook)[-1][1:].lower()
|
||||||
mi = get_metadata(file, ext)
|
mi = get_metadata(file, ext)
|
||||||
mi.publisher = 'Hello World'
|
mi.publisher = 'Hello World'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user