提交 cb8ecb19 authored 作者: 李炎's avatar 李炎

修改配置

上级 f9d43c5e
...@@ -35,6 +35,7 @@ public class HlsAlterController { ...@@ -35,6 +35,7 @@ public class HlsAlterController {
@Value("${server.localip}") @Value("${server.localip}")
private String ip; private String ip;
private String dockerip = "www.lingqingkeji.com";
public HlsAlterController() throws UnknownHostException { public HlsAlterController() throws UnknownHostException {
} }
...@@ -51,7 +52,7 @@ public class HlsAlterController { ...@@ -51,7 +52,7 @@ public class HlsAlterController {
String indexStr = getIndexFile(originUrlpath);//解析originUrlpath 返回为文本 String indexStr = getIndexFile(originUrlpath);//解析originUrlpath 返回为文本
List urlList = analysisIndex(indexStr);//解析indexStr获取.ts文件地址 List urlList = analysisIndex(indexStr);//解析indexStr获取.ts文件地址
String inIp="192.168.2.209"; String inIp="192.168.2.209";
String localPath = "http://" + ip + ":" + port + path + "/"; String localPath = "http://" + dockerip + ":" + port + path + "/";
for (int i = 0; i < urlList.size(); i++) { for (int i = 0; i < urlList.size(); i++) {
String url = urlList.get(i).toString();// String url = urlList.get(i).toString();//
InputStream fileInputStream = getFileInputStream(url); InputStream fileInputStream = getFileInputStream(url);
......
...@@ -40,7 +40,7 @@ public class HlsController { ...@@ -40,7 +40,7 @@ public class HlsController {
private String path; private String path;
@Value("${server.localip}") @Value("${server.localip}")
private String ip; private String ip;
private String dockerip = "www.lingqingkeji.com";
public HlsController() throws UnknownHostException { public HlsController() throws UnknownHostException {
} }
...@@ -56,7 +56,7 @@ public class HlsController { ...@@ -56,7 +56,7 @@ public class HlsController {
//读取指定路径下面的文件 //读取指定路径下面的文件
String indexStr = getIndexFile(originUrlpath);//解析originUrlpath 返回为文本 String indexStr = getIndexFile(originUrlpath);//解析originUrlpath 返回为文本
List urlList = analysisIndex(indexStr);//解析indexStr获取.ts文件地址 List urlList = analysisIndex(indexStr);//解析indexStr获取.ts文件地址
String localPath = "http://" + ip + ":" + port + path + "/"; String localPath = "http://" + dockerip + ":" + port + path + "/";
System.out.println(urlList); System.out.println(urlList);
for (int i = 0; i < urlList.size(); i++) { for (int i = 0; i < urlList.size(); i++) {
String tsUrl = UUID.randomUUID().toString() + ".ts";//文件后缀,key String tsUrl = UUID.randomUUID().toString() + ".ts";//文件后缀,key
...@@ -115,13 +115,13 @@ public class HlsController { ...@@ -115,13 +115,13 @@ public class HlsController {
/*读取网络文件*/ /*读取网络文件*/
@GetMapping("/GetTs/{path}") @GetMapping("/GetTs/{path}")
public void getFileInputStream(@PathVariable() String path, HttpServletResponse response) { public void getFileInputStream(@PathVariable() String path, HttpServletResponse response) {
System.out.println("GetTs"+path); System.out.println("GetTs" + path);
String s = urlPath.get(path); String s = urlPath.get(path);
System.out.println("path"+s); System.out.println("path" + s);
System.out.println(urlPath); System.out.println(urlPath);
URL url = null; URL url = null;
try { try {
url = new URL(s+"?Usr=c1cbc1d4e86d49a0981f54beea95280a"); url = new URL(s + "?Usr=c1cbc1d4e86d49a0981f54beea95280a");
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//设置超时间为3秒 //设置超时间为3秒
conn.setConnectTimeout(3 * 1000); conn.setConnectTimeout(3 * 1000);
...@@ -148,7 +148,7 @@ public class HlsController { ...@@ -148,7 +148,7 @@ public class HlsController {
} catch (Exception e) { } catch (Exception e) {
System.out.println("读取网络文件异常:" + path); System.out.println("读取网络文件异常:" + path);
// logger.error("读取网络文件异常:"+path); // logger.error("读取网络文件异常:"+path);
}finally { } finally {
urlPath.remove(path); urlPath.remove(path);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论