diff options
Diffstat (limited to 'play.py')
-rwxr-xr-x | play.py | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -1309,14 +1309,18 @@ class TimeOffsetPlayerMplayer(Player): re_progress = re.compile("^A:.*?(\d+)\.\d \([^)]+\) of (\d+)\.\d") def play(self): - if os.path.exists(CONTROL_FIFO + "-mplayer"): - os.unlink(CONTROL_FIFO + "-mplayer") - os.mkfifo(CONTROL_FIFO + "-mplayer", 0600) - Player.play(self) - fifo = open(CONTROL_FIFO + "-mplayer", 'w') - fifo.write("seek %d\n" % self.offset) - fifo.flush() - fifo.close() + self.fd = None + try: + if os.path.exists(CONTROL_FIFO + "-mplayer"): + os.unlink(CONTROL_FIFO + "-mplayer") + os.mkfifo(CONTROL_FIFO + "-mplayer", 0600) + Player.play(self) + self.fd = open(CONTROL_FIFO + "-mplayer", "w") + self.fd.write("seek %d\n" % self.offset) + self.fd.flush() + self.fd.close() + except IOError: + return def parse_buf(self): match = self.re_progress.search(self.buf) @@ -1480,7 +1484,10 @@ class Application: tty and tty.tcsetattr(sys.stdin.fileno(), tty.TCSADRAIN, self.tcattr) print try: - if os.path.exists(CONTROL_FIFO): os.unlink(CONTROL_FIFO) + if os.path.exists(CONTROL_FIFO): + os.unlink(CONTROL_FIFO) + if os.path.exists(CONTROL_FIFO + "-mplayer"): + os.unlink(CONTROL_FIFO + "-mplayer") except IOError: pass |