aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwustho <benawiadha@gmail.com>2020-09-21 08:26:46 +0700
committerwustho <benawiadha@gmail.com>2020-09-21 08:26:46 +0700
commitde46e90ef2013a4ad98aa91b38652939820c8a3c (patch)
treebaf42bb5538e4423543afee0a1c0452ecf0c2252
parent452373dcfb9a752ca634025a70b408fd5234fa23 (diff)
downloadepy-de46e90ef2013a4ad98aa91b38652939820c8a3c.tar.gz
Fix cli interface, optional mobi support.
-rwxr-xr-xepy.py14
-rw-r--r--setup.py10
2 files changed, 16 insertions, 8 deletions
diff --git a/epy.py b/epy.py
index 35008e7..9d355f8 100755
--- a/epy.py
+++ b/epy.py
@@ -39,7 +39,11 @@ from html.parser import HTMLParser
from difflib import SequenceMatcher as SM
from functools import wraps
-import mobi
+try:
+ import mobi
+ MOBISUPPORT = True
+except ModuleNotFoundError:
+ MOBISUPPORT = False
# -1 is default terminal fg/bg colors
@@ -927,10 +931,14 @@ def det_ebook_cls(file):
return Epub(file)
elif filext == ".fb2":
return FictionBook(file)
- elif filext == ".mobi":
+ elif MOBISUPPORT and filext == ".mobi":
return Mobi(file)
+ elif not MOBISUPPORT and filext == ".mobi":
+ sys.exit("""ERR: Format not supported. (Supported: epub, fb2).
+To get mobi support, install mobi module from pip.
+ $ pip install mobi""")
else:
- sys.exit("ERR: Format not supported. (Supported: epub, fb2, mobi)")
+ sys.exit("ERR: Format not supported. (Supported: epub, fb2)")
def dots_path(curr, tofi):
diff --git a/setup.py b/setup.py
index 086ed2f..cb53d52 100644
--- a/setup.py
+++ b/setup.py
@@ -1,14 +1,14 @@
import sys
from setuptools import setup
-# from epy import __version__, __author__, __url__, __license__
+from epy import __version__, __author__, __url__, __license__
setup(
name = "epy",
- version = "2020.9.20",
+ version = __version__,
description = "Terminal/CLI Epub Reader (Fork of https://github.com/wustho/epr with Reading Pctg)",
- url = "https://github.com/wustho/epy",
- author = "Benawi Adha",
- license = "GPL-3.0",
+ url = __url__,
+ author = __author__,
+ license = __license__,
keywords = ["EPUB", "EPUB3", "CLI", "Terminal", "Reader"],
install_requires = ["mobi"] + (["windows-curses"] if sys.platform == "win32" else []),
python_requires = "~=3.0",