mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Fix reading of metadata from pdflrf generated LRF files.
This commit is contained in:
parent
cb89867576
commit
7fbe1b98f4
1 changed files with 3 additions and 1 deletions
|
|
@ -24,7 +24,7 @@
|
|||
>>> lrf.category = "History"
|
||||
"""
|
||||
|
||||
import struct, zlib, sys
|
||||
import struct, zlib, sys, re
|
||||
from shutil import copyfileobj
|
||||
from cStringIO import StringIO
|
||||
import xml.dom.minidom as dom
|
||||
|
|
@ -392,6 +392,8 @@ def fget(self):
|
|||
# encoded metadata block.
|
||||
# Decoding using latin1 is the most useful for me since I
|
||||
# occassionally read french books.
|
||||
# pdflrf creates invalif metadata blocks
|
||||
candidate = re.compile(u'</Info>.*', re.DOTALL).sub(u'</Info>', candidate)
|
||||
if not u"Info" in candidate:
|
||||
candidate = unicode(src, 'latin1', errors='ignore')
|
||||
if candidate[-1:] == '\0':
|
||||
|
|
|
|||
Loading…
Reference in a new issue