mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Better metadata detection
This commit is contained in:
parent
8fd446090c
commit
2c3e8cccb8
@ -10,7 +10,6 @@ import os
|
|||||||
from calibre.customize.conversion import InputFormatPlugin
|
from calibre.customize.conversion import InputFormatPlugin
|
||||||
from calibre.ebooks.pdf.pdftohtml import pdftohtml
|
from calibre.ebooks.pdf.pdftohtml import pdftohtml
|
||||||
from calibre.ebooks.metadata.opf import OPFCreator
|
from calibre.ebooks.metadata.opf import OPFCreator
|
||||||
from calibre.customize.builtins import PDFMetadataReader
|
|
||||||
|
|
||||||
class PDFInput(InputFormatPlugin):
|
class PDFInput(InputFormatPlugin):
|
||||||
|
|
||||||
@ -26,7 +25,8 @@ class PDFInput(InputFormatPlugin):
|
|||||||
with open('index.html', 'wb') as index:
|
with open('index.html', 'wb') as index:
|
||||||
index.write(html)
|
index.write(html)
|
||||||
|
|
||||||
mi = PDFMetadataReader(None).get_metadata(stream, 'pdf')
|
from calibre.ebooks.metadata.meta import get_metadata
|
||||||
|
mi = get_metadata(stream, 'pdf')
|
||||||
opf = OPFCreator(os.getcwd(), mi)
|
opf = OPFCreator(os.getcwd(), mi)
|
||||||
opf.create_manifest([('index.html', None)])
|
opf.create_manifest([('index.html', None)])
|
||||||
opf.create_spine(['index.html'])
|
opf.create_spine(['index.html'])
|
||||||
|
@ -10,7 +10,6 @@ import os
|
|||||||
from calibre.customize.conversion import InputFormatPlugin
|
from calibre.customize.conversion import InputFormatPlugin
|
||||||
from calibre.ebooks.markdown import markdown
|
from calibre.ebooks.markdown import markdown
|
||||||
from calibre.ebooks.metadata.opf import OPFCreator
|
from calibre.ebooks.metadata.opf import OPFCreator
|
||||||
from calibre.customize.builtins import TXTMetadataReader
|
|
||||||
|
|
||||||
class TXTInput(InputFormatPlugin):
|
class TXTInput(InputFormatPlugin):
|
||||||
|
|
||||||
@ -33,7 +32,8 @@ class TXTInput(InputFormatPlugin):
|
|||||||
with open('index.html', 'wb') as index:
|
with open('index.html', 'wb') as index:
|
||||||
index.write(html.encode('utf-8'))
|
index.write(html.encode('utf-8'))
|
||||||
|
|
||||||
mi = TXTMetadataReader(None).get_metadata(stream, 'txt')
|
from calibre.ebooks.metadata.meta import get_metadata
|
||||||
|
mi = get_metadata(stream, 'txt')
|
||||||
opf = OPFCreator(os.getcwd(), mi)
|
opf = OPFCreator(os.getcwd(), mi)
|
||||||
opf.create_manifest([('index.html', None)])
|
opf.create_manifest([('index.html', None)])
|
||||||
opf.create_spine(['index.html'])
|
opf.create_spine(['index.html'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user