Démon mplayer, commande à distance pour la lecture, filtrage de l'info "titre".
This commit is contained in:
parent
da3c03f853
commit
353058148c
7
config
Normal file
7
config
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
V="-8"
|
||||
MP_CONTROL="/dev/shm/mplayer-contol$V"
|
||||
MP_OUTPUT="/dev/shm/mplayer-output$V"
|
||||
MP_PID="/dev/shm/mplayer-pid$V"
|
||||
MP_ERROR="/tmp/mplayer-errors.log"
|
21
mplayerd
Executable file
21
mplayerd
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")/config"
|
||||
|
||||
if [ "$1" == "stop" ]; then
|
||||
if [ -e /dev/shm/mplayer-pid ]; then
|
||||
if ! kill "$(<"$MP_PID")"; then
|
||||
echo "Failed to kill mplayer"
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
echo "Can't find $MP_PID ."
|
||||
exit 3
|
||||
fi
|
||||
else
|
||||
[ -p "$MP_CONTROL" ] || mkfifo "$MP_CONTROL"
|
||||
[ -p "$MP_OUTPUT" ] || mkfifo "$MP_OUTPUT"
|
||||
|
||||
mplayer -quiet -slave -input file="$MP_CONTROL" -idle > "$MP_OUTPUT" 2> "$MP_ERROR" &
|
||||
echo "$!" > /dev/shm/mplayer-pid
|
||||
fi
|
28
mplayerd-getinfo
Executable file
28
mplayerd-getinfo
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")/config"
|
||||
|
||||
q="'"
|
||||
|
||||
old_titre=""
|
||||
|
||||
cat "$MP_OUTPUT" \
|
||||
| while read ligne; do
|
||||
# TODO : utiliser grep n'est pas du tout efficace !
|
||||
if grep -q "^[a-zA-Z_][a-zA-Z0-9_]*='"<<<"$ligne"; then
|
||||
cle="${ligne%%=$q*}"
|
||||
valeur="${ligne#*=$q}"
|
||||
valeur="${valeur%$q}"
|
||||
case "$cle" in
|
||||
ANS_META_TITLE)
|
||||
old_titre="$titre"
|
||||
titre="$valeur"
|
||||
if [ "$titre" != "$old_titre" ]; then
|
||||
echo "TITRE = $titre"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
else
|
||||
(echo "get_meta_title" > "$MP_CONTROL") &
|
||||
fi
|
||||
done
|
5
mplayerd-play
Executable file
5
mplayerd-play
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
source "$(dirname "$0")/config"
|
||||
|
||||
echo "loadfile '$(readlink -f "$1")' 0" > "$MP_CONTROL"
|
Loading…
Reference in New Issue
Block a user