def __init__(self, startVol=70): self.vlc = VLCClient("::1") # VLC connection for monitoring thread to avoid multiple telnet send commands # at the same time, i.e. when user is changing songs while check is in # progress. This scenario would cause a telnet timeout and crash self.vlc_monitoring = VLCClient("::1") self.current_playing = "" self.current_playing_from_vlc = "" self.current_vlc_playlist_id = 4 - 1 # The Vlc playlist index starts with 4 self.vlc_is_playing = "" self.next_playing = [] self.thread_stopper = False try: self.vlc.connect( ) # Esthablishing a connection via VLCClient class self.vlc_monitoring.connect( ) # Seperate connection for monitoring thread logger.disp_log_entry("info", "connected to vlc media player") except ConnectionRefusedError: # TODO: Further error handling logger.error("Connection to vlc could not be established!") self.volume(startVol) # Setting start value from config self.start_monitoring_thread()
def __init__(self): self.mode = -1 self.mode_avail_list = [ CONST.MODE_VIDEO, CONST.MODE_HANGOUT, CONST.MODE_1ST_FLOOR ] #, CONST.MODE_3RD_FLOOR, CONST.MODE_KITCHEN] self.vlc_window_name = r".*VLC" try: pywinauto.findwindows.find_window(title_re=self.vlc_window_name) self.vlc = VLCClient("::1") self.vlc.connect() self.vlc_status = self.vlc.status().split("\r\n")[-1] except Exception as e: print "Please start VLC player: vlc Desktop\playlist.xspf --loop --extraintf telnet --telnet-password admin" print "Remember to add vlc to PATH and Configure the hotkeys in the preference" exit() self.hangout_window_name = r"Google Hangout" try: pywinauto.findwindows.find_window( title_re=self.hangout_window_name) except Exception as e: print "Please start Hangout app" exit() self.web_window_name = r"Brightness of 1st-Floor" try: pywinauto.findwindows.find_window(title_re=self.web_window_name) except Exception as e: print "Please start Webpage" exit() self.update_time = time.time()
def __init__(self, active_video_file, idle_video_file): self.active_video_file = active_video_file self.idle_video_file = idle_video_file self.vlc = VLCClient("::1") subprocess.Popen("vlc --intf telnet --telnet-pass admin", shell=True, stdout=subprocess.PIPE) time.sleep(2) self.vlc.connect()
import time from vlcclient import VLCClient stream = "http://nhkwglobal-i.akamaihd.net/hls/live/222714/nhkwglobal/index_1180.m3u8" sleepdelay = 3 vlc = VLCClient("::1") vlc.connect() print "connected to vlc ", vlc.server_version print "adding stream", stream print vlc.add(stream) print "sleeping", sleepdelay time.sleep(sleepdelay) print "snapshot 1" print vlc.snapshot() print "sleeping", sleepdelay time.sleep(sleepdelay) print "snapshot 2" print vlc.snapshot() print "sleeping", sleepdelay time.sleep(sleepdelay) print "snapshot 3"