Commit f60076551116de7c259239e238454c3faade5a6f
1 parent
9c27de28
优化日志
Showing
2 changed files
with
18 additions
and
16 deletions
src/main/java/top/panll/assist/config/StartConfig.java
| @@ -143,7 +143,7 @@ public class StartConfig implements CommandLineRunner { | @@ -143,7 +143,7 @@ public class StartConfig implements CommandLineRunner { | ||
| 143 | "</body>\n" + | 143 | "</body>\n" + |
| 144 | "</html>"; | 144 | "</html>"; |
| 145 | fs.write(content.getBytes(StandardCharsets.UTF_8)); | 145 | fs.write(content.getBytes(StandardCharsets.UTF_8)); |
| 146 | - logger.error("已写入html配置页面"); | 146 | + logger.info("已写入html配置页面"); |
| 147 | } catch (FileNotFoundException e) { | 147 | } catch (FileNotFoundException e) { |
| 148 | logger.error("写入html页面错误", e); | 148 | logger.error("写入html页面错误", e); |
| 149 | } catch (IOException e) { | 149 | } catch (IOException e) { |
src/main/java/top/panll/assist/service/VideoFileService.java
| @@ -166,22 +166,24 @@ public class VideoFileService { | @@ -166,22 +166,24 @@ public class VideoFileService { | ||
| 166 | List<File> appList = getAppList(); | 166 | List<File> appList = getAppList(); |
| 167 | if (appList != null && appList.size() > 0) { | 167 | if (appList != null && appList.size() > 0) { |
| 168 | for (File appFile : appList) { | 168 | for (File appFile : appList) { |
| 169 | - List<File> streamList = getStreamList(appFile.getName()); | ||
| 170 | - if (streamList != null && streamList.size() > 0) { | ||
| 171 | - for (File streamFile : streamList) { | ||
| 172 | - Map<String, String> data = new HashMap<>(); | ||
| 173 | - data.put("app", appFile.getName()); | ||
| 174 | - data.put("stream", streamFile.getName()); | ||
| 175 | - | ||
| 176 | - BasicFileAttributes bAttributes = null; | ||
| 177 | - try { | ||
| 178 | - bAttributes = Files.readAttributes(streamFile.toPath(), | ||
| 179 | - BasicFileAttributes.class); | ||
| 180 | - } catch (IOException e) { | ||
| 181 | - e.printStackTrace(); | 169 | + if (appFile.isDirectory()) { |
| 170 | + List<File> streamList = getStreamList(appFile.getName()); | ||
| 171 | + if (streamList != null && streamList.size() > 0) { | ||
| 172 | + for (File streamFile : streamList) { | ||
| 173 | + Map<String, String> data = new HashMap<>(); | ||
| 174 | + data.put("app", appFile.getName()); | ||
| 175 | + data.put("stream", streamFile.getName()); | ||
| 176 | + | ||
| 177 | + BasicFileAttributes bAttributes = null; | ||
| 178 | + try { | ||
| 179 | + bAttributes = Files.readAttributes(streamFile.toPath(), | ||
| 180 | + BasicFileAttributes.class); | ||
| 181 | + } catch (IOException e) { | ||
| 182 | + e.printStackTrace(); | ||
| 183 | + } | ||
| 184 | + data.put("time", simpleDateFormatForTime.format(new Date(bAttributes.lastModifiedTime().toMillis()))); | ||
| 185 | + result.add(data); | ||
| 182 | } | 186 | } |
| 183 | - data.put("time", simpleDateFormatForTime.format(new Date(bAttributes.lastModifiedTime().toMillis()))); | ||
| 184 | - result.add(data); | ||
| 185 | } | 187 | } |
| 186 | } | 188 | } |
| 187 | } | 189 | } |