-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatem_namer.py
More file actions
executable file
·47 lines (35 loc) · 1.16 KB
/
Copy pathatem_namer.py
File metadata and controls
executable file
·47 lines (35 loc) · 1.16 KB
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
#!/usr/bin/env/python3
"""atem_namer.py - Sets the names of the outputs in ATEM."""
import argparse
import PyATEMMax
def read_to_array(file):
array = []
with open(file) as f:
for line in f:
array.append(line.rstrip())
return array
MAXTRIES = 8
parser = argparse.ArgumentParser()
parser.add_argument('ip', help='switcher IP address')
args = parser.parse_args()
switcher = PyATEMMax.ATEMMax()
switcher.connect(args.ip)
AUXES = read_to_array("outputs.txt")
INPUTS = read_to_array("inputs.txt")
for i in range(MAXTRIES):
if switcher.waitForConnection(infinite=False):
counter = 0
print("Connected on attempt {}.".format(i))
for inp in INPUTS:
counter = counter + 1
switcher.setInputLongName(counter, inp.split('|')[0])
switcher.setInputShortName(counter, inp.split('|')[1])
counter = 8000
for aux in AUXES:
counter = counter + 1
switcher.setInputLongName(counter, aux.split('|')[0])
switcher.setInputShortName(counter, aux.split('|')[1])
break
else:
print("Failed attempt {}.".format(i))
switcher.disconnect()