about summary refs log tree commit diff
path: root/kindlecomicconverter
diff options
context:
space:
mode:
authorPaweł Jastrzębski <pawelj@iosphe.re>2018-07-10 09:00:13 +0200
committerPaweł Jastrzębski <pawelj@iosphe.re>2018-07-10 09:00:13 +0200
commita2ffd259b8d5c20b131faa7be0b81fd87096fd9b (patch)
treed6e4a62839d1c03c893123c548913d5f79595ecd /kindlecomicconverter
parentExpanded output of corruption error (close #272) (diff)
downloadkcc-a2ffd259b8d5c20b131faa7be0b81fd87096fd9b.tar.gz
kcc-a2ffd259b8d5c20b131faa7be0b81fd87096fd9b.tar.bz2
kcc-a2ffd259b8d5c20b131faa7be0b81fd87096fd9b.zip
Code cleanup
Diffstat (limited to 'kindlecomicconverter')
-rw-r--r--kindlecomicconverter/dualmetafix.py1
-rw-r--r--kindlecomicconverter/metadata.py2
-rw-r--r--kindlecomicconverter/shared.py22
3 files changed, 11 insertions, 14 deletions
diff --git a/kindlecomicconverter/dualmetafix.py b/kindlecomicconverter/dualmetafix.py
index e6be255..5dfb2d7 100644
--- a/kindlecomicconverter/dualmetafix.py
+++ b/kindlecomicconverter/dualmetafix.py
@@ -24,6 +24,7 @@ import shutil
 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 df87340..62c7442 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 32f656c..4918a90 100644
--- a/kindlecomicconverter/shared.py
+++ b/kindlecomicconverter/shared.py
@@ -22,8 +22,6 @@ import os
 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 @@ class HTMLStripper(HTMLParser):
 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: