# sets the title of all mkv videos to the filename without extension
dir=${1-.}
-for f in "$dir"/*.mkv; do
- t=$(basename "$f" .mkv)
+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