diff --git a/toys/checkextensions b/toys/checkextensions index 6c8d874..6a59119 100755 --- a/toys/checkextensions +++ b/toys/checkextensions @@ -121,7 +121,7 @@ getdstfiles() { ; SELECT "AtOM:NoMoreFiles"; '>&3 - while read -u4 line + while read -u4 -d$'\0' line do if [[ $line == AtOM:NoMoreFiles ]] then @@ -159,7 +159,7 @@ renameFile() { fi } -while read -u4 line +while read -u4 -d$'\0' line do if [[ $line == AtOM:NoMoreFiles ]] then diff --git a/toys/checkmissing b/toys/checkmissing index 13215f0..8fd8010 100755 --- a/toys/checkmissing +++ b/toys/checkmissing @@ -79,7 +79,7 @@ echo 'SELECT "AtOM:NoMoreFiles";' >&3 declare -a \ destination_names \ files -read -u4 line +read -u4 -d$'\0' line until [[ $line == AtOM:NoMoreFiles ]] do id=${line%%::AtOM:SQL:Sep::*} diff --git a/toys/createindex b/toys/createindex index d1a01dd..e934599 100755 --- a/toys/createindex +++ b/toys/createindex @@ -274,7 +274,7 @@ fi echo 'SELECT IFNULL( (SELECT last_seen FROM source_files ORDER BY last_seen DESC LIMIT 1), 0);' >&3 -read -u4 lastupdate +read -u4 -d$'\0' lastupdate if ! [[ "$output" == - ]] then @@ -369,11 +369,11 @@ COLLATE NOCASE; SELECT "AtOM:NoMoreFiles";' >&3 -read -u4 line +read -u4 -d$'\0' line until [[ $line == AtOM:NoMoreFiles ]] do files+=("$line") - read -u4 line + read -u4 -d$'\0' line done for line in "${files[@]}" @@ -675,7 +675,7 @@ echo ' SELECT "AtOM:NoMoreFiles";' >&3 -read -u4 line +read -u4 -d$'\0' line until [[ $line == AtOM:NoMoreFiles ]] do artist="${line%%::AtOM:SQL:Sep::*}" @@ -685,7 +685,7 @@ do artists+=( "$artist" ) maxcountlen=$(( ${#count} > maxcountlen ? ${#count} : maxcountlen )) maxartistlen=$(( ${#artist} > maxartistlen ? ${#artist} : maxartistlen )) - read -u4 line + read -u4 -d$'\0' line done head=$( printf "| # | %'${maxcoutlen}s | %-${maxartistlen}s |" \ @@ -714,7 +714,7 @@ echo ' FROM source_files INNER JOIN mime_types ON source_files.mime_type=mime_types.id;' >&3 -read -u4 line +read -u4 -d$'\0' line totalcount="${line%%::AtOM:SQL:Sep::*}" maxcountlen=$(printf "%'i" $totalcount) maxcountlen=${#maxcountlen} @@ -743,7 +743,7 @@ do INNER JOIN mime_types ON source_files.mime_type=mime_types.id WHERE mime_text LIKE "'"$format"'";' >&3 - read -u4 line + read -u4 -d$'\0' line count="${line%%::AtOM:SQL:Sep::*}" rest="${line#*::AtOM:SQL:Sep::}::AtOM:SQL:Sep::" size="${rest%%::AtOM:SQL:Sep::*}" diff --git a/toys/lowquality b/toys/lowquality index 665b30d..f194997 100755 --- a/toys/lowquality +++ b/toys/lowquality @@ -131,11 +131,11 @@ echo ') ORDER BY bitrate;' >&3 echo 'SELECT "AtOM:NoMoreFiles";' >&3 -read -u4 line +read -u4 -d$'\0' line until [[ $line == AtOM:NoMoreFiles ]] do echo "${line//::AtOM:SQL:Sep::/$'\t'}" - read -u4 line + read -u4 -d$'\0' line done closeDatabase diff --git a/toys/missingtags b/toys/missingtags index f523ff2..743d020 100755 --- a/toys/missingtags +++ b/toys/missingtags @@ -149,11 +149,11 @@ cat >&3 <<-EOSelect SELECT "AtOM:NoMoreFiles"; EOSelect -read -u4 line +read -u4 -d$'\0' line until [[ $line == AtOM:NoMoreFiles ]] do lines+=( "$line" ) - read -u4 line + read -u4 -d$'\0' line done for line in "${lines[@]}"