m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/mpvl
blob: 184dafd8b907026af793d09c46ad8584561a86ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"