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