private static final Logger log = LoggerFactory.getLogger(VodVideoSubtitleTest.class);
/**
* 上传字幕文件
*/
@Test
public void testUploadSubtitle() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userid = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/%s/srt/upload",userid);
String vid = "1b448be3230fa05b4d2d0003bf5a8ad0_1";
String title = "测试上传字幕";
String filePath = getClass().getResource("/file/").getPath() + "zimufile.srt";
File file = new File(filePath);
String asDefault = "Y";
String language = "英语";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userid);
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
Map<String,File> fileMap = new HashMap<>();
fileMap.put("file",file);
requestMap.put("title",title);
requestMap.put("asDefault",asDefault);
requestMap.put("language",language);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url, requestMap,fileMap,Constant.UTF8);
log.debug("测试上传字幕,{}", response);
//do somethings
}