mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
3b089d54a0
commit
361e86c6ff
@ -10,6 +10,7 @@ from calibre.constants import numeric_version
|
|||||||
from calibre.ebooks.metadata.archive import ArchiveExtract, get_cbz_metadata
|
from calibre.ebooks.metadata.archive import ArchiveExtract, get_cbz_metadata
|
||||||
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
from calibre.ebooks.metadata.opf2 import metadata_to_opf
|
||||||
from calibre.ebooks.oeb.base import OEB_IMAGES
|
from calibre.ebooks.oeb.base import OEB_IMAGES
|
||||||
|
from calibre.utils.config import test_eight_code
|
||||||
|
|
||||||
# To archive plugins {{{
|
# To archive plugins {{{
|
||||||
class HTML2ZIP(FileTypePlugin):
|
class HTML2ZIP(FileTypePlugin):
|
||||||
@ -166,6 +167,14 @@ class ComicMetadataReader(MetadataReaderPlugin):
|
|||||||
description = _('Extract cover from comic files')
|
description = _('Extract cover from comic files')
|
||||||
|
|
||||||
def get_metadata(self, stream, ftype):
|
def get_metadata(self, stream, ftype):
|
||||||
|
if hasattr(stream, 'seek') and hasattr(stream, 'tell'):
|
||||||
|
pos = stream.tell()
|
||||||
|
id_ = stream.read(3)
|
||||||
|
stream.seek(pos)
|
||||||
|
if id_ == b'Rar':
|
||||||
|
ftype = 'cbr'
|
||||||
|
elif id.startswith(b'PK'):
|
||||||
|
ftype = 'cbz'
|
||||||
if ftype == 'cbr':
|
if ftype == 'cbr':
|
||||||
from calibre.libunrar import extract_first_alphabetically as extract_first
|
from calibre.libunrar import extract_first_alphabetically as extract_first
|
||||||
extract_first
|
extract_first
|
||||||
|
Loading…
x
Reference in New Issue
Block a user