Closed shanemikel closed 9 years ago
What do you mean "before you're done with it"? The m3u
file is given to the command you configured, and deleted once that command has returned. There is no reason to wait 1 second before removing it.
Could you explain your use case? And post your configuration??
I'd guess @shanemikel is using a command that forks into the background and returns immediately. If that's the case, I'd recommend either looking for a synchronous version of the command or using a tiny wrapper script that adds the sleep you need (if sleeping seems like the only option):
#!/bin/sh
my_player $@
sleep 2
@shanemikel How does that work for you? It's been a month so I'm closing the issue, but please comment if you're not satisfied.
mocp -scx 2>/dev/null 1>&2 gnome-terminal --window-with-profile=Translucent -x \ mocp -T transparent-background "$1" 2>/dev/null 1>&2 &
This is what my script looks like, I've tried to write it without killing the mocp server at the beginning, as well as with and without sleeping. The only fixes I could come up with was adding a short sleep to the beetslib/play.py right before removing the tmp playlist, or copying the playlist at the beginning of my script and removing it at the end on my own.
I figured the change to the play plugin might help others using mpd or other audio servers with beets. In any case, it doesn't do any harm.
Yeah—since you have a script doing the work already, adding the sleep in the script makes a lot of sense to me.
Sleeping in the script doesn't work, I have to cp the playlist
Odd—it doesn't work to start the player, background it, and then sleep? I don't quite see how putting a sleep in the plugin would be any different from that.
Well anyway, heres my workaround
#!/bin/bash
newtmp=${1%.m3u}.cp.m3u
cp $1 $newtmp
mocp -scx 2>/dev/null 1>&2
sleep 0.5s
(sleep 1 && rm -f $newtmp) &
xfce4-terminal -x mocp -T transparent-background $newtmp 2>/dev/null 1>&2 &
It's deleting the playlist before i'm done with it.
Anyway, If y'all can add a sleep for 1 second or so right before the tmp .m3u file is removed that'd be cool.