aboutsummaryrefslogtreecommitdiff
path: root/mpeg_play
blob: da4dc9a8e599c38d09e9393e926488b16558c3e4 (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
#!/usr/bin/env bash
# necessary for Lynx browser video files
# chmod +x and place in your PATH

# mpv can sometimes take a few seconds to open when streaming
# so I use notification that it's happening

msgtag="Media"
dunstify -t 2000 -a "Video" -u low -i "media-playback-start-symbolic" \
  -h string:x-dunst-stack-tag:$msgtag "MPV Launching" &

# detect if playlist
# Lynx uses an anonymous file in /tmp, so we can only
# detect a file type by it's contents, not it's extension

if [ "$(grep -c "EXT3MU" "$1")" -eq 1 ]; then
  # this is a playlist
  # I use dwm, the mpv options used here make it compatible
  mpv --geometry=1068x600 --ontop --idle=yes --force-window=yes\
    --playlist="$1" >/dev/null 2>&1 &
else
  mpv --geometry=1068x600 --ontop --idle=yes --force-window=yes\
    "$1" >/dev/null 2>&1 &
fi

exit 0