def get_pages(self, comic, tdir2): from calibre.ebooks.comic.input import (extract_comic, process_pages, find_pages) tdir = extract_comic(comic) new_pages = find_pages(tdir, sort_on_mtime=self.opts.no_sort, verbose=self.opts.verbose) thumbnail = None if not new_pages: raise ValueError('Could not find any pages in the comic: %s' %comic) if self.opts.no_process: n2 = [] for page in new_pages: n2.append(os.path.join(tdir2, os.path.basename(page))) shutil.copyfile(page, n2[-1]) new_pages = n2 else: new_pages, failures = process_pages(new_pages, self.opts, self.report_progress, tdir2) if failures: self.log.warning('Could not process the following pages ' '(run with --verbose to see why):') for f in failures: self.log.warning('\t', f) if not new_pages: raise ValueError('Could not find any valid pages in comic: %s' % comic) thumbnail = os.path.join(tdir2, 'thumbnail.'+self.opts.output_format.lower()) if not os.access(thumbnail, os.R_OK): thumbnail = None return new_pages
def get_pages(self, comic, tdir2): from calibre.ebooks.comic.input import (extract_comic, process_pages, find_pages) tdir = extract_comic(comic) new_pages = find_pages(tdir, sort_on_mtime=self.opts.no_sort, verbose=self.opts.verbose) thumbnail = None if not new_pages: raise ValueError('Could not find any pages in the comic: %s' % comic) if self.opts.no_process: n2 = [] for i, page in enumerate(new_pages): n2.append( os.path.join(tdir2, '{} - {}'.format(i, os.path.basename(page)))) shutil.copyfile(page, n2[-1]) new_pages = n2 else: new_pages, failures = process_pages(new_pages, self.opts, self.report_progress, tdir2) if failures: self.log.warning('Could not process the following pages ' '(run with --verbose to see why):') for f in failures: self.log.warning('\t', f) if not new_pages: raise ValueError( 'Could not find any valid pages in comic: %s' % comic) thumbnail = os.path.join( tdir2, 'thumbnail.' + self.opts.output_format.lower()) if not os.access(thumbnail, os.R_OK): thumbnail = None return new_pages