-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRaspberryClientHDMI.py
More file actions
35 lines (30 loc) · 956 Bytes
/
RaspberryClientHDMI.py
File metadata and controls
35 lines (30 loc) · 956 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
27
28
29
30
31
32
33
34
35
import sys
import socket
import os
import threading
serverAddr = 'mkarier-desktop.local'
#options = ' --win 0,0,800,480 --display 4 '
options = ' -o hdmi --win 0,0,1920,1080 --display 2 '
def main():
socketClient = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
chatPort = 9000
print ("Trying to connect to server")
socketClient.connect((serverAddr, chatPort))
print ("formed a connection with server")
#socketClient.send(raspberry)
videoPort = socketClient.recv(1024)
print ("Video port: " + videoPort)
systemCommand = 'omxplayer' + options +'udp://' + serverAddr + ':' + videoPort
numberOfVideos = socketClient.recv(1024).decode()
try:
for videoIndex in range(int(numberOfVideos)):
socketClient.send('start'.encode)
os.system(systemCommand)
socketClient.send('quit'.encode)
socketClient.close()
except KeyboardInterrupt:
socketClient.send('quit')
socketClient.close()
sys.exit()
if __name__ == "__main__":
main()