2018-05-04 11:53:29 +00:00
|
|
|
#!/usr/bin/env python3
|
2016-02-04 14:22:51 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2023-05-22 13:31:48 +00:00
|
|
|
"""
|
|
|
|
DIR/File Importer Helper
|
|
|
|
================
|
2016-02-04 14:22:51 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
Import Content
|
2017-08-22 13:17:49 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
"""
|
2018-09-19 11:38:31 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
import argparse
|
|
|
|
import os
|
|
|
|
import sys
|
2018-04-16 12:50:04 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
sys.path.append(os.environ['AIL_BIN'])
|
|
|
|
##################################
|
|
|
|
# Import Project packages
|
|
|
|
##################################
|
|
|
|
from importer import FileImporter
|
2017-08-22 13:17:49 +00:00
|
|
|
|
2016-02-04 14:22:51 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-05-22 13:31:48 +00:00
|
|
|
parser = argparse.ArgumentParser(description='Directory or file importer')
|
|
|
|
parser.add_argument('-d', '--directory', type=str, help='Root directory to import')
|
|
|
|
parser.add_argument('-f', '--file', type=str, help='File to import')
|
2016-02-04 14:22:51 +00:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
if not args.directory and not args.file:
|
|
|
|
parser.print_help()
|
|
|
|
sys.exit(0)
|
2020-02-25 10:34:55 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
if args.directory:
|
|
|
|
dir_path = args.directory
|
|
|
|
dir_importer = FileImporter.DirImporter()
|
|
|
|
dir_importer.importer(dir_path)
|
2018-09-19 11:38:31 +00:00
|
|
|
|
2023-05-22 13:31:48 +00:00
|
|
|
if args.file:
|
|
|
|
file_path = args.file
|
|
|
|
file_importer = FileImporter.FileImporter()
|
|
|
|
file_importer.importer(file_path)
|