-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
26 lines (20 loc) · 863 Bytes
/
main.py
File metadata and controls
26 lines (20 loc) · 863 Bytes
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
import json
import os
import sys
from data_indexer import imap_data_processor
from data_indexer.psp_data_processor import PspDataProcessor
CURRENT_VERSION = "v2"
def main():
args = sys.argv
if args[1] == 'imap':
descriptor = os.environ.get('INDEX_FILE_DESCRIPTOR')
file_name = f'index_imap{descriptor}.{CURRENT_VERSION}.json' if descriptor is not None else f"index_imap.{CURRENT_VERSION}.json"
with open(file_name, 'w') as file_handler:
json.dump(imap_data_processor.get_metadata_index(), file_handler, indent=2)
elif args[1] == 'psp':
with open(f'index_psp.{CURRENT_VERSION}.json', 'w') as file_handler:
json.dump(PspDataProcessor.get_metadata_index(), file_handler, indent=2)
else:
raise NotImplementedError("Unknown indexer requested")
if __name__ == "__main__":
main()