Better metadata detection

This commit is contained in:
John Schember 2009-04-09 06:26:22 -04:00
parent 8fd446090c
commit 2c3e8cccb8
2 changed files with 4 additions and 4 deletions

View File

@ -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'])

View File

@ -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'])