shikeying
2022-09-24 7b3b249a7f2320f97e21e94e26a65f4b4ead0b6e
recommend-video/src/main/java/com/iplatform/recvideo/util/VideoFileUtils.java
@@ -1,8 +1,8 @@
package com.iplatform.recvideo.util;
import com.iplatform.recvideo.Constants;
import com.iplatform.recvideo.ImageInfo;
import com.iplatform.recvideo.VideoFolderInfo;
import com.walker.infrastructure.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -14,8 +14,30 @@
    protected static final transient Logger logger = LoggerFactory.getLogger(VideoFileUtils.class);
    /**
     * 拼接视频批量(存储)文件夹路径,如: /opt/ai/video/20220921,其中'20220921'为批量号
     * @param videoDataFolder
     * @param batchId
     * @return
     */
    public static final String combineBatchPath(String videoDataFolder, String batchId){
        String batchFolderPath = null;
        if(videoDataFolder.endsWith(StringUtils.FOLDER_SEPARATOR)){
            batchFolderPath = videoDataFolder + batchId;
        } else {
            batchFolderPath = videoDataFolder + StringUtils.FOLDER_SEPARATOR + batchId;
        }
        return batchFolderPath;
    }
    public static final List<VideoFolderInfo> getBatchVideoFolderInfo(String videoDataFolder, String batchId){
        String batchFolderPath = videoDataFolder + File.separator + batchId;
//        String batchFolderPath = videoDataFolder + File.separator + batchId;
        String batchFolderPath = combineBatchPath(videoDataFolder, batchId);
//        if(videoDataFolder.endsWith(StringUtils.FOLDER_SEPARATOR)){
//            batchFolderPath = videoDataFolder + batchId;
//        } else {
//            batchFolderPath = videoDataFolder + StringUtils.FOLDER_SEPARATOR + batchId;
//        }
        File batchFolder = new File(batchFolderPath);
        if(!batchFolder.exists()){
            logger.error("视频文件夹不存在,无法获取图片集合信息。batchFolderPath = " + batchFolderPath);