-
Notifications
You must be signed in to change notification settings - Fork 10
/
hyperbot-data-manager.py
executable file
·48 lines (34 loc) · 1.25 KB
/
hyperbot-data-manager.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
#!/usr/bin/env python
import os
import shutil
import argparse
import json
import mimetypes
import dsf
def options():
# Create argparse parser object
parser = argparse.ArgumentParser(description="Data management program for the hyperbot.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
# Add argument for an input configuration file
parser.add_argument("-c", "--config", help="Configuration file (JSON format).", required=True)
# Parse command-line arguments
args = parser.parse_args()
# Return the argparse object
return args
def main():
# Parse command-line arguments
args = options()
# Load the JSON configuration data
config = dsf.data.utils.load_config(json_file=args.config)
# Validate configuration data
dsf.data.hyperbot.validate_config(config=config)
# Find scan directories
scans = dsf.data.hyperbot.find_scans(config=config)
# Initialize scan directories if needed
tasks = dsf.data.hyperbot.init_scan_dirs(scans=scans, config=config)
# Copy files
dsf.data.hyperbot.move_scan_files(tasks=tasks)
# Delete source files
dsf.data.hyperbot.delete_source_scan_files(scans=scans, config=config)
if __name__ == '__main__':
main()