Skip to content

Commit

Permalink
Merge pull request #27 from TUS-OSK/tweak
Browse files Browse the repository at this point in the history
Tweak
  • Loading branch information
ilim0t authored Jul 27, 2019
2 parents 76e81a3 + d057b24 commit 5082d49
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ disk
input = 'ffmpeg -i /dev/video0';
}
daemon(
`${input} -vcodec libx264 -pix_fmt yuv420p -preset veryfast -tune zerolatency,stillimage,film -vb 2500k -vf "drawtext=text='%{localtime}':fontcolor=white@0.8:x=0:y=h-lh*1.2:fontsize=24" -f flv rtmp://localhost:${1935}/live/bushitsuchan -loglevel warning`,
`${input} -vcodec libx264 -pix_fmt yuv420p -preset veryfast -tune zerolatency,stillimage,film -vb 2500k -vf "drawtext=text='%{localtime}':fontcolor=blue@1:x=0:y=h-lh*1.2:fontsize=24" -f flv rtmp://localhost:${1935}/live/bushitsuchan -loglevel warning`,
);
daemon(
`ffmpeg -i rtmp://localhost:1935/live/bushitsuchan -hls_flags delete_segments -g 40 -f hls ${mountPath}/output.m3u8 -loglevel warning`,
Expand Down
2 changes: 1 addition & 1 deletion ngrok.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ const ngrok = require('ngrok');

module.exports.run = async (token, port = 3000) => {
await ngrok.authtoken(token);
const url = await ngrok.connect(port);
const url = await ngrok.connect({ addr: port, region: 'ap' });
return url;
};
154 changes: 125 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
},
"homepage": "https://github.com/TUS-OSK/bushitsuchan-PC#readme",
"dependencies": {
"@slack/interactive-messages": "^1.1.1",
"@slack/web-api": "^5.0.1",
"@slack/interactive-messages": "^1.2.0",
"@slack/web-api": "^5.1.0",
"axios": "^0.19.0",
"body-parser": "^1.19.0",
"child_process": "^1.0.2",
Expand All @@ -28,7 +28,7 @@
"cors": "^2.8.5",
"express": "^4.17.1",
"fs": "0.0.1-security",
"helmet": "^3.19.0",
"helmet": "^3.20.0",
"morgan": "^1.9.1",
"ngrok": "^3.2.3",
"node-media-server": "^2.1.2",
Expand Down
8 changes: 4 additions & 4 deletions slack.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = (awsUrl, contactChannel, rtmpAddress, slackBotAccessToken, slac
if (!former || !store.get(key)) {
respond({
text:
'失敗 おそらくすでに無期限延長されているか,写真がされたあとプログラムが再実行されたことに起因すると思慮されます。',
'失敗 おそらくすでに無期限延長されているか,写真がされたあと部室ちゃんが再実行されたことに起因すると思慮されます。',
response_type: 'ephemeral',
replace_original: false,
});
Expand All @@ -80,15 +80,15 @@ module.exports = (awsUrl, contactChannel, rtmpAddress, slackBotAccessToken, slac
if (!chunks) {
respond({
text:
'失敗 おそらく写真がされたあとプログラムが再実行されたことに起因すると思慮されます。',
'失敗 おそらく写真がされたあと部室ちゃんが再実行されたことに起因すると思慮されます。',
response_type: 'ephemeral',
replace_original: false,
});
return;
}

fs.mkdirSync(`${__dirname}/photos`, { recursive: true });
fs.writeFileSync(`${__dirname}/photos/${base64Encode(key)}.jpg`, chunks.data);
fs.writeFileSync(`${__dirname}/photos/${base64Encode(key)}.jpg`, Buffer.from(chunks));

template = template.replace(/\${expired-time}/g, '写真はずっと表示されます');
}
Expand Down Expand Up @@ -168,7 +168,7 @@ module.exports = (awsUrl, contactChannel, rtmpAddress, slackBotAccessToken, slac
return;
}
res.contentType('image/jpg');
res.send(Buffer.from(chunks.data));
res.send(Buffer.from(chunks));
});

router.get('/thumb.jpg', (req, res) => {
Expand Down
3 changes: 3 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ module.exports.daemon = async (command, ms = 1000 * 10, maxCount = 100) => {
// eslint-disable-next-line no-await-in-loop
await module.exports.exec(command);
} catch (e) {
if (i === 0) {
console.error(e);
}
logger.error(e);
// eslint-disable-next-line no-await-in-loop
await wait(ms);
Expand Down

0 comments on commit 5082d49

Please sign in to comment.