diff --git a/tools/db/import-md5-list b/tools/db/import-md5-list index ab40c54..6698224 100644 --- a/tools/db/import-md5-list +++ b/tools/db/import-md5-list @@ -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 }