X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=nhentai%2Fcommand.py;h=bc987fb8852390a6d705e7205be26c2842d6a9f3;hb=00aad774ae0099a7ef2ed2ed481d333cf0f6f418;hp=b44f9d20c64da13c5aa0ed7131a30500ada4c2a6;hpb=51074ee948701b58ba17b259181560adfa5ea5eb;p=nhentai.git diff --git a/nhentai/command.py b/nhentai/command.py index b44f9d2..bc987fb 100644 --- a/nhentai/command.py +++ b/nhentai/command.py @@ -1,8 +1,7 @@ #!/usr/bin/env python2.7 # coding: utf-8 -from __future__ import unicode_literals, print_function -import json -import os + +import sys import signal import platform import time @@ -20,6 +19,11 @@ from nhentai.utils import generate_html, generate_cbz, generate_main_html, gener def main(): banner() + + if sys.version_info < (3, 0, 0): + logger.error('nhentai now only support Python 3.x') + exit(1) + options = cmd_parser() logger.info('Using mirror: {0}'.format(BASE_URL)) @@ -27,8 +31,10 @@ def main(): if constant.CONFIG['proxy']['http']: logger.info('Using proxy: {0}'.format(constant.CONFIG['proxy']['http'])) - if constant.CONFIG['template']: - logger.info('Using viewer template "{}"'.format(constant.CONFIG['template'])) + if not constant.CONFIG['template']: + constant.CONFIG['template'] = 'default' + + logger.info('Using viewer template "{}"'.format(constant.CONFIG['template'])) # check your cookie check_cookie() @@ -59,11 +65,11 @@ def main(): if options.is_download and doujinshis: doujinshi_ids = [i['id'] for i in doujinshis] - if options.is_save_download_history: - with DB() as db: - data = map(int, db.get_all()) + if options.is_save_download_history: + with DB() as db: + data = map(int, db.get_all()) - doujinshi_ids = list(set(doujinshi_ids) - set(data)) + doujinshi_ids = list(set(map(int, doujinshi_ids)) - set(data)) if doujinshi_ids: for i, id_ in enumerate(doujinshi_ids): @@ -111,5 +117,6 @@ def main(): signal.signal(signal.SIGINT, signal_handler) + if __name__ == '__main__': main()