From 39052b58c6a42c2a278b2f4e8d88a45c0995a6d6 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Mon, 29 Jun 2020 19:07:14 -0700 Subject: [PATCH] Remove PyPDF2 --- comicapi/comicarchive.py | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/comicapi/comicarchive.py b/comicapi/comicarchive.py index 6a8df88..660900e 100644 --- a/comicapi/comicarchive.py +++ b/comicapi/comicarchive.py @@ -25,7 +25,6 @@ import time import io import natsort -from PyPDF2 import PdfFileReader from unrar.cffi import rarfile try: import Image @@ -172,7 +171,7 @@ class ZipArchiver: found = False value = bytearray() - + # walk backwards to find the "End of Central Directory" record while (not found) and (-pos != file_length): # seek, relative to EOF @@ -271,7 +270,7 @@ class RarArchiver: f.close() working_dir = os.path.dirname(os.path.abspath(self.path)) - + # use external program to write comment to Rar archive proc_args = [self.rar_exe_path, 'c', @@ -305,7 +304,7 @@ class RarArchiver: while tries < 7: try: tries = tries + 1 - data = rarc.open(archive_file).read() + data = rarc.open(archive_file).read() entries = [(rarc.getinfo(archive_file), data)] if entries[0][0].file_size != len(entries[0][1]): @@ -530,35 +529,6 @@ class UnknownArchiver: return [] -class PdfArchiver: - - def __init__(self, path): - self.path = path - - def getArchiveComment(self): - return "" - - def setArchiveComment(self, comment): - return False - - def readArchiveFile(self, page_num): - return subprocess.check_output( - ['mudraw', '-o', '-', self.path, str(int(os.path.basename(page_num)[:-4]))]) - - def writeArchiveFile(self, archive_file, data): - return False - - def removeArchiveFile(self, archive_file): - return False - - def getArchiveFilenameList(self): - out = [] - pdf = PdfFileReader(open(self.path, 'rb')) - for page in range(1, pdf.getNumPages() + 1): - out.append("/%04d.jpg" % (page)) - return out - - class ComicArchive: logo_data = None @@ -635,7 +605,7 @@ class ComicArchive: return zipfile.is_zipfile(self.path) def rarTest(self): - return rarfile.is_rarfile(self.path) + return rarfile.is_rarfile(self.path) def isZip(self): return self.archive_type == self.ArchiveType.Zip