quit console.logs
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
43df1e7e10
commit
8dd02ab6ee
|
@ -1,4 +1,3 @@
|
|||
const axios = require('axios');
|
||||
const https = require('https');
|
||||
|
||||
module.exports = Self => {
|
||||
|
@ -39,7 +38,6 @@ module.exports = Self => {
|
|||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
console.log('getFile', filename);
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
|
@ -55,8 +53,7 @@ module.exports = Self => {
|
|||
JOIN packingSite ps ON ps.hostFk = h.id
|
||||
WHERE e.id = ?;`;
|
||||
const [expedition] = await models.Expedition.rawSql(query, [id]);
|
||||
|
||||
const monitorId = '6Ou0D1bhBw'; // expedition.monitorId
|
||||
const monitorId = expedition.monitorId;
|
||||
|
||||
const videoUrl =
|
||||
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`;
|
||||
|
@ -70,21 +67,19 @@ module.exports = Self => {
|
|||
port: 443,
|
||||
headers
|
||||
};
|
||||
console.log('shinobi.verdnatura.es' + videoUrl);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = https.request(httpOptions, shinobiRes => {
|
||||
console.log('entry');
|
||||
shinobiRes.pause();
|
||||
res.writeHeader(shinobiRes.statusCode, shinobiRes.headers);
|
||||
shinobiRes.pipe(res);
|
||||
});
|
||||
|
||||
req.on('error', error => {
|
||||
console.error(error);
|
||||
req.on('error', () => {
|
||||
reject();
|
||||
});
|
||||
|
||||
req.on('end', res => {
|
||||
req.on('end', () => {
|
||||
resolve();
|
||||
});
|
||||
req.end();
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const axios = require('axios');
|
||||
const https = require('https');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
module.exports = Self => {
|
||||
|
@ -49,9 +48,7 @@ module.exports = Self => {
|
|||
JOIN packingSite ps ON ps.hostFk = h.id
|
||||
WHERE e.id = ?;`;
|
||||
const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]);
|
||||
|
||||
const monitorId = '6Ou0D1bhBw';
|
||||
console.log(id, expedition);
|
||||
console.log(expedition);
|
||||
if (!from && !expedition) return [];
|
||||
let start = new Date(expedition.created);
|
||||
let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000));
|
||||
|
@ -63,8 +60,9 @@ module.exports = Self => {
|
|||
const offset = start.getTimezoneOffset();
|
||||
start = new Date(start.getTime() - (offset * 60 * 1000));
|
||||
end = new Date(end.getTime() - (offset * 60 * 1000));
|
||||
console.log(start, end);
|
||||
const videoUrl = `/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}`;
|
||||
|
||||
const videoUrl =
|
||||
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${expedition.monitorId}`;
|
||||
const timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`;
|
||||
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`;
|
||||
|
||||
|
@ -73,7 +71,6 @@ module.exports = Self => {
|
|||
try {
|
||||
response = await axios.get(url);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return [];
|
||||
}
|
||||
return response.data.videos.map(video => video.filename);
|
||||
|
|
|
@ -1,5 +1,2 @@
|
|||
<vn-card>
|
||||
<video id="videobcg" muted controls class="video" autoplay>
|
||||
<source src="http://localhost:5000/api/Boxings/getVideo?id=1" type="video/mp4">
|
||||
</video>
|
||||
</vn-card>
|
||||
|
|
Loading…
Reference in New Issue