mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use text mode streams for metadata logging
This commit is contained in:
parent
1d33b3dc0c
commit
19145e4bd3
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from threading import Thread, Event
|
from threading import Thread, Event
|
||||||
from io import BytesIO
|
from io import StringIO
|
||||||
|
|
||||||
from calibre.customize.ui import metadata_plugins
|
from calibre.customize.ui import metadata_plugins
|
||||||
from calibre.ebooks.metadata.sources.base import create_log
|
from calibre.ebooks.metadata.sources.base import create_log
|
||||||
@ -27,7 +27,7 @@ class Worker(Thread):
|
|||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
self.abort = abort
|
self.abort = abort
|
||||||
self.get_best_cover = get_best_cover
|
self.get_best_cover = get_best_cover
|
||||||
self.buf = BytesIO()
|
self.buf = StringIO()
|
||||||
self.log = create_log(self.buf)
|
self.log = create_log(self.buf)
|
||||||
self.title, self.authors, self.identifiers = (title, authors,
|
self.title, self.authors, self.identifiers = (title, authors,
|
||||||
identifiers)
|
identifiers)
|
||||||
|
@ -9,7 +9,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
import time, re
|
import time, re
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from io import BytesIO
|
from io import StringIO
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
from polyglot.urllib import urlparse, quote
|
from polyglot.urllib import urlparse, quote
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class Worker(Thread):
|
|||||||
|
|
||||||
self.plugin, self.kwargs, self.rq = plugin, kwargs, Queue()
|
self.plugin, self.kwargs, self.rq = plugin, kwargs, Queue()
|
||||||
self.abort = abort
|
self.abort = abort
|
||||||
self.buf = BytesIO()
|
self.buf = StringIO()
|
||||||
self.log = create_log(self.buf)
|
self.log = create_log(self.buf)
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -126,7 +126,7 @@ def pubdate_test(year, month, day):
|
|||||||
def init_test(tdir_name):
|
def init_test(tdir_name):
|
||||||
tdir = tempfile.gettempdir()
|
tdir = tempfile.gettempdir()
|
||||||
lf = os.path.join(tdir, tdir_name.replace(' ', '')+'_identify_test.txt')
|
lf = os.path.join(tdir, tdir_name.replace(' ', '')+'_identify_test.txt')
|
||||||
log = create_log(open(lf, 'wb'))
|
log = create_log(open(lf, 'w'))
|
||||||
abort = Event()
|
abort = Event()
|
||||||
return tdir, lf, log, abort
|
return tdir, lf, log, abort
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user