Issue
I try to write a script where I run a .mp4 file until it ends and when it ends it has to start again. On top if the exist file has change it starts the new file which has changed.
Can someone help me on this.
I have this :
#!/bin/bash
while true; do
inotifywait -e modify test.mp4
mplayer -loop 0 test.mp4
done
The problem on this code is that is starts if the file has changed but only one time until it changes again.
Solution
i don't think you can do this with xdg-open
.
xdg-open
is an abstraction that hides the actual program that is used to open the given URL/file, based on it's URI-type resp MIME-type.
the actual programs that are used to open can decide themselves, whether they return immediately or wait until the file has been consumed. there's no specification how to signal back that the consumation has stopped, so you cannot possibly know it.
so the solution is to use a specific program to open your MP4-file (e.g. ffplay
, or mplayer
) where it this is defined, and then depend on that program.
e.g.
ffplay -loop 0 test.mp4
mplayer -loop 0 test.mp4
(in both cases -loop 0
means ∞ loops)
Answered By - umläute