CheckFirstPass.sh 1.93 KB
#!/bin/bash

#################################################
# File :    CheckFirstPass.sh                   #
# Brief :   Check First Pass                    #
# Author :  Jean-François Rey                   #
# Version : 1.0                                 #
# Date :    13/06/13                            #
#################################################

# configuration file
. "$OTMEDIA_HOME/cfg/FirstPass.cfg"

# check_first_pass_plp(filenamefullpath)
# - filenamefullpath : full path to plp file
# return 0 if ok, otherwise return 1
function check_first_pass_plp()
{
    if [ $# -eq 1 ]
    then
        if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi
        LINESNB=$($BIN_PATH/aff_mat$ARCH "$1" | wc -l)
        if [ $LINESNB -lt 350000 ]
        then
            return 1
        fi
    fi 
    return 0
}

# check_first_pass_plps_lbl(plppath,lblfile)
# - plppath : path to plp files
# - lblfile : a lblfile
# return 0 if plp files nb == nb files contain in lbl , 1 otherwise
function check_first_pass_plps_lbl()
{
    if [ $# -eq 2 ]
    then
        if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi
        if [ ! -e "$2" ] || [ -z "$2" ]; then return 1; fi
        FILENBLBL=$(cat "$2" | wc -l)
        FILENBPLP=$(ls "$1" | wc -l)
        if [ $FILENBLBL -ne $FILENBPLP ]; then return 1; fi
    fi
    return 0
}


#check_first_pass_output_speeral(plplist,resdir)
# - plplist : filename containing plp list
# - resdir  : output Speeral directory 
check_first_pass_output_speeral()
{
    if [ $# -eq 2 ]
    then
        if [ ! -e "$1" ] || [ -z "$1" ]; then return 1; fi
        FILENBSEG=$(ls $2/*.seg | grep -f "$1" | wc -l)
        FILENBRES=$(ls $2/*.res | grep -f "$1" | wc -l)
        #FILENBPHO=$(ls "$2/*.pho" | grep -f "$1" | wc -l)
        FILENB=$(cat "$1" | wc -l)    
        FILENBPHO=$FILENB
        if [ $FILENB -ne $FILENBSEG ] || [ $FILENB -ne $FILENBRES ] || [ $FILENB -ne $FILENBPHO ] ; then return 1;fi
    fi
    return 0
}