summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--play15
1 files changed, 11 insertions, 4 deletions
diff --git a/play b/play
index e17048c..7f66294 100644
--- a/play
+++ b/play
@@ -64,7 +64,7 @@ except:
# ------------------------------------------
XTERM = re.search("rxvt|xterm", os.environ["TERM"])
-CONTROL_FIFO = "/var/tmp/play_control"
+CONTROL_FIFO = "%s/play-control-%s" % (os.environ.get("TMPDIR", "/tmp"), os.environ["USER"])
# ------------------------------------------
def which(program):
@@ -1361,8 +1361,6 @@ class Timeout:
# ------------------------------------------
class FIFOControl:
def __init__(self):
- try: self.fd = open(CONTROL_FIFO, "rb+", 0)
- except: self.fd = None
self.commands = {
"pause" : [app.toggle_pause, []],
"next" : [app.next_song, []],
@@ -1377,6 +1375,14 @@ class FIFOControl:
"empty" : [app.win_playlist.command_delete_all, []],
"quit" : [app.quit, []]
}
+ self.fd = None
+ try:
+ if os.path.exists(CONTROL_FIFO):
+ os.unlink(CONTROL_FIFO)
+ os.mkfifo(CONTROL_FIFO, 0600)
+ self.fd = open(CONTROL_FIFO, "rb+", 0)
+ except IOError:
+ return
def handle_command(self):
argv = self.fd.readline().strip().split(" ", 1)
@@ -1708,4 +1714,5 @@ for rc in [os.path.expanduser("~/.playrc"), "/etc/playrc"]:
except IOError: pass
# ------------------------------------------
-if __name__ == "__main__": main()
+if __name__ == "__main__":
+ main()