mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #70
This commit is contained in:
parent
32088f598b
commit
765a83fa39
@ -41,6 +41,8 @@ def extract(filename, dir):
|
||||
prefix = dirname
|
||||
# extract files
|
||||
for fn in filelist:
|
||||
if not os.path.exists(os.path.dirname(fn)):
|
||||
os.makedirs(os.path.dirname(fn))
|
||||
out = open( fn, 'wb' )
|
||||
buffer = StringIO( zf.read( fn ))
|
||||
buflen = 2 ** 20
|
||||
|
@ -60,6 +60,8 @@ def option_parser(usage):
|
||||
help='Sort key for the title')
|
||||
metadata.add_option('--author-sort', action='store', default='', dest='author_sort',
|
||||
help='Sort key for the author')
|
||||
metadata.add_option('--publisher', action='store', default='Unknown', dest='publisher',
|
||||
help='Publisher')
|
||||
profiles=['prs500']
|
||||
parser.add_option('-o', '--output', action='store', default=None, \
|
||||
help='Output file name. Default is derived from input filename')
|
||||
|
@ -1055,6 +1055,7 @@ def process_file(path, options):
|
||||
args = dict(font_delta=options.font_delta, title=title, \
|
||||
author=author, sourceencoding='utf8',\
|
||||
freetext=options.freetext, category=options.category,
|
||||
publisher=options.publisher,
|
||||
booksetting=BookSetting(dpi=10*options.profile.dpi,
|
||||
screenheight=options.profile.screen_height,
|
||||
screenwidth=options.profile.screen_width))
|
||||
@ -1115,6 +1116,14 @@ def try_opf(path, options):
|
||||
fa = author.get('file-as')
|
||||
if fa:
|
||||
options.author_sort = fa
|
||||
if options.publisher == 'Unknown':
|
||||
publisher = soup.package.metadata.find('dc:publisher')
|
||||
if publisher:
|
||||
options.publisher = publisher.string
|
||||
if not options.category.strip():
|
||||
category = soup.package.metadata.find('dc:type')
|
||||
if category:
|
||||
options.category = category.string
|
||||
isbn = []
|
||||
for item in soup.package.metadata.findAll('dc:identifier'):
|
||||
scheme = item.get('scheme')
|
||||
|
@ -73,6 +73,7 @@ def convert_txt(path, options):
|
||||
title = (options.title, options.title_sort)
|
||||
author = (options.author, options.author_sort)
|
||||
book = Book(header=header, title=title, author=author, \
|
||||
publisher=options.publisher,
|
||||
sourceencoding=options.encoding, freetext=options.freetext, \
|
||||
category=options.category, booksetting=BookSetting
|
||||
(dpi=10*options.profile.dpi,
|
||||
|
Loading…
x
Reference in New Issue
Block a user