正在显示
1 个修改的文件
包含
41 行增加
和
7 行删除
| @@ -47,27 +47,38 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{ | @@ -47,27 +47,38 @@ recordInfoService.prototype.tencentRecordInfo = async(channelId)=>{ | ||
| 47 | 47 | ||
| 48 | recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ | 48 | recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ |
| 49 | try { | 49 | try { |
| 50 | - let onlinePath = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/' | ||
| 51 | - //let onlinePath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/' | 50 | + //let onlinePath = '/netWorkSchool/Agora_Recording_SDK_for_Linux_FULL/samples/' |
| 51 | + let onlinePath = '/Users/fzy/Downloads/Agora_Recording_SDK_for_Linux_FULL/samples/' | ||
| 52 | var backFile=[]; | 52 | var backFile=[]; |
| 53 | var fileU | 53 | var fileU |
| 54 | let addrecord = await recordInfo.findAll({where:{channel:path}}); | 54 | let addrecord = await recordInfo.findAll({where:{channel:path}}); |
| 55 | - addrecord.forEach(function(record){ | 55 | + console.log('录制文件',addrecord) |
| 56 | + let noFile = []; | ||
| 57 | + var allFile = []; | ||
| 58 | + addrecord.forEach(function(record,top){ | ||
| 56 | let date1 = moment(Number( record.createTime)).format('YYYYMMDD') | 59 | let date1 = moment(Number( record.createTime)).format('YYYYMMDD') |
| 57 | let date2 = moment(Number(record.createTime)-8*60*60*1000).format('YYYYMMDDhhmmss') | 60 | let date2 = moment(Number(record.createTime)-8*60*60*1000).format('YYYYMMDDhhmmss') |
| 58 | let channeFile = onlinePath+date1; | 61 | let channeFile = onlinePath+date1; |
| 59 | - let fschannefiles=fs.readdirSync(channeFile); | ||
| 60 | - fschannefiles.forEach(function(cfile){ | 62 | + var fschannefiles=fs.readdirSync(channeFile); |
| 63 | + fschannefiles.forEach(function(cfile,index){ | ||
| 61 | if(record.channel == cfile.split('_')[0]+'_'+cfile.split("_")[1]){ | 64 | if(record.channel == cfile.split('_')[0]+'_'+cfile.split("_")[1]){ |
| 62 | let pathURL = onlinePath+date1+"/"+cfile; | 65 | let pathURL = onlinePath+date1+"/"+cfile; |
| 63 | let files=fs.readdirSync(pathURL); | 66 | let files=fs.readdirSync(pathURL); |
| 67 | + if(top == 1){ | ||
| 68 | + allFile.push(files); | ||
| 69 | + } | ||
| 64 | files.forEach(function(file){ | 70 | files.forEach(function(file){ |
| 65 | let type = file.split('.'); | 71 | let type = file.split('.'); |
| 66 | - console.log(type[1]) | ||
| 67 | //m3u8 配置 | 72 | //m3u8 配置 |
| 68 | if(type[1] != 'mp4'){ | 73 | if(type[1] != 'mp4'){ |
| 69 | }else{ | 74 | }else{ |
| 75 | + let noFile = []; | ||
| 70 | let fileN = type[0].split('_'); | 76 | let fileN = type[0].split('_'); |
| 77 | + console.log('++++++++=========',fileN[1]) | ||
| 78 | + console.log(moment(fileN[1], "YYYYMMDDhhmmss").format("X"),record.createTime) | ||
| 79 | + console.log(date2,record.status) | ||
| 80 | + console.log(record.id); | ||
| 81 | + console.log(fileN[1].slice(0,fileN[1].length-3),date2==fileN[1].slice(0,fileN[1].length-3)) | ||
| 71 | if(date2==fileN[1].slice(0,fileN[1].length-3)){ | 82 | if(date2==fileN[1].slice(0,fileN[1].length-3)){ |
| 72 | backFile.push({ | 83 | backFile.push({ |
| 73 | channel:record.channel, | 84 | channel:record.channel, |
| @@ -77,13 +88,36 @@ recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ | @@ -77,13 +88,36 @@ recordInfoService.prototype.getRecordFileURL = async(path,time)=>{ | ||
| 77 | createTime:record.createTime, | 88 | createTime:record.createTime, |
| 78 | fileUrl:applacation.recordPath+date1+'/'+cfile+'/'+file | 89 | fileUrl:applacation.recordPath+date1+'/'+cfile+'/'+file |
| 79 | }) | 90 | }) |
| 91 | + }else{ | ||
| 92 | + noFile.push(record) | ||
| 80 | } | 93 | } |
| 81 | } | 94 | } |
| 82 | }) | 95 | }) |
| 83 | } | 96 | } |
| 84 | }) | 97 | }) |
| 85 | }) | 98 | }) |
| 86 | - return backFile | 99 | + let minNum = 0; |
| 100 | + // let minFile = ''; | ||
| 101 | + // fschannefiles.forEach(function(minf){ | ||
| 102 | + // let minType = file.split('.'); | ||
| 103 | + // let minFileN = type[0].split('_'); | ||
| 104 | + // console.log('比武绝对值数值',Math.abs(record.createTime.slice(0,record.createTime.length-3),moment(fileN[1], "YYYYMMDDhhmmss").format("X"))) | ||
| 105 | + // console.log('比武绝对值',Math.abs(record.createTime.slice(0,record.createTime.length-3)-moment(fileN[1], "YYYYMMDDhhmmss").format("X"))) | ||
| 106 | + // let abs = Math.abs(record.createTime.slice(0,record.createTime.length-3)-moment(fileN[1], "YYYYMMDDhhmmss").format("X")) | ||
| 107 | + // if(abs<minNum){ | ||
| 108 | + // minNum = abs; | ||
| 109 | + // minFile = minf | ||
| 110 | + // } | ||
| 111 | + // }) | ||
| 112 | + // backFile.push({ | ||
| 113 | + // channel:record.channel, | ||
| 114 | + // uid:record.uid, | ||
| 115 | + // userId:record.userId, | ||
| 116 | + // timestamp:record.timestamp, | ||
| 117 | + // createTime:record.createTime, | ||
| 118 | + // fileUrl:applacation.recordPath+date1+'/'+cfile+'/'+minFile | ||
| 119 | + // }) | ||
| 120 | + return {backFile:backFile,fschannefiles:allFile} | ||
| 87 | } catch (error) { | 121 | } catch (error) { |
| 88 | throw error; | 122 | throw error; |
| 89 | } | 123 | } |
-
请 注册 或 登录 后发表评论