mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 09:46:25 +00:00
Code cleanup
This commit is contained in:
@@ -18,11 +18,6 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] != 3:
|
if sys.version_info[0] != 3:
|
||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
|
|||||||
@@ -18,11 +18,6 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] != 3:
|
if sys.version_info[0] != 3:
|
||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
|
|||||||
5
kcc.py
5
kcc.py
@@ -18,11 +18,6 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
if sys.version_info[0] != 3:
|
if sys.version_info[0] != 3:
|
||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
|
|||||||
@@ -17,11 +17,6 @@
|
|||||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
@@ -41,6 +36,7 @@ from distutils.version import StrictVersion
|
|||||||
from .shared import md5Checksum, HTMLStripper
|
from .shared import md5Checksum, HTMLStripper
|
||||||
from . import comic2ebook
|
from . import comic2ebook
|
||||||
from . import KCC_rc_web
|
from . import KCC_rc_web
|
||||||
|
from . import __version__
|
||||||
if sys.platform.startswith('darwin'):
|
if sys.platform.startswith('darwin'):
|
||||||
from . import KCC_ui_osx as KCC_ui
|
from . import KCC_ui_osx as KCC_ui
|
||||||
elif sys.platform.startswith('linux'):
|
elif sys.platform.startswith('linux'):
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
from zipfile import is_zipfile, ZipFile
|
from zipfile import is_zipfile, ZipFile
|
||||||
|
|||||||
@@ -18,11 +18,6 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from copy import copy
|
from copy import copy
|
||||||
@@ -52,6 +47,7 @@ from . import image
|
|||||||
from . import cbxarchive
|
from . import cbxarchive
|
||||||
from . import pdfjpgextract
|
from . import pdfjpgextract
|
||||||
from . import dualmetafix
|
from . import dualmetafix
|
||||||
|
from . import __version__
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main(argv=None):
|
||||||
|
|||||||
@@ -18,11 +18,6 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from shutil import rmtree, copytree, move
|
from shutil import rmtree, copytree, move
|
||||||
|
|||||||
@@ -16,11 +16,6 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__version__ = '4.4.1'
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
@@ -28,6 +23,7 @@ from urllib.parse import quote
|
|||||||
from functools import reduce
|
from functools import reduce
|
||||||
from PIL import Image, ImageOps, ImageStat, ImageChops
|
from PIL import Image, ImageOps, ImageStat, ImageChops
|
||||||
from .shared import md5Checksum
|
from .shared import md5Checksum
|
||||||
|
from . import __version__
|
||||||
|
|
||||||
|
|
||||||
class ProfileData:
|
class ProfileData:
|
||||||
|
|||||||
@@ -19,10 +19,6 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from random import choice
|
from random import choice
|
||||||
from string import ascii_uppercase, digits
|
from string import ascii_uppercase, digits
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
#
|
#
|
||||||
|
|
||||||
__license__ = 'ISC'
|
|
||||||
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
|
|
||||||
__docformat__ = 'restructuredtext en'
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from hashlib import md5
|
from hashlib import md5
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
@@ -107,12 +103,5 @@ def dependencyCheck(level):
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
missing.append('Pillow 2.7.0+')
|
missing.append('Pillow 2.7.0+')
|
||||||
if len(missing) > 0:
|
if len(missing) > 0:
|
||||||
try:
|
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
|
||||||
import tkinter
|
|
||||||
import tkinter.messagebox
|
|
||||||
importRoot = tkinter.Tk()
|
|
||||||
importRoot.withdraw()
|
|
||||||
tkinter.messagebox.showerror('KCC - Error', 'ERROR: ' + ', '.join(missing) + ' is not installed!')
|
|
||||||
except ImportError:
|
|
||||||
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
|
|
||||||
exit(1)
|
exit(1)
|
||||||
18
setup.py
18
setup.py
@@ -9,12 +9,13 @@ Usage (Mac OS X):
|
|||||||
python setup.py py2app
|
python setup.py py2app
|
||||||
"""
|
"""
|
||||||
from sys import platform, version_info
|
from sys import platform, version_info
|
||||||
|
from kcc import __version__
|
||||||
if version_info[0] != 3:
|
if version_info[0] != 3:
|
||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
NAME = "KindleComicConverter"
|
NAME = "KindleComicConverter"
|
||||||
VERSION = "4.4.1"
|
VERSION = __version__
|
||||||
MAIN = "kcc.py"
|
MAIN = "kcc.py"
|
||||||
|
|
||||||
if platform == "darwin":
|
if platform == "darwin":
|
||||||
@@ -54,24 +55,17 @@ if platform == "darwin":
|
|||||||
elif platform == "win32":
|
elif platform == "win32":
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
import py2exe
|
import py2exe
|
||||||
import platform as arch
|
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
if arch.architecture()[0] == '64bit':
|
additional_files = [('platforms', ['C:\Python34\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll']),
|
||||||
suffix = '_64'
|
|
||||||
else:
|
|
||||||
suffix = ''
|
|
||||||
additional_files = [('platforms', ['C:\Python34' + suffix +
|
|
||||||
'\Lib\site-packages\PyQt5\plugins\platforms\qwindows.dll']),
|
|
||||||
('', ['LICENSE.txt',
|
('', ['LICENSE.txt',
|
||||||
'other\\7za.exe',
|
'other\\7za.exe',
|
||||||
'other\\UnRAR.exe',
|
'other\\UnRAR.exe',
|
||||||
'other\\Additional-LICENSE.txt',
|
'other\\Additional-LICENSE.txt',
|
||||||
'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libGLESv2.dll',
|
'C:\Python34\Lib\site-packages\PyQt5\libGLESv2.dll',
|
||||||
'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libEGL.dll'])]
|
'C:\Python34\Lib\site-packages\PyQt5\libEGL.dll'])]
|
||||||
extra_options = dict(
|
extra_options = dict(
|
||||||
options={'py2exe': {"bundle_files": 1,
|
options={'py2exe': {"bundle_files": 1,
|
||||||
"dll_excludes": ["tcl85.dll", "tk85.dll"],
|
"dist_dir": "dist",
|
||||||
"dist_dir": "dist" + suffix,
|
|
||||||
"compressed": True,
|
"compressed": True,
|
||||||
"includes": ["sip"],
|
"includes": ["sip"],
|
||||||
"excludes": ["tkinter"],
|
"excludes": ["tkinter"],
|
||||||
|
|||||||
2
setup.sh
2
setup.sh
@@ -21,5 +21,5 @@ echo "#!/usr/bin/env python3" > kcc-c2p-bin
|
|||||||
cat kcc-c2p.zip >> kcc-c2p-bin
|
cat kcc-c2p.zip >> kcc-c2p-bin
|
||||||
chmod +x kcc-c2p-bin
|
chmod +x kcc-c2p-bin
|
||||||
|
|
||||||
tar --xform s:^.*/:: --xform s/kcc-bin/kcc/ --xform s/kcc-c2p-bin/kcc-c2p/ --xform s/kcc-c2e-bin/kcc-c2e/ --xform s/comic2ebook/kcc/ -czf KindleComicConverter_linux_$VERSION.tar.gz kcc-bin kcc-c2e-bin kcc-c2p-bin LICENSE.txt icons/comic2ebook.png
|
tar --xform s:^.*/:: --xform s/kcc-bin/kcc/ --xform s/kcc-c2p-bin/kcc-c2p/ --xform s/kcc-c2e-bin/kcc-c2e/ --xform s/comic2ebook/kcc/ -czf KindleComicConverter_linux_${VERSION}.tar.gz kcc-bin kcc-c2e-bin kcc-c2p-bin LICENSE.txt icons/comic2ebook.png
|
||||||
rm __main__.py kcc.zip kcc-c2e.zip kcc-c2p.zip kcc-bin kcc-c2e-bin kcc-c2p-bin
|
rm __main__.py kcc.zip kcc-c2e.zip kcc-c2p.zip kcc-bin kcc-c2e-bin kcc-c2p-bin
|
||||||
Reference in New Issue
Block a user