#!/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
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))
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()
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):
signal.signal(signal.SIGINT, signal_handler)
+
if __name__ == '__main__':
main()