mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
commit
d6894a6789
@ -49,7 +49,7 @@ def load_plugin(path_to_zip_file):
|
|||||||
|
|
||||||
:return: A :class:`Plugin` instance.
|
:return: A :class:`Plugin` instance.
|
||||||
'''
|
'''
|
||||||
print 'Loading plugin from', path_to_zip_file
|
#print 'Loading plugin from', path_to_zip_file
|
||||||
if not os.access(path_to_zip_file, os.R_OK):
|
if not os.access(path_to_zip_file, os.R_OK):
|
||||||
raise PluginNotFound
|
raise PluginNotFound
|
||||||
zf = ZipFile(path_to_zip_file)
|
zf = ZipFile(path_to_zip_file)
|
||||||
|
@ -61,11 +61,6 @@ def check_command_line_options(parser, args, log):
|
|||||||
output = os.path.splitext(os.path.basename(input))[0]+output
|
output = os.path.splitext(os.path.basename(input))[0]+output
|
||||||
output = os.path.abspath(output)
|
output = os.path.abspath(output)
|
||||||
|
|
||||||
if '.' in output:
|
|
||||||
if os.path.exists(output):
|
|
||||||
log.warn('WARNING:', output, 'exists. Deleting.')
|
|
||||||
os.remove(output)
|
|
||||||
|
|
||||||
return input, output
|
return input, output
|
||||||
|
|
||||||
def option_recommendation_to_cli_option(add_option, rec):
|
def option_recommendation_to_cli_option(add_option, rec):
|
||||||
@ -187,22 +182,26 @@ class ProgressBar(object):
|
|||||||
percent = int(frac*100)
|
percent = int(frac*100)
|
||||||
self.log('%d%% %s'%(percent, msg))
|
self.log('%d%% %s'%(percent, msg))
|
||||||
|
|
||||||
def main(args=sys.argv):
|
def create_option_parser(args, log):
|
||||||
log = Log()
|
|
||||||
reporter = ProgressBar(log)
|
|
||||||
parser = option_parser()
|
parser = option_parser()
|
||||||
if len(args) < 3:
|
if len(args) < 3:
|
||||||
print_help(parser, log)
|
print_help(parser, log)
|
||||||
return 1
|
raise SystemExit(1)
|
||||||
|
|
||||||
input, output = check_command_line_options(parser, args, log)
|
input, output = check_command_line_options(parser, args, log)
|
||||||
|
|
||||||
from calibre.ebooks.conversion.plumber import Plumber
|
from calibre.ebooks.conversion.plumber import Plumber
|
||||||
|
|
||||||
|
reporter = ProgressBar(log)
|
||||||
plumber = Plumber(input, output, log, reporter)
|
plumber = Plumber(input, output, log, reporter)
|
||||||
add_input_output_options(parser, plumber)
|
add_input_output_options(parser, plumber)
|
||||||
add_pipeline_options(parser, plumber)
|
add_pipeline_options(parser, plumber)
|
||||||
|
|
||||||
|
return parser, plumber
|
||||||
|
|
||||||
|
def main(args=sys.argv):
|
||||||
|
log = Log()
|
||||||
|
parser, plumber = create_option_parser(args, log)
|
||||||
opts = parser.parse_args(args)[0]
|
opts = parser.parse_args(args)[0]
|
||||||
y = lambda q : os.path.abspath(os.path.expanduser(q))
|
y = lambda q : os.path.abspath(os.path.expanduser(q))
|
||||||
for x in ('read_metadata_from_opf', 'cover'):
|
for x in ('read_metadata_from_opf', 'cover'):
|
||||||
|
@ -303,7 +303,7 @@ class MobiReader(object):
|
|||||||
if root.xpath('descendant::p/descendant::p'):
|
if root.xpath('descendant::p/descendant::p'):
|
||||||
from lxml.html import soupparser
|
from lxml.html import soupparser
|
||||||
self.log.warning('Markup contains unclosed <p> tags, parsing using',
|
self.log.warning('Markup contains unclosed <p> tags, parsing using',
|
||||||
'BeatifulSoup')
|
'BeatifulSoup')
|
||||||
root = soupparser.fromstring(self.processed_html)
|
root = soupparser.fromstring(self.processed_html)
|
||||||
self.upshift_markup(root)
|
self.upshift_markup(root)
|
||||||
guides = root.xpath('//guide')
|
guides = root.xpath('//guide')
|
||||||
|
@ -31,6 +31,7 @@ entry_points = {
|
|||||||
'calibre-fontconfig = calibre.utils.fontconfig:main',
|
'calibre-fontconfig = calibre.utils.fontconfig:main',
|
||||||
'calibre-parallel = calibre.parallel:main',
|
'calibre-parallel = calibre.parallel:main',
|
||||||
'calibre-customize = calibre.customize.ui:main',
|
'calibre-customize = calibre.customize.ui:main',
|
||||||
|
'calibre-complete = calibre.utils.complete:main',
|
||||||
'pdfmanipulate = calibre.ebooks.pdf.manipulate.cli:main',
|
'pdfmanipulate = calibre.ebooks.pdf.manipulate.cli:main',
|
||||||
'fetch-ebook-metadata = calibre.ebooks.metadata.fetch:main',
|
'fetch-ebook-metadata = calibre.ebooks.metadata.fetch:main',
|
||||||
'calibre-smtp = calibre.utils.smtp:main',
|
'calibre-smtp = calibre.utils.smtp:main',
|
||||||
@ -233,8 +234,9 @@ _prs500()
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
complete -o nospace -F _prs500 prs500
|
complete -o nospace -F _prs500 ebook-device
|
||||||
|
|
||||||
|
complete -C calibre-complete ebook-convert
|
||||||
''')
|
''')
|
||||||
f.close()
|
f.close()
|
||||||
print 'done'
|
print 'done'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user