Grooming.
parent
95358ff18d
commit
f58bfdde9c
|
@ -2,8 +2,7 @@
|
|||
|
||||
# From a single byte in hexadecimal per line
|
||||
# to lines ending with 0a (hex for '\n').
|
||||
regroup_lines(){
|
||||
awk '
|
||||
regroup_lines() awk '
|
||||
BEGIN {
|
||||
line_start=1
|
||||
}
|
||||
|
@ -26,31 +25,20 @@ regroup_lines(){
|
|||
print line
|
||||
}
|
||||
'
|
||||
}
|
||||
|
||||
# From ’ to '
|
||||
simple_quote(){
|
||||
sed "s/e2 80 99/27/g"
|
||||
}
|
||||
simple_quote() sed "s/e2 80 99/27/g"
|
||||
|
||||
# From / to ' - '
|
||||
replace_slashes(){
|
||||
sed "s/2f/20 2d 20/g"
|
||||
}
|
||||
replace_slashes() sed "s/2f/20 2d 20/g"
|
||||
|
||||
remove_multibyte_characters(){
|
||||
sed "s/e2 80 .. //g"
|
||||
}
|
||||
remove_multibyte_characters() sed "s/e2 80 .. //g"
|
||||
|
||||
# Convert input into hexadecimal and a single byte per line.
|
||||
to_hex_one_column(){
|
||||
xxd -p -c 1
|
||||
}
|
||||
to_hex_one_column() xxd -p -c 1
|
||||
|
||||
# Reverse hexadecimal to original value.
|
||||
from_hex(){
|
||||
xxd -p -r
|
||||
}
|
||||
from_hex() xxd -p -r
|
||||
|
||||
# Remove non ascii characters, convert "’" to "'", or remove invalid filename characters.
|
||||
to_ascii(){
|
||||
|
@ -62,9 +50,7 @@ to_ascii(){
|
|||
from_hex # Convert back from hex.
|
||||
}
|
||||
|
||||
process_end_of_songs(){
|
||||
awk -v NONUMBER="$NONUMBER" -v SEPARATOR="$SEPARATOR" '
|
||||
|
||||
process_end_of_songs() awk -v NONUMBER="$NONUMBER" -v SEPARATOR="$SEPARATOR" '
|
||||
BEGIN {
|
||||
OFS=" "
|
||||
}
|
||||
|
@ -96,10 +82,8 @@ process_end_of_songs(){
|
|||
print timestamp, "END_OF_FILE", title;
|
||||
}
|
||||
'
|
||||
}
|
||||
|
||||
first_column_to_seconds(){
|
||||
awk '
|
||||
first_column_to_seconds() awk '
|
||||
{
|
||||
# from 10:30 to 630
|
||||
n = split ($1, arr, ":")
|
||||
|
@ -120,12 +104,9 @@ first_column_to_seconds(){
|
|||
v = 0;
|
||||
}
|
||||
'
|
||||
}
|
||||
|
||||
# Get a more usable time representation for the beginning and the end of songs.
|
||||
process_time_file(){
|
||||
to_ascii | first_column_to_seconds | process_end_of_songs
|
||||
}
|
||||
process_time_file(){ to_ascii | first_column_to_seconds | process_end_of_songs ; }
|
||||
|
||||
run_ffmpeg(){
|
||||
file=$1
|
||||
|
|
Loading…
Reference in New Issue