summaryrefslogtreecommitdiffstats
path: root/mplayer
blob: 88d0da2c4ffa7756e7735c1dbdba4bb365fbbe44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/zsh
zmodload zsh/zutil
start=${START:-0}
source ~/bin/mplayer.fns

if [[ $0 == *mplayeraux ]];then
    AUX_INVO=1
    aux [email protected]
    exit $?
fi
if [[ !  -e $MPSOCKET ]] ;then
    firstime=1
    mkfifo $MPSOCKET
    ln -sf $MPSOCKET /tmp/mplayer.fif
    notify-send "Mplayer" "mplayer starting up....."
fi
#if [[ ! -t 0 ]];then
#    stdin=1
#fi

[[ $start == 1 ]] && stdin=0
exec &>>|/tmp/mplayer.log
pwdir=$(pwd)


pushd -q $HOME
if [[ $stdin == 1 ]];then
    fd=$(readlink -f /dev/stdin)
    exec 3<&0
    exec 0</dev/tty
    ${=LOCK}/mplayer.$randnum /usr/bin/mplayer -$vo_map[$fixedvo] -msglevel all=4 -slave -idle -input file=$MPSOCKET -input conf=$HOME/.mplayer/input.conf.mine  &!
else
    ${=LOCK}/mplayer.$randnum /usr/bin/mplayer -$vo_map[$fixedvo] -msglevel all=4 -slave -idle -input file=$MPSOCKET -input conf=$HOME/.mplayer/input.conf.mine  &!
    #${=LOCK}/mplayer.$randnum $HOME/Arch/Hub/mplayer2/mplayer -$vo_map[$fixedvo] -msglevel all=4 -slave -idle -input file=$MPSOCKET -input conf=$HOME/.mplayer/input.conf.mine  &!
    #${=LOCK}/mplayer.$randnum $HOME/Arch/Hub/mplayer2/mplayer -noconfig user -$vo_map[$fixedvo] -msglevel all=4 -slave -idle -input file=$MPSOCKET -input conf=$HOME/.mplayer/input.conf.mine  &!
fi
popd -q
[[ $start == 1 ]] && exit

parse [email protected]
FILE=$retval
preplay

[[ $firstime == 1 ]] && sleep 1

if [[ $stdin == 1 ]];then
    pecho "loadfile $fd " /tmp/mplayer.fif
    exit 11
else
    pecho "loadfile \"$FILE\" 2"  $MPSOCKET
fi

(
check_status

# Queue or play
if [[ $? == 1 ]];then
    notify-send "Player" "^i(/home/raghavendra/.notify-icons/mplayer.xpm) ^fg(red)FILE:^fg() $FILE:t queued"
else
    if [[ ! $POSITION == 0* ]];then
        sleep 1
        pecho "set_property time_pos $POSITION"  $MPSOCKET
        notify-send "Player" "^i(/home/raghavendra/.notify-icons/mplayer.xpm) ^fg(red)FILE:^fg() $FILE:t ^fg(green)POSITION:^fg() ${POSITION:-0:0}"
    else
        notify-send "Player" "^i(/home/raghavendra/.notify-icons/mplayer.xpm) ^fg(red)FILE:^fg() $FILE:t"
    fi
fi
/bin/echo "mplayer \"$FILE\"" >>| ~/.current
) &!
# vim: set foldmethod=marker: