forked from palmersndrsn/crestronEDK-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NVX_stream_config.py
129 lines (83 loc) · 3.77 KB
/
NVX_stream_config.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
# NOTE: this depends on 1.) chrome 2.) chromedriver being installed systemwide.
# both are installed systemwide by brew. versions are just based on w/e brew
# decides to install. there is likely a better way to localize this, but for
# now, this works.
chrome_binary_location = "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
options = webdriver.ChromeOptions()
options.binary_location = chrome_binary_location
# options.add_argument("headless")
options.add_argument("disable-gpu")
options.add_argument("--start-maximized")
driver = webdriver.Chrome(options=options)
driver.get("http://10.5.20.225")
try:
print("configuring NVX")
# login to stream
def login_to_stream():
driver.implicitly_wait(40)
# username field
username_field = driver.find_element_by_css_selector("#cred_userid_inputtext")
username_field.send_keys("admin")
# password field
passwd_field = driver.find_element_by_css_selector("#cred_password_inputtext")
passwd_field.send_keys("admin")
# login click
prompt_login_button = driver.find_element_by_css_selector("#credentials > button")
prompt_login_button.click()
print("login complete")
# select stream
print("waiting for login")
time.sleep(30)
# select stream page
driver.implicitly_wait(40)
stream_page_button = driver.find_element_by_css_selector("#hyd-groups-tree-navigation > group-tree > p-tree > div > ul > p-treenode:nth-child(2) > li > div > span.ui-treenode-label.ui-corner-all > span > div > div")
stream_page_button.click()
print("on stream page")
login_to_stream()
# add if for if TX or RX
time.sleep(4)
# DELETE
tx = False
rx = True
if tx:
driver.implicitly_wait(5)
stream_mode_dropdown = driver.find_element_by_css_selector("#cmb_stream_DeviceMode")
stream_mode_dropdown.click()
driver.implicitly_wait(5)
tramsmitter_button = driver.find_element_by_css_selector("#cmb_stream_DeviceMode > div > div.ui-dropdown-panel.ui-widget-content.ui-corner-all.ui-helper-hidden.ui-shadow > div > ul > li:nth-child(2)")
tramsmitter_button.click()
print("changed to transmitter")
driver.implicitly_wait(5)
reboot_button = driver.find_element_by_css_selector("#btn_DeviceManagement_okButtonLabel")
reboot_button.click()
print("rebooting please wait")
time.sleep(200)
login_to_stream()
time.sleep(10)
multicast_address_field = driver.find_element_by_css_selector("#txt_stream_MulticastAddressInput")
multicast_address_field.send_keys("239.255.254.86")
print("set multicast address TX")
time.sleep(2)
stream_page_background = driver.find_element_by_css_selector("#val_stream_StreamLocation")
stream_page_background.click()
time.sleep(3)
pass
elif rx:
multicast_address_field = driver.find_element_by_css_selector("#txt_stream_StreamLocationInput")
multicast_address_field.send_keys("rtsp://10.5.20.222:554/live.sdp")
print("set multicast address RX")
time.sleep(2)
stream_page_background = driver.find_element_by_css_selector("#val_stream_MulticastAddress")
stream_page_background.click()
time.sleep(3)
# add switch to extract for audio and set source.
pass
finally:
driver.quit()
pass