This repository has been archived by the owner on May 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathFAIDK.py
50 lines (43 loc) · 1.5 KB
/
FAIDK.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import argparse
import logging
import os
import time
import click
import safe_IO
from Article import Article
try:
os.mkdir('./log/')
except Exception as e:
pass
logging.config.fileConfig('./logging.config')
logger = logging.getLogger('FAIDK')
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--mode', '-m', help='work mode\n 1 for build mode \n 2 for find mode \n default None', default=None)
parser.add_argument(
'--config', help='use local config', dest='config', default=True, action='store_true')
parser.add_argument('--no-config', help='not use local config',
dest='config', action='store_false')
parser.add_argument('--file','-f', help="not working")
parser.add_argument('--floder','-F', help='not working')
args = parser.parse_args()
CONFIG = safe_IO.load_json('./FAIDK.config')
FLAG = safe_IO.check_flag(args.mode)
if FLAG == 'q':
logger.info('user exit')
return
safe_IO.check_output_file(CONFIG['MAIN_PATH'] + CONFIG['NEW_WORDS_PATH'])
# NEM_WORDS_ALL = set()
# if args.file is not None:
# FILE_NAMES = [args.file]
# logger.info('using args.file: '+','.join(FILE_NAMES))
# else:
FILE_NAMES = safe_IO.get_name(
CONFIG['MAIN_PATH'] + CONFIG['ARTICLES_PATH'])
safe_IO.try_make_dir(CONFIG['MAIN_PATH'] + CONFIG['OLD_ARTICLES_PATH'])
for file in FILE_NAMES:
# article =
Article(CONFIG, file, FLAG)
if __name__ == '__main__':
main()