summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xplay.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/play.py b/play.py
index 99b8304..d21ff18 100755
--- a/play.py
+++ b/play.py
@@ -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