m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/mpvl
diff options
context:
space:
mode:
Diffstat (limited to 'mpvl')
-rwxr-xr-xmpvl22
1 files changed, 22 insertions, 0 deletions
diff --git a/mpvl b/mpvl
new file mode 100755
index 0000000..184dafd
--- /dev/null
+++ b/mpvl
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# Starts a media file in mpv looped.
+# USAGE: mpvl [<start> <stop>] <file>
+# If only `file` given, loops the whole file.
+# If `start` and `stop` given, loops the section between those timecodes.
+
+FLAGS=
+FILE=
+
+if [ "$#" -eq 3 ]; then
+ FLAGS="--start=$1 --ab-loop-a=$1 --ab-loop-b=$2"
+ FILE=$3
+elif [ "$#" -eq 1 ]; then
+ FLAGS=--loop
+ FILE=$1
+else
+ echo "USAGE: mpvl [<start> <stop>] <file>";
+ exit 1;
+fi
+
+mpv $FLAGS "$FILE"