mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:...
This commit is contained in:
parent
036a82a7e2
commit
dcec167dee
@ -11,10 +11,10 @@ import os, sys, shutil, traceback, textwrap
|
|||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from reportlab.pdfgen import canvas
|
from reportlab.pdfgen import canvas
|
||||||
_reportlab = True
|
_reportlab = True
|
||||||
except:
|
except:
|
||||||
_reportlab = False
|
_reportlab = False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -325,7 +325,7 @@ def config(defaults=None,output_format='lrf'):
|
|||||||
c.add_opt('no_progress_bar', ['--no-progress-bar'], default=False,
|
c.add_opt('no_progress_bar', ['--no-progress-bar'], default=False,
|
||||||
help=_("Don't show progress bar."))
|
help=_("Don't show progress bar."))
|
||||||
if output_format == 'pdf':
|
if output_format == 'pdf':
|
||||||
c.add_opt('no_process',['--no_process'], default=False,
|
c.add_opt('no_process',['--no_process'], default=False,
|
||||||
help=_("Apply no processing to the image"))
|
help=_("Apply no processing to the image"))
|
||||||
return c
|
return c
|
||||||
|
|
||||||
@ -406,9 +406,8 @@ def create_pdf(pages, profile, opts, thumbnail=None):
|
|||||||
|
|
||||||
|
|
||||||
for page in pages:
|
for page in pages:
|
||||||
pdf.drawImage(page, x=0,y=0,width=width, height=height)
|
pdf.drawImage(page, x=0,y=0,width=width, height=height)
|
||||||
pdf.showPage()
|
pdf.showPage()
|
||||||
|
|
||||||
# Write the document to disk
|
# Write the document to disk
|
||||||
pdf.save()
|
pdf.save()
|
||||||
|
|
||||||
@ -427,22 +426,22 @@ def do_convert(path_to_file, opts, notification=lambda m, p: p, output_format='l
|
|||||||
if not pages:
|
if not pages:
|
||||||
raise ValueError('Could not find any pages in the comic: %s'%source)
|
raise ValueError('Could not find any pages in the comic: %s'%source)
|
||||||
if not opts.no_process:
|
if not opts.no_process:
|
||||||
pages, failures, tdir2 = process_pages(pages, opts, notification)
|
pages, failures, tdir2 = process_pages(pages, opts, notification)
|
||||||
if not pages:
|
if not pages:
|
||||||
raise ValueError('Could not find any valid pages in the comic: %s'%source)
|
raise ValueError('Could not find any valid pages in the comic: %s'%source)
|
||||||
if failures:
|
if failures:
|
||||||
print 'Could not process the following pages (run with --verbose to see why):'
|
print 'Could not process the following pages (run with --verbose to see why):'
|
||||||
for f in failures:
|
for f in failures:
|
||||||
print '\t', f
|
print '\t', f
|
||||||
thumbnail = os.path.join(tdir2, 'thumbnail.png')
|
thumbnail = os.path.join(tdir2, 'thumbnail.png')
|
||||||
if not os.access(thumbnail, os.R_OK):
|
if not os.access(thumbnail, os.R_OK):
|
||||||
thumbnail = None
|
thumbnail = None
|
||||||
if output_format == 'lrf':
|
if output_format == 'lrf':
|
||||||
create_lrf(pages, opts.profile, opts, thumbnail=thumbnail)
|
create_lrf(pages, opts.profile, opts, thumbnail=thumbnail)
|
||||||
if output_format == 'epub':
|
if output_format == 'epub':
|
||||||
create_epub(pages, opts.profile, opts, thumbnail=thumbnail)
|
create_epub(pages, opts.profile, opts, thumbnail=thumbnail)
|
||||||
if output_format == 'pdf':
|
if output_format == 'pdf':
|
||||||
create_pdf(pages, opts.profile, opts, thumbnail=thumbnail)
|
create_pdf(pages, opts.profile, opts, thumbnail=thumbnail)
|
||||||
shutil.rmtree(tdir)
|
shutil.rmtree(tdir)
|
||||||
if not opts.no_process:
|
if not opts.no_process:
|
||||||
shutil.rmtree(tdir2)
|
shutil.rmtree(tdir2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user