From a2ffd259b8d5c20b131faa7be0b81fd87096fd9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Tue, 10 Jul 2018 09:00:13 +0200 Subject: [PATCH] Code cleanup --- .travis.yml | 2 +- README.md | 6 +++--- appveyor.yml | 4 ++-- kindlecomicconverter/dualmetafix.py | 1 + kindlecomicconverter/metadata.py | 2 -- kindlecomicconverter/shared.py | 22 ++++++++++------------ 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 977b0df7..eba8cca6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ before_install: install: - pip3 install -r requirements.txt -- pip3 install certifi https://github.com/bjones1/pyinstaller/archive/pyqt5_fix.zip +- pip3 install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip - npm install -g appdmg script: python3 setup.py build_binary diff --git a/README.md b/README.md index 85e20bf8..68c5311d 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,9 @@ sudo pip3 install --upgrade pillow python-slugify psutil pyqt5 raven ## INPUT FORMATS **KCC** can understand and convert, at the moment, the following input types: - Folders containing: PNG, JPG or GIF files -- CBZ, ZIP -- CBR, RAR *(With `unrar` executable)* -- CB7, 7Z *(With `7za` executable)* +- CBZ, ZIP *(With `7z` executable)* +- CBR, RAR *(With `7z` executable)* +- CB7, 7Z *(With `7z` executable)* - PDF *(Only extracting JPG images)* ## USAGE diff --git a/appveyor.yml b/appveyor.yml index 2eb446ce..b603c3cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,11 +1,11 @@ environment: - PYTHON: "C:\\Python36-x64" + PYTHON: "C:\\Python37-x64" install: - set PATH="%PYTHON%\\Scripts";"C:\\Program Files (x86)\\Inno Setup 5";%PATH% - "%PYTHON%\\python.exe -m pip install --upgrade pip setuptools wheel" - "%PYTHON%\\python.exe -m pip install -r requirements.txt" - - "%PYTHON%\\python.exe -m pip install certifi https://github.com/bjones1/pyinstaller/archive/pyqt5_fix.zip" + - "%PYTHON%\\python.exe -m pip install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip" - nuget install secure-file -ExcludeVersion - secure-file\tools\secure-file -decrypt other\windows\sentry.py.enc -out kindlecomicconverter\sentry.py -secret %ENCRYPTION% diff --git a/kindlecomicconverter/dualmetafix.py b/kindlecomicconverter/dualmetafix.py index e6be2557..5dfb2d77 100644 --- a/kindlecomicconverter/dualmetafix.py +++ b/kindlecomicconverter/dualmetafix.py @@ -24,6 +24,7 @@ class DualMetaFixException(Exception): pass + # palm database offset constants number_of_pdb_records = 76 first_pdb_record = 78 diff --git a/kindlecomicconverter/metadata.py b/kindlecomicconverter/metadata.py index df87340c..62c74429 100644 --- a/kindlecomicconverter/metadata.py +++ b/kindlecomicconverter/metadata.py @@ -19,8 +19,6 @@ import os from xml.dom.minidom import parse, Document from re import compile -from subprocess import STDOUT, PIPE -from psutil import Popen from tempfile import mkdtemp from shutil import rmtree from . import comicarchive diff --git a/kindlecomicconverter/shared.py b/kindlecomicconverter/shared.py index 32f656c3..4918a90d 100644 --- a/kindlecomicconverter/shared.py +++ b/kindlecomicconverter/shared.py @@ -22,8 +22,6 @@ from hashlib import md5 from html.parser import HTMLParser from distutils.version import StrictVersion -from shutil import rmtree, copy -from tempfile import mkdtemp from re import split from traceback import format_tb @@ -49,8 +47,7 @@ def error(self, message): def getImageFileName(imgfile): name, ext = os.path.splitext(imgfile) ext = ext.lower() - if name.startswith('.') or (ext != '.png' and ext != '.jpg' and ext != '.jpeg' and ext != '.gif' and - ext != '.webp'): + if name.startswith('.') or ext not in ['.png', '.jpg', '.jpeg', '.gif', '.webp']: return None return [name, ext] @@ -88,16 +85,17 @@ def md5Checksum(fpath): def sanitizeTrace(traceback): return ''.join(format_tb(traceback))\ - .replace('C:/projects/kcc/', '') \ - .replace('c:/projects/kcc/', '') \ - .replace('C:/python36-x64/', '')\ - .replace('c:/python36-x64/', '')\ - .replace('C:\\projects\\kcc\\', '') \ - .replace('c:\\projects\\kcc\\', '') \ - .replace('C:\\python36-x64\\', '')\ - .replace('c:\\python36-x64\\', '') + .replace('C:/projects/kcc/', '')\ + .replace('c:/projects/kcc/', '')\ + .replace('C:/python37-x64/', '')\ + .replace('c:/python37-x64/', '')\ + .replace('C:\\projects\\kcc\\', '')\ + .replace('c:\\projects\\kcc\\', '')\ + .replace('C:\\python37-x64\\', '')\ + .replace('c:\\python37-x64\\', '') +# noinspection PyUnresolvedReferences def dependencyCheck(level): missing = [] if level > 2: