Advertisement
Guest User

Uxbridge College - Smart TVs automation

a guest
Jun 21st, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1. import paramiko
  2. import time
  3.  
  4. strComputers = ['10.2.2.35']
  5. strUser = 'root'
  6. strPwd = 'openelec'
  7.  
  8. youtubelink = raw_input('Enter a youtube ID: ')
  9. convert = 'chromium --start-fullscreen https://www.youtube.com/embed/' + youtubelink + '?autoplay=1 & \n'
  10. # killall chromium &&
  11. # hosts = ['10.2.2.35,root,openelec']
  12. # connections = []
  13.  
  14. """Connect to all hosts in the hosts list"""
  15. for host in strComputers:
  16.     client = paramiko.SSHClient()
  17.     client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  18.     client.connect(strComputers[0], username=strUser, password=strPwd)
  19.     # connections.append(client)
  20.     channel = client.invoke_shell()
  21.     channel.send(convert)
  22.     time.sleep(3)
  23.     client.close()
  24.     print('Connection closed.')
  25.  
  26. # client = paramiko.SSHClient()
  27. # client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  28. # client.connect(hostname=strComputer, username=strUser, password=strPwd)
  29.  
  30. # output = channel.recv(2024)
  31. # print(output)
  32.  
  33. # Close the connection
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement