aboutsummaryrefslogtreecommitdiff
path: root/mpeg_play
diff options
context:
space:
mode:
authorPhilip Wittamore <philip@wittamore.com>2025-09-23 07:58:56 +0200
committerPhilip Wittamore <philip@wittamore.com>2025-09-23 07:58:56 +0200
commitf9cc3d6e67278db14a49fc2a29db012a01389df5 (patch)
treef7cff0cd76d6ba396c483a0dd781ffd07b688e6c /mpeg_play
parent3ef768029ffc56f1193f4ea1925ef68807f8ceea (diff)
downloadscripts-f9cc3d6e67278db14a49fc2a29db012a01389df5.tar.gz
scripts-f9cc3d6e67278db14a49fc2a29db012a01389df5.tar.bz2
scripts-f9cc3d6e67278db14a49fc2a29db012a01389df5.zip
update
Diffstat (limited to 'mpeg_play')
-rwxr-xr-xmpeg_play26
1 files changed, 18 insertions, 8 deletions
diff --git a/mpeg_play b/mpeg_play
index c54643b..da4dc9a 100755
--- a/mpeg_play
+++ b/mpeg_play
@@ -2,15 +2,25 @@
# necessary for Lynx browser video files
# chmod +x and place in your PATH
-dunstify -t 3000 -a "Video" -u low -i "media-playback-start-symbolic" -h string:x-dunst-stack-tag:$msgTag "MPV Launching" >/dev/null 2>&1 &
+# mpv can sometimes take a few seconds to open when streaming
+# so I use notification that it's happening
-if [ $(grep -c "EXT3MU" $1) -eq 1 ]; then
- # this is a playlist
- mpv --geometry=1068x600 --title="Mpv" --ontop --idle=yes --force-window=yes --playlist=$1 >/dev/null 2>&1 &
-else
- mpv --geometry=1068x600 --title="Mpv" --ontop --idle=yes --force-window=yes $1 >/dev/null 2>&1 &
-fi
+msgtag="Media"
+dunstify -t 2000 -a "Video" -u low -i "media-playback-start-symbolic" \
+ -h string:x-dunst-stack-tag:$msgtag "MPV Launching" &
-exit 0
+# 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