mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1590 (Title of book not read correctly for DRMed PRC files)
This commit is contained in:
parent
9cf9ccd52b
commit
05b8fcb0a7
@ -52,7 +52,13 @@ class EXTHHeader(object):
|
|||||||
# print 'unknown record', id, repr(content)
|
# print 'unknown record', id, repr(content)
|
||||||
title = re.search(r'\0+([^\0]+)\0+', raw[pos:])
|
title = re.search(r'\0+([^\0]+)\0+', raw[pos:])
|
||||||
if title:
|
if title:
|
||||||
self.mi.title = title.group(1).decode(codec, 'ignore')
|
title = title.group(1).decode(codec, 'replace')
|
||||||
|
if len(title) > 2:
|
||||||
|
self.mi.title = title
|
||||||
|
else:
|
||||||
|
title = re.search(r'\0+([^\0]+)\0+', ''.join(reversed(raw[pos:])))
|
||||||
|
if title:
|
||||||
|
self.mi.title = ''.join(reversed(title.group(1).decode(codec, 'replace')))
|
||||||
|
|
||||||
|
|
||||||
def process_metadata(self, id, content, codec):
|
def process_metadata(self, id, content, codec):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user