Skip to content

Instantly share code, notes, and snippets.

@tyjak
Last active May 23, 2021 09:34
Show Gist options
  • Save tyjak/48c17774a5adb5c1bd45def1a21bd16e to your computer and use it in GitHub Desktop.
Save tyjak/48c17774a5adb5c1bd45def1a21bd16e to your computer and use it in GitHub Desktop.
copy all title of a dvd with handbrakecli
#!/bin/zsh
set -e
# copy all titles of dvd
# GistID:48c17774a5adb5c1bd45def1a21bd16e
dirpath="${1:-$(pwd)}"
title=$(HandBrakeCLI -i /dev/sr0 -t 0 2>&1 | grep "DVD Title:" | sed -E 's/.*DVD Title: (.*)$/\1/')
HandBrakeCLI -i /dev/sr0 -t 0 -v 2>&1 | grep '+ title' | sed -E "s@[^0-9]*([0-9]+):\$@HandBrakeCLI -i /dev/sr0 -m -t \1 -o \"${dirpath}/${title}_\1.mp4\"@" > /tmp/handbrake-tasks.sh
sh /tmp/handbrake-tasks.sh
#more ~/handbrake-sample.txt | grep '+ title' | sed -E "s@[^0-9]*([0-9]+):\$@HandBrake -t \1 -o \"$1 \1.mp4\"@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment