mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix regression in LIT metadata reader
This commit is contained in:
parent
0749f44979
commit
996dda3ffe
@ -882,6 +882,9 @@ class LitContainer(object):
|
|||||||
unbin = UnBinary(raw, path, self._litfile.manifest, OPF_MAP)
|
unbin = UnBinary(raw, path, self._litfile.manifest, OPF_MAP)
|
||||||
return str(unbin)
|
return str(unbin)
|
||||||
|
|
||||||
|
def get_metadata(self):
|
||||||
|
return self._read_meta()
|
||||||
|
|
||||||
|
|
||||||
class LitReader(OEBReader):
|
class LitReader(OEBReader):
|
||||||
Container = LitContainer
|
Container = LitContainer
|
||||||
|
@ -4,15 +4,16 @@ __copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
|||||||
Support for reading the metadata from a LIT file.
|
Support for reading the metadata from a LIT file.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import sys, cStringIO, os
|
import cStringIO, os
|
||||||
|
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
from calibre.ebooks.metadata.opf2 import OPF
|
from calibre.ebooks.metadata.opf2 import OPF
|
||||||
from calibre.ebooks.lit.reader import LitReader
|
|
||||||
|
|
||||||
def get_metadata(stream):
|
def get_metadata(stream):
|
||||||
litfile = LitReader(stream)
|
from calibre.ebooks.lit.reader import LitContainer
|
||||||
src = litfile.meta.encode('utf-8')
|
litfile = LitContainer(stream)
|
||||||
|
src = litfile.get_metadata().encode('utf-8')
|
||||||
|
litfile = litfile._litfile
|
||||||
opf = OPF(cStringIO.StringIO(src), os.getcwd())
|
opf = OPF(cStringIO.StringIO(src), os.getcwd())
|
||||||
mi = MetaInformation(opf)
|
mi = MetaInformation(opf)
|
||||||
covers = []
|
covers = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user