diff --git a/halloween/halloween.py b/halloween/halloween.py index df9b6d4..fccc92b 100644 --- a/halloween/halloween.py +++ b/halloween/halloween.py @@ -27,7 +27,9 @@ class Player(object): _instance = None # we need a subprocess object for the first poll() so we just let the video run once - vid_process = subprocess.Popen(["mplayer","/home/tilman/Videos/halloween-04-friendly_ghost_4.mp4"], stdout=subprocess.PIPE) + vid_process = subprocess.Popen(["ls","-l"], stdout=subprocess.PIPE) + last_no1 = 0 + last_no2 = 0 def __new__(cls): if cls._instance is None: @@ -39,8 +41,6 @@ class Player(object): class MyServer(BaseHTTPRequestHandler): player = Player() - last_no = 0 - last_no2 = 0 def do_GET(self): self.send_response(200) @@ -52,21 +52,21 @@ class MyServer(BaseHTTPRequestHandler): if (self.player.vid_process.poll() is not None): rnd_no = random.randint(0,6) - while (rnd_no == self.last_no or rnd_no == self.last_no2): + while (rnd_no == self.player.last_no1 or rnd_no == self.player.last_no2): rnd_no = random.randint(0,6) - self.last_no2 = self.last_no - self.last_no = rnd_no + self.player.last_no2 = self.player.last_no1 + self.player.last_no1 = rnd_no link = videos[rnd_no] print('START ' + link + '\n') self.wfile.write(bytes("START " + videos[rnd_no], "utf-8")) cmd = "mplayer -xineramascreen 2 -fs %s"%(link) - self.player.vid_process = subprocess.Popen(["mplayer",link], stdout=subprocess.PIPE) + self.player.vid_process = subprocess.Popen(["mplayer","-xineramascreen", "2", "-fs", link], stdout=subprocess.PIPE) else: print('RUNNING\n') - self.wfile.write(bytes("RUNNING " + videos[self.last_no], "utf-8")) + self.wfile.write(bytes("RUNNING " + videos[self.player.last_no1], "utf-8")) self.wfile.write(bytes("

", "utf-8")) self.wfile.write(bytes("", "utf-8"))