fixes invalid "/" in filenames, fixes handling of filenames with spaces.
parent
f36c7d604e
commit
6fde82167f
|
@ -33,6 +33,11 @@ simple_quote(){
|
|||
sed "s/e2 80 99/27/g"
|
||||
}
|
||||
|
||||
# From / to ' - '
|
||||
replace_slashes(){
|
||||
sed "s/2f/20 2d 20/g"
|
||||
}
|
||||
|
||||
remove_multibyte_characters(){
|
||||
sed "s/e2 80 .. //g"
|
||||
}
|
||||
|
@ -47,11 +52,12 @@ from_hex(){
|
|||
xxd -p -r
|
||||
}
|
||||
|
||||
# Remove non ascii characters, convert "’" to "'".
|
||||
# Remove non ascii characters, convert "’" to "'", or remove invalid filename characters.
|
||||
to_ascii(){
|
||||
to_hex_one_column | # Convert input into hexadecimal and a single byte per line.
|
||||
regroup_lines | # Required to easily match multi-byte characters.
|
||||
simple_quote | # Convert "’" to "'".
|
||||
replace_slashes | # Replaces / by ' - ', since it isn't a valid filename character.
|
||||
remove_multibyte_characters | # Remove non ascii values.
|
||||
from_hex # Convert back from hex.
|
||||
}
|
||||
|
@ -133,7 +139,7 @@ run_ffmpeg(){
|
|||
if [ "$to" != "" ]; then
|
||||
TO="-to $to"
|
||||
fi
|
||||
INPUT_FILE="-i $file"
|
||||
INPUT_FILE="$file"
|
||||
OUTPUT_FILE="$final_title"
|
||||
|
||||
case "v$VERBOSITY" in
|
||||
|
@ -143,7 +149,7 @@ run_ffmpeg(){
|
|||
echo "extracting '$final_title'"
|
||||
;;
|
||||
v2)
|
||||
echo "ffmpeg $LOG_LEVEL $FROM $TO $INPUT_FILE '$OUTPUT_FILE'"
|
||||
echo "ffmpeg $LOG_LEVEL $FROM $TO -i $INPUT_FILE '$OUTPUT_FILE'"
|
||||
;;
|
||||
*)
|
||||
echo "verbosity is not set properly" >&2
|
||||
|
@ -152,7 +158,7 @@ run_ffmpeg(){
|
|||
esac
|
||||
|
||||
if [ "$SIMULATION" = "" ]; then
|
||||
$(< /dev/null ffmpeg $LOG_LEVEL $FROM $TO $INPUT_FILE "$OUTPUT_FILE")
|
||||
$(< /dev/null ffmpeg $LOG_LEVEL $FROM $TO -i "$INPUT_FILE" "$OUTPUT_FILE")
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue