yumeng 2 jaren geleden
bovenliggende
commit
3d189e2187

+ 8 - 0
src/main/java/cn/com/ctop/track/controller/MaterialController.java

@@ -47,6 +47,14 @@ public class MaterialController {
     }
     }
 
 
 
 
+    @ResponseBody
+    @RequestMapping(value = "/test5")
+    public void test5() throws Exception {
+        mediaService.test5();
+
+    }
+
+
 
 
 
 
     @ResponseBody
     @ResponseBody

+ 2 - 0
src/main/java/cn/com/ctop/track/service/MediaService.java

@@ -21,4 +21,6 @@ public interface MediaService {
     void test3();
     void test3();
 
 
     void test4();
     void test4();
+
+    void test5();
 }
 }

+ 103 - 8
src/main/java/cn/com/ctop/track/service/impl/MediaServiceImpl.java

@@ -220,7 +220,7 @@ public class MediaServiceImpl implements MediaService {
         for (int i = 0; i < zhongList.size(); i++) {
         for (int i = 0; i < zhongList.size(); i++) {
             String s = zhongList.getString(i);
             String s = zhongList.getString(i);
             JSONArray array = pipei1(i, s, qianTieArray);
             JSONArray array = pipei1(i, s, qianTieArray);
-            //  JSONArray array1 = pipei2(i, houList, array);
+            //      JSONArray array1 = pipei2(i, houList, array);
             editMedia(array, "乐刷刷_06-01_女_" + count);
             editMedia(array, "乐刷刷_06-01_女_" + count);
             count++;
             count++;
             System.err.println(count);
             System.err.println(count);
@@ -344,6 +344,101 @@ public class MediaServiceImpl implements MediaService {
 
 
     }
     }
 
 
+    @Override
+    public void test5() {
+        VodUploadClient client = new VodUploadClient("AKIDPcZGgphIcfRxCF1XmjQqzqRlnY3GCrFN", "tVqvjFUS9ZhY8RTEiJeiV1GEvMVNyJM8");
+        JSONArray aArray = new JSONArray();
+        String qianTiePath = "/Users/yumeng/file/a";
+        JSONArray files = getFiles(qianTiePath);
+        for (int i = 0; i < files.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(files.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+                //    log.info("Upload FileId = {}", response.getFileId());
+                aArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+        JSONArray bArray = new JSONArray();
+        String houTiePath = "/Users/yumeng/file/b";
+        JSONArray houTieFiles = getFiles(houTiePath);
+        for (int i = 0; i < houTieFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(houTieFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                bArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+
+
+        JSONArray cArray = new JSONArray();
+        String cPath = "/Users/yumeng/file/c";
+        JSONArray cFiles = getFiles(cPath);
+        for (int i = 0; i < cFiles.size(); i++) {
+            VodUploadRequest request = new VodUploadRequest();
+            request.setMediaFilePath(cFiles.getString(i));
+            try {
+                VodUploadResponse response = client.upload("ap-chongqing", request);
+//                log.info("Upload FileId = {}", response.getFileId());
+                cArray.add(response.getFileId());
+                Thread.sleep(500);
+            } catch (Exception e) {
+                // 业务方进行异常处理
+                log.error("Upload Err", e);
+            }
+        }
+        //
+
+
+        for (int i = 0; i < aArray.size(); i++) {
+            String a = aArray.getString(i);
+            JSONArray array = pipei1(i, a, bArray);
+            JSONArray array1 = pipei2(i, cArray, array);
+            editMedia(array1, "233小游戏_2022-08-18_3_" + count);
+            count++;
+            System.err.println(count);
+        }
+
+//        shuffle(aArray);
+//        shuffle(bArray);
+//        shuffle(cArray);
+//        for (int i = 0; i < aArray.size(); i++) {
+//            String a = aArray.getString(i);
+//            JSONArray array = pipei1(i, a, bArray);
+//            JSONArray array1 = pipei2(i, cArray, array);
+//            editMedia(array1, "233小游戏_2022-08-08_" + count);
+//            count++;
+//            System.err.println(count);
+//        }
+//
+//        shuffle(aArray);
+//        shuffle(bArray);
+//        shuffle(cArray);
+//
+//        for (int i = 0; i < aArray.size(); i++) {
+//            String a = aArray.getString(i);
+//            JSONArray array = pipei1(i, a, bArray);
+//            JSONArray array1 = pipei2(i, cArray, array);
+//            editMedia(array1, "233小游戏_2022-08-08_" + count);
+//            count++;
+//            System.err.println(count);
+//        }
+    }
+
+
+
+
 
 
     private JSONArray pipei4(Integer index, String b, JSONArray array) {
     private JSONArray pipei4(Integer index, String b, JSONArray array) {
         JSONArray ids = new JSONArray();
         JSONArray ids = new JSONArray();
@@ -390,16 +485,18 @@ public class MediaServiceImpl implements MediaService {
         int size = qianList.size() - 1;
         int size = qianList.size() - 1;
         if (index <= size) {
         if (index <= size) {
             String s = qianList.getString(index);
             String s = qianList.getString(index);
-            ids.add(s);
             ids.add(value);
             ids.add(value);
+            ids.add(s);
+
         } else {
         } else {
             String s = qianList.getString(qianIndex);
             String s = qianList.getString(qianIndex);
             qianIndex++;
             qianIndex++;
             if (qianIndex == size + 1) {
             if (qianIndex == size + 1) {
                 qianIndex = 0;
                 qianIndex = 0;
             }
             }
-            ids.add(s);
             ids.add(value);
             ids.add(value);
+            ids.add(s);
+
 
 
         }
         }
         return ids;
         return ids;
@@ -407,16 +504,14 @@ public class MediaServiceImpl implements MediaService {
     }
     }
 
 
 
 
-    private JSONArray pipei2(Integer index, List<String> houList, JSONArray ids) {
-
-
+    private JSONArray pipei2(Integer index, JSONArray houList, JSONArray ids) {
         int size = houList.size() - 1;
         int size = houList.size() - 1;
         if (index <= size) {
         if (index <= size) {
-            String s = houList.get(index);
+            String s = houList.getString(index);
             ids.add(s);
             ids.add(s);
 
 
         } else {
         } else {
-            String s = houList.get(houIndex);
+            String s = houList.getString(houIndex);
             houIndex++;
             houIndex++;
             if (houIndex == size + 1) {
             if (houIndex == size + 1) {
                 houIndex = 0;
                 houIndex = 0;