m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/mpvl
diff options
context:
space:
mode:
authorMarcin Chrzanowski <m@m-chrzan.xyz>2023-03-26 13:49:36 +0200
committerMarcin Chrzanowski <m@m-chrzan.xyz>2023-03-26 13:49:36 +0200
commit355d4996dc32988aabe000fbfaa1a9bbdd9ec585 (patch)
treef4af7671f8ed4fd9138d5fe5a723b64046de456f /mpvl
parent2a5b14312110abee3a70a2f59a8deacd6929031a (diff)
Add initial scripts
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"