-
Notifications
You must be signed in to change notification settings - Fork 0
/
hyperdeck.py
65 lines (53 loc) · 1.75 KB
/
hyperdeck.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Script to start and stop recording on multiple blackmagic hyperdecks.
from telnetlib import Telnet
import sys
TCP_PORT = 9993
# Dictonary containing the hyperdecks
hyperdecks = {
"Hyperdeck1" : "10.1.1.1",
"Hyperdeck2" : "10.1.1.2",
"Hyperdeck3" : "10.1.1.3",
"Hyperdeck4" : "10.1.1.4",
"Hyperdeck5" : "10.1.1.5",
"Hyperdeck6" : "10.1.1.6",
"Hyperdeck7" : "10.1.1.7",
"Hyperdeck8" : "10.1.1.8",
"Hyperdeck9" : "10.1.1.9",
}
def record_start():
"""Telnet to the decks and start recording"""
status = ""
for deckname, ipaddress in hyperdecks.items():
tn = Telnet(ipaddress, TCP_PORT)
tn.write(b'record' + b'\r\n')
tn.write(b'quit' + b'\r\n')
status += tn.read_all().decode('ascii')
print(status)
def record_stop():
"""Telnet to the decks and stop recording"""
status = ""
for deckname, ipaddress in hyperdecks.items():
tn = Telnet(ipaddress, TCP_PORT)
tn.write(b'stop' + b'\r\n')
tn.write(b'quit' + b'\r\n')
status += tn.read_all().decode('ascii')
print(status)
"""Enables remote and sets the input"""
def remote_enable():
status = ""
for deckname, ipaddress in hyperdecks.items():
tn = Telnet(ipaddress, TCP_PORT)
tn.write(b'remote: enable: true' + b'\r\n')
tn.write(b'configuration: video input: SDI' + b'\r\n')
tn.write(b'quit' + b'\r\n')
status += tn.read_all().decode('ascii')
print(status)
"""Checks for input from the cli"""
if "record_start" in sys.argv[1:]:
record_start()
elif "record_stop" in sys.argv[1:]:
record_stop()
elif "remote_enable" in sys.argv[1:]:
remote_enable()
else:
print("Please use record_start,record_stop, or remote_enable")