Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
张艾宸
/
webScreen
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
张艾宸
2019-12-30 14:58:40 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
213de441ed278c2b04ff028ebea48f0cb286f874
213de441
1 parent
a842ffc1
完整版1.0
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
46 行增加
和
44 行删除
config/config.js
routes/index.js
webScreen
webScreen.rar
config/config.js
查看文件 @
213de44
...
...
@@ -2,7 +2,8 @@ const GETCLASSURL = "http://139.196.126.156:8081/getLogs/recordClassList"
const
GETCLASSURLPARAMETER
=
{
siteId
:[
"BuzzKID"
,
"kuaikuenglish"
],
key
:
"xdymp4record20191225"
,
page
:
1
page
:
1
,
maxMedia
:
1
,
}
const
PROJECTWINCATALOG
=
"E:/project/web_capture_release/win-x64"
...
...
@@ -22,7 +23,9 @@ const BACKMEDIACONFIG = {
d
:
0.5
*
60
*
60
*
1000
,
s
:
0
,
fa
:
15
,
k
:
1
k
:
1
,
w
:
1600
,
h
:
789
,
}
module
.
exports
=
{
GETCLASSURL
,
...
...
routes/index.js
查看文件 @
213de44
...
...
@@ -13,10 +13,9 @@ const { startTime, endTime, ymd } = YesterdayTime()
let
siteIds
=
GETCLASSURLPARAMETER
.
siteId
let
classid
=
[]
let
parentData
=
[]
let
parentData
=
{}
var
classobj
=
{};
let
className
=
""
let
maxMedia
=
2
/**
*
* @param {*} id 课堂id
...
...
@@ -27,40 +26,32 @@ class MediaCreat {
async
allData
()
{
let
page
=
1
className
=
siteIds
.
shift
()
let
result
=
await
getRequestClassIds
(
GETCLASSURL
,
className
,
GETCLASSURLPARAMETER
.
key
,
startTime
,
endTime
,
page
)
for
(
let
j
=
0
;
j
<
result
.
data
.
data
.
list
.
length
;
j
++
)
{
classid
.
push
(
result
.
data
.
data
.
list
[
j
])
}
const
{
siteId
,
list
,
totalPage
}
=
result
.
data
.
data
for
(
let
i
=
page
+=
1
;
i
<=
totalPage
;
i
++
)
{
let
result
=
await
getRequestClassIds
(
GETCLASSURL
,
className
,
GETCLASSURLPARAMETER
.
key
,
startTime
,
endTime
,
i
)
if
(
className
)
{
let
result
=
await
getRequestClassIds
(
GETCLASSURL
,
className
,
GETCLASSURLPARAMETER
.
key
,
startTime
,
endTime
,
page
)
parentData
[
result
.
data
.
data
.
siteId
]
=
[]
for
(
let
j
=
0
;
j
<
result
.
data
.
data
.
list
.
length
;
j
++
)
{
classid
.
push
(
result
.
data
.
data
.
list
[
j
])
}
}
classid
=
classid
.
reduce
(
function
(
item
,
next
)
{
classobj
[
next
.
classId
]
?
''
:
classobj
[
next
.
classId
]
=
true
&&
item
.
push
(
next
);
return
item
;
},
[]);
parentData
=
JSON
.
parse
(
JSON
.
stringify
(
classid
))
return
true
}
// 取出不同的值
async
notResult
(
data1
,
data2
)
{
new
Promise
((
resolve
,
reject
)
=>
{
let
data
=
[]
for
(
let
i
=
0
;
i
<
data2
.
length
;
i
++
)
{
// for(let j=0;j<data1.length;j++){
if
(
data1
.
indexOf
(
data2
[
i
].
classId
+
".mp4"
)
==
-
1
)
{
console
.
log
(
"不存在:"
+
data2
[
i
])
data
.
push
(
data2
[
i
])
const
{
siteId
,
list
,
totalPage
}
=
result
.
data
.
data
for
(
let
i
=
page
+=
1
;
i
<=
totalPage
;
i
++
)
{
let
result
=
await
getRequestClassIds
(
GETCLASSURL
,
className
,
GETCLASSURLPARAMETER
.
key
,
startTime
,
endTime
,
i
)
for
(
let
j
=
0
;
j
<
result
.
data
.
data
.
list
.
length
;
j
++
)
{
classid
.
push
(
result
.
data
.
data
.
list
[
j
])
}
}
console
.
log
(
"data"
,
data
)
return
resolve
(
data
)
})
classid
=
classid
.
reduce
(
function
(
item
,
next
)
{
classobj
[
next
.
classId
]
?
''
:
classobj
[
next
.
classId
]
=
true
&&
item
.
push
(
next
);
return
item
;
},
[]);
for
(
let
i
=
0
;
i
<
classid
.
length
;
i
++
)
{
parentData
[
result
.
data
.
data
.
siteId
].
push
(
classid
[
i
].
classId
)
}
return
true
}
else
{
return
false
}
}
async
mediaCreat
(
id
,
siteId
)
{
let
mediaDir
=
PROJECTCATALOG
+
"/media/"
...
...
@@ -75,23 +66,34 @@ class MediaCreat {
if
(
!
fs
.
existsSync
(
ymdDir
))
{
fs
.
mkdirSync
(
ymdDir
);
}
let
url
=
`
web_capture_c
-
o
=
..
/
media
/
$
{
siteId
}
/${ymd}/
$
{
id
}.
mp4
-
u
=
"${BACKMEDIACONFIG.url}?classId=${id}&userId=${BACKMEDIACONFIG.userId}&userName=${BACKMEDIACONFIG.userName}&userRole=${BACKMEDIACONFIG.userRole}&portalIP=${BACKMEDIACONFIG.portalIP}&portalPort=${BACKMEDIACONFIG.portalPort}&channels=${BACKMEDIACONFIG.channels}&playRecord=${BACKMEDIACONFIG.playRecord}"
-
d
=
$
{
BACKMEDIACONFIG
.
d
}
-
s
=
$
{
BACKMEDIACONFIG
.
s
}
-
fa
=
$
{
BACKMEDIACONFIG
.
fa
}
-
k
=
$
{
BACKMEDIACONFIG
}
`
let
url
=
`
web_capture_c
-
o
=
..
/
media
/
$
{
siteId
}
/${ymd}/
$
{
id
}.
mp4
-
u
=
"${BACKMEDIACONFIG.url}?classId=${id}&userId=${BACKMEDIACONFIG.userId}&userName=${BACKMEDIACONFIG.userName}&userRole=${BACKMEDIACONFIG.userRole}&portalIP=${BACKMEDIACONFIG.portalIP}&portalPort=${BACKMEDIACONFIG.portalPort}&channels=${BACKMEDIACONFIG.channels}&playRecord=${BACKMEDIACONFIG.playRecord}"
-
d
=
$
{
BACKMEDIACONFIG
.
d
}
-
s
=
$
{
BACKMEDIACONFIG
.
s
}
-
fa
=
$
{
BACKMEDIACONFIG
.
fa
}
-
k
=
$
{
BACKMEDIACONFIG
.
k
}
-
w
=
$
{
BACKMEDIACONFIG
.
w
}
-
h
=
$
{
BACKMEDIACONFIG
.
h
}
`
var
workerProcess
=
spawn
(
url
,
{
cwd
:
PROJECTWINCATALOG
,
shell
:
true
})
// workerProcess.stdout.on('data', async function (data) {
// });
workerProcess
.
on
(
'close'
,
async
function
(
code
)
{
if
(
code
==
0
)
{
let
files
=
fs
.
readdirSync
(
ymdDir
);
if
(
files
.
indexOf
(
id
+
".mp4"
)
==
-
1
)
{
//当前课堂没有写入到文件夹,进入重录
new
MediaCreat
().
mediaCreat
(
id
,
siteId
)
return
false
}
else
{
if
(
parentData
[
siteId
].
indexOf
(
id
.
toString
())
!=
-
1
)
{
parentData
[
siteId
].
splice
(
parentData
[
siteId
].
indexOf
(
id
.
toString
()),
1
)
}
if
(
parentData
[
siteId
].
length
==
0
)
{
// //全部录制完毕
fs
.
writeFile
(
ymdDir
+
"/download.json"
,
`
{
"code"
:
"0"
,
"success"
:
"ok"
}
`
,
function
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
}
});
}
if
(
classid
.
length
)
{
let
shiftData
=
classid
.
shift
()
new
MediaCreat
().
mediaCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
])
}
else
{
// 判断是否有缺录
// let files = fs.readdirSync(ymdDir);
// if (files.length != parentData.length) {
// let notResult = await new MediaCreat().notResult(files,parentData)
// }
if
(
siteIds
.
length
)
{
// 如果有多家需要录制,继续录制下一家
let
isAppend
=
await
new
MediaCreat
().
allData
()
...
...
@@ -101,8 +103,6 @@ class MediaCreat {
}
}
}
}
else
{
new
MediaCreat
().
mediaCreat
(
id
,
siteId
)
}
});
}
...
...
@@ -113,7 +113,7 @@ router.get('/', async function (req, res, next) {
let
isAppend
=
await
new
MediaCreat
().
allData
()
if
(
isAppend
)
{
if
(
classid
.
length
)
{
for
(
let
i
=
0
;
i
<
maxMedia
;
i
++
)
{
for
(
let
i
=
0
;
i
<
GETCLASSURLPARAMETER
.
maxMedia
;
i
++
)
{
let
shiftData
=
classid
.
shift
()
if
(
shiftData
)
{
new
MediaCreat
().
mediaCreat
(
shiftData
[
'classId'
],
shiftData
[
'siteId'
])
...
...
webScreen
@
3ad40110
Subproject commit 3ad4011072147004f3e1cc8db37eada85d7fcc17
webScreen.rar
已删除
100644 → 0
查看文件 @
a842ffc
不能预览此文件类型
请
注册
或
登录
后发表评论