mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix title of downloaded ebooks.
This commit is contained in:
parent
0cfc152b05
commit
00af6187a3
@ -15,7 +15,7 @@ from calibre import browser, get_download_filename
|
|||||||
from calibre.ebooks import BOOK_EXTENSIONS
|
from calibre.ebooks import BOOK_EXTENSIONS
|
||||||
from calibre.gui2 import Dispatcher
|
from calibre.gui2 import Dispatcher
|
||||||
from calibre.gui2.threaded_jobs import ThreadedJob
|
from calibre.gui2.threaded_jobs import ThreadedJob
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryDirectory
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
|
|
||||||
class EbookDownload(object):
|
class EbookDownload(object):
|
||||||
@ -56,7 +56,8 @@ class EbookDownload(object):
|
|||||||
cj.load(cookie_file)
|
cj.load(cookie_file)
|
||||||
br.set_cookiejar(cj)
|
br.set_cookiejar(cj)
|
||||||
with closing(br.open(url)) as r:
|
with closing(br.open(url)) as r:
|
||||||
tf = PersistentTemporaryFile(suffix=filename)
|
temp_path = os.path.join(PersistentTemporaryDirectory(), filename)
|
||||||
|
tf = open(temp_path, 'w+b')
|
||||||
tf.write(r.read())
|
tf.write(r.read())
|
||||||
dfilename = tf.name
|
dfilename = tf.name
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user