Read covers from CBC comic files. Fixes #1967028 [Calibre doesn't load first page of CBC file as cover](https://bugs.launchpad.net/calibre/+bug/1967028)

This commit is contained in:
Kovid Goyal 2022-03-30 15:27:00 +05:30
parent d9c61d48b9
commit 3b145786c9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -101,13 +101,21 @@ plugins += [HTML2ZIP, PML2PMLZ, TXT2TXTZ, ArchiveExtract, KPFExtract]
class ComicMetadataReader(MetadataReaderPlugin):
name = 'Read comic metadata'
file_types = {'cbr', 'cbz', 'cb7'}
file_types = {'cbr', 'cbz', 'cb7', 'cbc'}
description = _('Extract cover from comic files')
def customization_help(self, gui=False):
return 'Read series number from volume or issue number. Default is volume, set this to issue to use issue number instead.'
def get_metadata(self, stream, ftype):
if ftype == 'cbc':
from zipfile import ZipFile
zf = ZipFile(stream)
fcn = zf.open('comics.txt').read().decode('utf-8').splitlines()[0]
oname = getattr(stream, 'name', None)
stream = zf.open(fcn)
if oname:
stream.name = oname
if hasattr(stream, 'seek') and hasattr(stream, 'tell'):
pos = stream.tell()
id_ = stream.read(3)