shikeying
2022-09-24 7b3b249a7f2320f97e21e94e26a65f4b4ead0b6e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.iplatform.recvideo;
 
import com.iplatform.model.po.Rc_video_t1;
import com.iplatform.recvideo.util.PythonInvokeUtils;
import com.iplatform.recvideo.util.VideoFileUtils;
import org.junit.Test;
import org.springframework.web.client.RestTemplate;
 
import java.util.List;
 
public class VideoSimilarTest {
 
    @Test
    public void testPythonSearch() throws Exception{
        String url = "http://121.36.40.27:12345/ai/video/search_img";
        RestTemplate restTemplate = new RestTemplate();
        List<Rc_video_t1> data = PythonInvokeUtils.acquireImageSearchResult("landscape_01"
                , "/opt/ai/video/20220921/landscape_01/landscape_01_1.jpg", "30", url, restTemplate);
        if(data != null){
            for(Rc_video_t1 e : data){
                System.out.println(e);
            }
        }
    }
 
//    @Test
    public void testGetVideoId(){
        String id = PythonInvokeUtils.getFileNameWithoutSuffix("/opt/ai/video/20220921/landscape_01.mp4", Constants.VIDEO_SUFFIX);
        System.out.println(id);
    }
 
//    @Test
    public void testVideoFolderInfo(){
        List<VideoFolderInfo> list = VideoFileUtils.getBatchVideoFolderInfo("D:/dev_tools/ai", "video");
        if(list != null){
            for(VideoFolderInfo e : list){
                System.out.println("------------> video folder: " + e.getVideoId());
                List<ImageInfo> imageInfoList = e.getImageInfoList();
                if(imageInfoList != null){
                    for(ImageInfo im : imageInfoList){
                        System.out.println(im);
                    }
                }
            }
        }
    }
}