add draft for md5_in_add

This commit is contained in:
6543 2019-02-07 22:49:08 +01:00
parent 4b4b45e2b1
commit 6174c863df

View File

@ -62,6 +62,16 @@ if [ "$mode" == "help" ] && help

## functions
function md5_in_add() {

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

exit 0
}