add db check

This commit is contained in:
6543 2019-05-11 02:34:52 +02:00
parent f82a1a90df
commit be6ac6673a

View File

@ -58,6 +58,9 @@ function main() {
#cd to moviedir
cd "$moviedir"

#db checks
[ "$(db_check)" == $FALSE ] && exit 1

#clean DB from old stuff
{
db_query "DELETE From File WHERE Size=0 OR MD5="" OR MD5 IS NULL;"
@ -178,6 +181,12 @@ function db_query() {
echo $@ | mysql $args
}

function db_check() {
echo DUMMY FUNC db_check
echo aim: check DB conection + shema
echo $TRUE
}

# db_F-ID_getPath <F-ID> -> <Path>
function db_id_getPath() {
db_query "SELECT CONCAT('$moviedir/', Folder, '/', Name) FROM File WHERE ID=$1;"