X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/db79279a4c7f11dacfa3a13948f5fda5f7489a44..refs/heads/lazyvim:/bin/mkvsettitle diff --git a/bin/mkvsettitle b/bin/mkvsettitle index 8afbee6..26443fb 100755 --- a/bin/mkvsettitle +++ b/bin/mkvsettitle @@ -1,7 +1,17 @@ #! /bin/bash # sets the title of all mkv videos to the filename without extension -for f in *.mkv; do - t=${f%.mkv} - mkvpropedit --set title="$t" "$f" +dir=${1-.} +for f in "$dir"/*; do + case "$f" in + *.mkv) ext=mkv ;; + *.webm) ext=webm ;; + *) continue ;; + esac + t=$(basename "$f" "$ext") + t=${t%.*} + # remove also (2013){1080p}[en] stuff + t=${t% (*)\{*\}*} + echo "Set title: $t" + mkvpropedit --set title="$t" "$f" > /dev/null done