mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Merge from trunk
This commit is contained in:
commit
5cae0019e0
@ -18,6 +18,7 @@ from calibre import xml_entity_to_unicode, CurrentDir, entity_to_unicode, \
|
|||||||
replace_entities
|
replace_entities
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
from calibre.utils.date import parse_date
|
from calibre.utils.date import parse_date
|
||||||
|
from calibre.utils.cleantext import clean_ascii_chars
|
||||||
from calibre.ptempfile import TemporaryDirectory
|
from calibre.ptempfile import TemporaryDirectory
|
||||||
from calibre.ebooks import DRMError
|
from calibre.ebooks import DRMError
|
||||||
from calibre.ebooks.chardet import ENCODING_PATS
|
from calibre.ebooks.chardet import ENCODING_PATS
|
||||||
@ -323,6 +324,7 @@ class MobiReader(object):
|
|||||||
self.cleanup_html()
|
self.cleanup_html()
|
||||||
|
|
||||||
self.log.debug('Parsing HTML...')
|
self.log.debug('Parsing HTML...')
|
||||||
|
self.processed_html = clean_ascii_chars(self.processed_html)
|
||||||
try:
|
try:
|
||||||
root = html.fromstring(self.processed_html)
|
root = html.fromstring(self.processed_html)
|
||||||
if len(root.xpath('//html')) > 5:
|
if len(root.xpath('//html')) > 5:
|
||||||
|
@ -1196,7 +1196,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
|
|||||||
else:
|
else:
|
||||||
new_cats['.'.join(comps)] = user_cats[k]
|
new_cats['.'.join(comps)] = user_cats[k]
|
||||||
try:
|
try:
|
||||||
self.prefs.set('user_categories', new_cats)
|
if new_cats != user_cats:
|
||||||
|
self.prefs.set('user_categories', new_cats)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
return new_cats
|
return new_cats
|
||||||
|
@ -49,8 +49,7 @@ class DBPrefs(dict):
|
|||||||
if self.disable_setting:
|
if self.disable_setting:
|
||||||
return
|
return
|
||||||
raw = self.to_raw(val)
|
raw = self.to_raw(val)
|
||||||
self.db.conn.execute('DELETE FROM preferences WHERE key=?', (key,))
|
self.db.conn.execute('INSERT OR REPLACE INTO preferences (key,val) VALUES (?,?)', (key,
|
||||||
self.db.conn.execute('INSERT INTO preferences (key,val) VALUES (?,?)', (key,
|
|
||||||
raw))
|
raw))
|
||||||
self.db.conn.commit()
|
self.db.conn.commit()
|
||||||
dict.__setitem__(self, key, val)
|
dict.__setitem__(self, key, val)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user