-
Notifications
You must be signed in to change notification settings - Fork 0
/
imu_to_netx.py
37 lines (24 loc) · 1006 Bytes
/
imu_to_netx.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
'''Copy and Rename Multimedia files for EMu-to-Netx batches'''
import os, re
from imu_api import imu_api
from dotenv import dotenv_values
config = dotenv_values('.env')
if not config: raise Exception("Couldn't find .env file")
try:
session = imu_api.create_imu_session(
host = config['HOST'],
port = config['PORT'],
username = config['LOGIN_USERNAME'],
password = config['LOGIN_PASSWORD']
)
except Exception as e: print(f'Error connecting to EMu: {e}')
# Get a batch of files (including original irn-based filepath)
# QUESTION: should script get batch as CSV (initial import) or IMu query (periodic updates)?
# For each file in batch:
# 1. Copy file to NetX folder, based on [EMu fields]
# 2. Check for filename prefix:
#
# IF filename-prefix == [irn]_emu: pass
# ELIF filename-prefix == [id]_netx:
# check if dato has a matching record? (or just pass?)
# ELSE: prepend '[irn]_emu' to filename