新增根据 指定时间范围的 recordInfo 查询, 预下载视频文件到本地指定路径
This commit is contained in:
parent
b6217e54c5
commit
f4c687b403
@ -76,13 +76,13 @@ public class VideoCacheManager {
|
|||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
protected CompletableFuture<JsonResponse<String>> downloadVideo(String deviceCode, Date startTime, Date endTime) {
|
protected CompletableFuture<JsonResponse<String>> downloadVideo(String deviceCode, Date startTime, Date endTime) {
|
||||||
return CompletableFuture.supplyAsync(()->{
|
File realFile = Paths.get(deviceProxyConfig.getPreDownloadForRecordInfo().getCachePath(),fileName(deviceCode, startTime, endTime) + ".mp4").toFile();
|
||||||
File realFile = Paths.get(deviceProxyConfig.getPreDownloadForRecordInfo().getCachePath(),fileName(deviceCode, startTime, endTime) + ".mp4").toFile();
|
if(realFile.exists()){
|
||||||
if(realFile.exists()){
|
log.info("文件 {} 已缓存, 直接返回", realFile.getAbsolutePath());
|
||||||
log.info("文件 {} 已缓存, 直接返回", realFile.getAbsolutePath());
|
return CompletableFuture.completedFuture(JsonResponse.success(realFile.getAbsolutePath()));
|
||||||
return JsonResponse.success(realFile.getAbsolutePath());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
return CompletableFuture.supplyAsync(()->{
|
||||||
final String url = UrlBuilder.of(deviceProxyConfig.getUrl())
|
final String url = UrlBuilder.of(deviceProxyConfig.getUrl())
|
||||||
.addPath("video")
|
.addPath("video")
|
||||||
.addQuery("device_id", deviceCode)
|
.addQuery("device_id", deviceCode)
|
||||||
|
Loading…
Reference in New Issue
Block a user