|
@@ -10,6 +10,9 @@ import com.cnd3b.utility.aliyun.oss.AliyunOSSConfigConstant;
|
|
|
import com.cnd3b.utility.aliyun.oss.AliyunOSSUtil;
|
|
import com.cnd3b.utility.aliyun.oss.AliyunOSSUtil;
|
|
|
import p2.common.parse.A;
|
|
import p2.common.parse.A;
|
|
|
import p2.common.parse.S;
|
|
import p2.common.parse.S;
|
|
|
|
|
+import p2.pao.PaoRemote;
|
|
|
|
|
+import p2.pao.PaoSetRemote;
|
|
|
|
|
+import p2.util.P2Exception;
|
|
|
|
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayInputStream;
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
@@ -367,7 +370,7 @@ public class datacenter extends Controller {
|
|
|
*
|
|
*
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public String applyTranscoding() {
|
|
|
|
|
|
|
+ public String applyTranscoding() throws P2Exception {
|
|
|
//阿里云视频转码模板
|
|
//阿里云视频转码模板
|
|
|
String templateId = "S00000001-200030";
|
|
String templateId = "S00000001-200030";
|
|
|
//大于这个码率进行视频转码,mov格式的直接转码
|
|
//大于这个码率进行视频转码,mov格式的直接转码
|
|
@@ -378,6 +381,7 @@ public class datacenter extends Controller {
|
|
|
String key = content.getString("key");
|
|
String key = content.getString("key");
|
|
|
if (key.toLowerCase().contains("mov")) {
|
|
if (key.toLowerCase().contains("mov")) {
|
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
|
|
|
+ addTranscodingLog(key, key);
|
|
|
return getSucReturnObject().setData("MOV转码成功").toString();
|
|
return getSucReturnObject().setData("MOV转码成功").toString();
|
|
|
}
|
|
}
|
|
|
//查询是否是可支持转码的视频
|
|
//查询是否是可支持转码的视频
|
|
@@ -403,6 +407,7 @@ public class datacenter extends Controller {
|
|
|
System.err.println(bitrate);
|
|
System.err.println(bitrate);
|
|
|
if (Double.parseDouble(bitrate) > tempBitrate) {
|
|
if (Double.parseDouble(bitrate) > tempBitrate) {
|
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
|
|
|
+ addTranscodingLog(key, key);
|
|
|
return getSucReturnObject().setData("转码成功").toString();
|
|
return getSucReturnObject().setData("转码成功").toString();
|
|
|
} else {
|
|
} else {
|
|
|
return getSucReturnObject().setData("码率低于" + tempBitrate + ",无须转码").toString();
|
|
return getSucReturnObject().setData("码率低于" + tempBitrate + ",无须转码").toString();
|
|
@@ -413,7 +418,7 @@ public class datacenter extends Controller {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public String applyTranscodingOfPath() {
|
|
|
|
|
|
|
+ public String applyTranscodingOfPath() throws P2Exception {
|
|
|
String folderPath = content.getString("folderPath");
|
|
String folderPath = content.getString("folderPath");
|
|
|
List<String> list = getOssFileList(folderPath);
|
|
List<String> list = getOssFileList(folderPath);
|
|
|
//阿里云视频转码模板
|
|
//阿里云视频转码模板
|
|
@@ -426,6 +431,7 @@ public class datacenter extends Controller {
|
|
|
String key = keyPath;
|
|
String key = keyPath;
|
|
|
if (key.toLowerCase().contains("mov")) {
|
|
if (key.toLowerCase().contains("mov")) {
|
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
|
|
|
+ addTranscodingLog(key, key);
|
|
|
System.err.println("MOV转码成功:" + keyPath);
|
|
System.err.println("MOV转码成功:" + keyPath);
|
|
|
} else {
|
|
} else {
|
|
|
ArrayList<String> listVideo = getSupportVieoList();
|
|
ArrayList<String> listVideo = getSupportVieoList();
|
|
@@ -452,6 +458,7 @@ public class datacenter extends Controller {
|
|
|
System.err.println(bitrate);
|
|
System.err.println(bitrate);
|
|
|
if (Double.parseDouble(bitrate) > tempBitrate) {
|
|
if (Double.parseDouble(bitrate) > tempBitrate) {
|
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
AliyunOSSUtil.transcoding(templateId, key, key);
|
|
|
|
|
+ addTranscodingLog(key, key);
|
|
|
System.err.println("转码成功:" + keyPath);
|
|
System.err.println("转码成功:" + keyPath);
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -488,5 +495,28 @@ public class datacenter extends Controller {
|
|
|
return list;
|
|
return list;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 添加转码记录
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public void addTranscodingLog(String tkey, String tkey_new) throws P2Exception {
|
|
|
|
|
+
|
|
|
|
|
+ PaoSetRemote paoSetRemote = getP2ServerSystemPaoSet("TTRANSCODINGLOG", "tkey = '" + tkey + "'");
|
|
|
|
|
+ if (paoSetRemote.isEmpty()) {
|
|
|
|
|
+ PaoRemote paoRemote = paoSetRemote.addAtEnd();
|
|
|
|
|
+ paoRemote.setValue("tkey", tkey, 11L);
|
|
|
|
|
+ paoRemote.setValue("tkey_new", "code/" + tkey_new, 11L);
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ PaoRemote paoRemote = paoSetRemote.getPao(0);
|
|
|
|
|
+ paoRemote.setValue("tkey_new", "转码视频/" + tkey_new, 11L);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ paoSetRemote.save();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|