<commit_before>#!/bin/bash
# 2013-09-10: <NAME>

function print_usage {
 echo "Usage: $0 [-s /dev/sr0] [-d $HOME/Videos] [-e 480p] [-t TRACK] -n NAME"
 echo " Valid encode options: 480p, 720p, 1080p"
}

SOURCE="/dev/sr0"
DIR="$HOME/Videos"
NAME=""
TRACK=""
ENCODE="480p"

while getopts "s:d:n:t:e:" Option
do
  case $Option in
    s)
        SOURCE=$OPTARG
        ;;
    d)
        DIR=$OPTARG
        ;;
    n)
        NAME=$OPTARG
        ;;
    t)
        TRACK=$OPTARG
        ;;
    e)
        ENCODE=$OPTARG
        ;;
   esac
done
shift $(($OPTIND - 1))

# Track is only needed if we're ripping from a DVD
TRACK_OPT=""
IS_SOURCE_DEV=$(echo $SOURCE | grep -c "^/dev")
if [ "$IS_SOURCE_DEV" -gt 0 ]; then
 if [ -z "$TRACK" ]; then
  print_usage
  exit
 else
  TRACK_OPT="-t $TRACK"
 fi
fi

# If source is a ripped mkv, we can use it's filename if not specified
IS_SOURCE_MKV=$(echo $SOURCE | grep -c "mkv$")
IS_SOURCE_MPG=$(echo $SOURCE | grep -c "mpg$")
if [ "$IS_SOURCE_MKV" -gt 0 ] && [ -z "$NAME" ]; then
 NAME=$(basename $SOURCE | sed -e 's/\.mkv//')
elif [ "$IS_SOURCE_MPG" -gt 0 ] && [ -z "$NAME" ]; then
 NAME=$(basename $SOURCE | sed -e 's/\.mpg//')
else
 if [ -z "$NAME" ]; then
  print_usage
  exit
 fi
fi

case $ENCODE in<commit_msg>More quotes. Handle dev vs file differently.<commit_after>#!/bin/bash
# 2013-09-10: <NAME>

function print_usage {
 echo "Usage: $0 [-s /dev/sr0] [-d $HOME/Videos] [-e 480p] [-t TRACK] -n NAME"
 echo " Valid encode options: 480p, 720p, 1080p"
}

SOURCE="/dev/sr0"
DIR="$HOME/Videos"
NAME=""
TRACK=""
ENCODE="480p"

while getopts "s:d:n:t:e:" Option
do
  case $Option in
    s)
        SOURCE=$OPTARG
        ;;
    d)
        DIR=$OPTARG
        ;;
    n)
        NAME=$OPTARG
        ;;
    t)
        TRACK=$OPTARG
        ;;
    e)
        ENCODE=$OPTARG
        ;;
   esac
done
shift $(($OPTIND - 1))

# Track is only needed if we're ripping from a DVD
TRACK_OPT=""
IS_SOURCE_DEV=$(echo $SOURCE | grep -c "^/dev")
if [ "$IS_SOURCE_DEV" -gt 0 ]; then
 if [ -z "$TRACK" ]; then
  print_usage
  exit
 else
  TRACK_OPT="-t $TRACK"
 fi
fi

# If source is a ripped mkv, we can use it's filename if not specified
IS_SOURCE_NOT_DVD=$(echo $SOURCE | grep -c -v "/dev")
if [ "$IS_SOURCE_NOT_DVD" -gt 0 ] && [ -z "$NAME" ]; then
 NAME=$(basename "$SOURCE" | sed -e 's/\.mkv//' -e 's/\.mpg//')
else
 if [ -z "$NAME" ]; then
  print_usage
  exit
 fi
fi

case $ENCODE in
{'fraction_non_alphanumeric': 0.17503110742430528, 'fraction_numerical': 0.025300705101617586, 'mean_word_length': 2.5470588235294116, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2807547', 'n_tokens_mistral': 1035, 'n_tokens_neox': 943, 'n_words': 281}