Skip to content

Commit

Permalink
fix(impulseButton): fix support for new raspivid file
Browse files Browse the repository at this point in the history
  • Loading branch information
saoron committed May 1, 2018
1 parent 07af7e9 commit 5837af4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"drideOS","version":"0.13.0","settings":{"debug":false,"videoRecord":true,"flipVideo":false,"gps":false,"speaker":false,"mic":false,"indicator":true,"resolution":"720","fps":30,"clipLength":1,"gSensorSensitivity":"medium","netwrok":{"ssid":"dride","password":"ilovedride"}}}
{"name":"drideOS","version":"1.0.0-rc.0","settings":{"debug":false,"videoRecord":true,"flipVideo":false,"gps":false,"speaker":false,"mic":false,"indicator":true,"resolution":"720","fps":30,"clipLength":1,"gSensorSensitivity":"medium","netwrok":{"ssid":"dride","password":"ilovedride"}}}
10 changes: 6 additions & 4 deletions daemons/bluetooth/videoReady.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ videoReady.startListner = clickTimeStamp => {
/**
* We might get unwated encoded video clips during the watch period, So we filter them so we will get the clip we need.
*/
if (filename < clickTimeStamp || filename - clickTimeStamp > 60) {
return;
}

filename = filename.replace('.jpg', '');

if (clickTimeStamp - filename * 1000 < 0 || clickTimeStamp - filename * 1000 > 60000) {
return;
}

// save currentTimestamp in the db
var emrVideos = JSON.parse(fs.readFileSync('/home/core/modules/video/savedVideos.json', 'utf8'));
if (!emrVideos) {
Expand All @@ -50,8 +51,9 @@ videoReady.startListner = clickTimeStamp => {

//make sure this was not published before
found = false;

for (var i = 0; i < emrVideos.length; i++) {
if (emrVideos[i].key == filename || Math.abs(parseInt(emrVideos[i].key) - parseInt(filename)) < 5000) {
if (emrVideos[i].key == filename) {
found = true;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion dride-ws/server/api/getClips/getClips.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ exports.index = function(req, res) {
key: files[i],
clip: '/clip/' + files[i] + '.mp4',
thumb: '/thumb/' + files[i] + '.jpg',
timestamp: files[i]
timestamp: files[i] * 1000
});
}

Expand Down
1 change: 1 addition & 0 deletions dride-ws/server/api/getEMRClips/getEMRClips.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports.index = function(req, res) {
EMRvideos[i].timestamp = EMRvideos[i].key;
EMRvideos[i].clip = '/clip/' + EMRvideos[i].key + '.mp4';
EMRvideos[i].thumb = '/thumb/' + EMRvideos[i].key + '.jpg';
EMRvideos[i].timestamp = EMRvideos[i].timestamp * 1000;
}

res.json({
Expand Down
2 changes: 1 addition & 1 deletion state/config.backup.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"name":"drideOS","version":"0.13.0","settings":{"debug":false,"videoRecord":true,"flipVideo":false,"gps":false,"speaker":false,"mic":false,"indicator":true,"resolution":"720","fps":30,"clipLength":1,"gSensorSensitivity":"medium","netwrok":{"ssid":"dride","password":"ilovedride"}}}
{"name":"drideOS","version":"1.0.0-rc.0","settings":{"debug":false,"videoRecord":true,"flipVideo":false,"gps":false,"speaker":false,"mic":false,"indicator":true,"resolution":"720","fps":30,"clipLength":1,"gSensorSensitivity":"medium","netwrok":{"ssid":"dride","password":"ilovedride"}}}

0 comments on commit 5837af4

Please sign in to comment.