first working md5_in_add (with special sign bug)

This commit is contained in:
6543 2019-02-07 22:58:52 +01:00
parent 53e7bc984a
commit c68841959e

View File

@ -65,11 +65,10 @@ if [ "$mode" == "help" ] && help


## functions ## functions
function md5_in_add() { function md5_in_add() {

cat $md5 | while read line; do #for each line in md5
cat data_shares_Filme | while read line; do
md5=$(echo $line | cut -c -32) md5=$(echo $line | cut -c -32)
path=$(echo $line | cut -c 33- | sed 's/^\ //g') path=$(echo $line | cut -c 33- | sed 's/^\ //g')
relrevpath=$(echo $path | sed "s|$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev) relrevpath=$(echo $path | sed "s|^$moviedir||g" | sed 's|^/||g' | sed 's|/$||g' | rev)
name=$(echo $relrevpath | cut -d '/' -f 1 | rev) name=$(echo $relrevpath | cut -d '/' -f 1 | rev)
folder=$(echo $relrevpath | cut -d '/' -f 2- | rev) folder=$(echo $relrevpath | cut -d '/' -f 2- | rev)
db_query "INSERT INTO File (MD5, Folder, Name) VALUES ('$md5', '$folder', '$name' );" #-> handle in future: ";'()" db_query "INSERT INTO File (MD5, Folder, Name) VALUES ('$md5', '$folder', '$name' );" #-> handle in future: ";'()"