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');
|
const https = require('https');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
@ -39,7 +38,6 @@ module.exports = Self => {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const myOptions = {};
|
const myOptions = {};
|
||||||
|
|
||||||
console.log('getFile', filename);
|
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
@ -55,8 +53,7 @@ module.exports = Self => {
|
||||||
JOIN packingSite ps ON ps.hostFk = h.id
|
JOIN packingSite ps ON ps.hostFk = h.id
|
||||||
WHERE e.id = ?;`;
|
WHERE e.id = ?;`;
|
||||||
const [expedition] = await models.Expedition.rawSql(query, [id]);
|
const [expedition] = await models.Expedition.rawSql(query, [id]);
|
||||||
|
const monitorId = expedition.monitorId;
|
||||||
const monitorId = '6Ou0D1bhBw'; // expedition.monitorId
|
|
||||||
|
|
||||||
const videoUrl =
|
const videoUrl =
|
||||||
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`;
|
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`;
|
||||||
|
@ -70,21 +67,19 @@ module.exports = Self => {
|
||||||
port: 443,
|
port: 443,
|
||||||
headers
|
headers
|
||||||
};
|
};
|
||||||
console.log('shinobi.verdnatura.es' + videoUrl);
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const req = https.request(httpOptions, shinobiRes => {
|
const req = https.request(httpOptions, shinobiRes => {
|
||||||
console.log('entry');
|
|
||||||
shinobiRes.pause();
|
shinobiRes.pause();
|
||||||
res.writeHeader(shinobiRes.statusCode, shinobiRes.headers);
|
res.writeHeader(shinobiRes.statusCode, shinobiRes.headers);
|
||||||
shinobiRes.pipe(res);
|
shinobiRes.pipe(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
req.on('error', error => {
|
req.on('error', () => {
|
||||||
console.error(error);
|
reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
req.on('end', res => {
|
req.on('end', () => {
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
req.end();
|
req.end();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const https = require('https');
|
|
||||||
const models = require('vn-loopback/server/server').models;
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
@ -49,9 +48,7 @@ module.exports = Self => {
|
||||||
JOIN packingSite ps ON ps.hostFk = h.id
|
JOIN packingSite ps ON ps.hostFk = h.id
|
||||||
WHERE e.id = ?;`;
|
WHERE e.id = ?;`;
|
||||||
const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]);
|
const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]);
|
||||||
|
console.log(expedition);
|
||||||
const monitorId = '6Ou0D1bhBw';
|
|
||||||
console.log(id, expedition);
|
|
||||||
if (!from && !expedition) return [];
|
if (!from && !expedition) return [];
|
||||||
let start = new Date(expedition.created);
|
let start = new Date(expedition.created);
|
||||||
let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000));
|
let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000));
|
||||||
|
@ -63,8 +60,9 @@ module.exports = Self => {
|
||||||
const offset = start.getTimezoneOffset();
|
const offset = start.getTimezoneOffset();
|
||||||
start = new Date(start.getTime() - (offset * 60 * 1000));
|
start = new Date(start.getTime() - (offset * 60 * 1000));
|
||||||
end = new Date(end.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 timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`;
|
||||||
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`;
|
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`;
|
||||||
|
|
||||||
|
@ -73,7 +71,6 @@ module.exports = Self => {
|
||||||
try {
|
try {
|
||||||
response = await axios.get(url);
|
response = await axios.get(url);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return response.data.videos.map(video => video.filename);
|
return response.data.videos.map(video => video.filename);
|
||||||
|
|
|
@ -1,5 +1,2 @@
|
||||||
<vn-card>
|
<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>
|
</vn-card>
|
||||||
|
|
Loading…
Reference in New Issue