def getVideoNCorrespondingInfo(csvFileFullPath, logDir):
    videoNCorrespondingLogNUnsync = []
    with open(csvFileFullPath) as csvfile:
        csvReader = csv.reader(csvfile, delimiter=',')
        header = next(csvReader)
        for row in csvReader:
            csv_row = {}
            csv_row['videoFullPath'] = row[1]
            csv_row['unsynced_seconds'] = int(row[7])
            csv_row['logFileFullPaths'] = getVideoCorrespondingLogFile(
                csv_row['videoFullPath'], logDir)
            videoNCorrespondingLogNUnsync.append(csv_row)
    return videoNCorrespondingLogNUnsync
def main_oneVideo(logDir,
                  drawRulerFlag=False,
                  specificBails=range(1, TOTALBAILS + 1)):
    videoFullPath = '/data/imageProcessingNAS/farmVideos/videos_raw/8003993/202004/20200414/QBH-PlatFace1.shed8003993.20200414_143000.mp4'  # normal
    # videoFullPath = '/data/imageProcessingNAS/farmVideos/videos_raw/8003993/202004/20200409/QBH-PlatFace1.shed8003993.20200409_141000.mp4' # abnormal: camera_chunk == camera

    logFileFullPaths = getVideoCorrespondingLogFile(videoFullPath, logDir)
    videoNLogNUnsync = {
        'videoFullPath': videoFullPath,
        'unsyncedSeconds': 0.0,
        'logFileFullPaths': logFileFullPaths
    }
    # generateOneVideoCowFace(videoNLogNUnsync, specificBails = specificBails, drawRulerFlag = drawRulerFlag) # do every bail
    generateOneVideoCowFace(
        videoNLogNUnsync, specificBails=[3, 5],
        drawRulerFlag=True)  # do specific and and draw ruler
def getVideoNCorrespondingInfo_onlyVideo(csvFileFullPath,
                                         logDir,
                                         videoOffsetTable='NaN'):
    videoNCorrespondingLogNUnsync = []
    with open(csvFileFullPath) as csvfile:
        csvReader = csv.reader(csvfile)
        for row in csvReader:
            csv_row = {}
            csv_row['videoFullPath'] = row[0]
            csv_row['logFileFullPaths'] = getVideoCorrespondingLogFile(
                csv_row['videoFullPath'], logDir)
            if videoOffsetTable == 'NaN':
                csv_row['unsynced_seconds'] = 0.0
            else:
                _, videoDate, _ = getVideosMonthDateNTime(
                    csv_row['videoFullPath'])
                try:
                    csv_row['unsynced_seconds'] = videoOffsetTable[videoDate]
                except:
                    print('This video is not in the videoOffsetTable:',
                          csv_row['videoFullPath'])
            videoNCorrespondingLogNUnsync.append(csv_row)
    return videoNCorrespondingLogNUnsync