Skip to content

Commit c31491f

Browse files
author
PolygonalTree
committed
solve some bugs
1 parent 94def95 commit c31491f

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

mask.msk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"ROIS": [[[46, 66], [46, 94], [500, 94], [500, 66]], [[46, 94], [46, 122], [500, 122], [500, 94]], [[46, 120], [46, 148], [500, 148], [500, 120]], [[46, 148], [46, 176], [500, 176], [500, 148]], [[46, 174], [46, 202], [500, 202], [500, 174]], [[46, 202], [46, 230], [500, 230], [500, 202]], [[46, 228], [46, 256], [500, 256], [500, 228]], [[46, 256], [46, 284], [500, 284], [500, 256]], [[46, 282], [46, 310], [500, 310], [500, 282]], [[46, 310], [46, 338], [500, 338], [500, 310]], [[46, 336], [46, 364], [500, 364], [500, 336]], [[46, 364], [46, 392], [500, 392], [500, 364]], [[46, 390], [46, 418], [500, 418], [500, 390]], [[46, 418], [46, 446], [500, 446], [500, 418]], [[46, 444], [46, 472], [500, 472], [500, 444]], [[46, 472], [46, 500], [500, 500], [500, 472]], [[500, 66], [500, 94], [954, 94], [954, 66]], [[500, 94], [500, 122], [954, 122], [954, 94]], [[500, 120], [500, 148], [954, 148], [954, 120]], [[500, 148], [500, 176], [954, 176], [954, 148]], [[500, 174], [500, 202], [954, 202], [954, 174]], [[500, 202], [500, 230], [954, 230], [954, 202]], [[500, 228], [500, 256], [954, 256], [954, 228]], [[500, 256], [500, 284], [954, 284], [954, 256]], [[500, 282], [500, 310], [954, 310], [954, 282]], [[500, 310], [500, 338], [954, 338], [954, 310]], [[500, 336], [500, 364], [954, 364], [954, 336]], [[500, 364], [500, 392], [954, 392], [954, 364]], [[500, 390], [500, 418], [954, 418], [954, 390]], [[500, 418], [500, 446], [954, 446], [954, 418]], [[500, 444], [500, 472], [954, 472], [954, 444]], [[500, 472], [500, 500], [954, 500], [954, 472]]], "pointsToTrack": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "referencePoints": "none", "serial": "NO_SERIAL"}
1+
{"ROIS": [[[9, 44], [9, 74], [251, 74], [251, 44]], [[9, 74], [9, 104], [251, 104], [251, 74]], [[9, 106], [9, 136], [251, 136], [251, 106]], [[9, 136], [9, 166], [251, 166], [251, 136]], [[9, 168], [9, 198], [251, 198], [251, 168]], [[9, 198], [9, 228], [251, 228], [251, 198]], [[9, 230], [9, 260], [251, 260], [251, 230]], [[9, 260], [9, 290], [251, 290], [251, 260]], [[9, 292], [9, 322], [251, 322], [251, 292]], [[9, 322], [9, 352], [251, 352], [251, 322]], [[9, 352], [9, 382], [251, 382], [251, 352]], [[9, 384], [9, 414], [251, 414], [251, 384]], [[9, 414], [9, 444], [251, 444], [251, 414]], [[9, 446], [9, 476], [251, 476], [251, 446]], [[9, 476], [9, 506], [251, 506], [251, 476]], [[9, 508], [9, 538], [251, 538], [251, 508]], [[251, 44], [251, 74], [493, 74], [493, 44]], [[251, 74], [251, 104], [493, 104], [493, 74]], [[251, 106], [251, 136], [493, 136], [493, 106]], [[251, 136], [251, 166], [493, 166], [493, 136]], [[251, 168], [251, 198], [493, 198], [493, 168]], [[251, 198], [251, 228], [493, 228], [493, 198]], [[251, 230], [251, 260], [493, 260], [493, 230]], [[251, 260], [251, 290], [493, 290], [493, 260]], [[251, 292], [251, 322], [493, 322], [493, 292]], [[251, 322], [251, 352], [493, 352], [493, 322]], [[251, 352], [251, 382], [493, 382], [493, 352]], [[251, 384], [251, 414], [493, 414], [493, 384]], [[251, 414], [251, 444], [493, 444], [493, 414]], [[251, 446], [251, 476], [493, 476], [493, 446]], [[251, 476], [251, 506], [493, 506], [493, 476]], [[251, 508], [251, 538], [493, 538], [493, 508]]], "serial": "NO_SERIAL", "referencePoints": "none", "pointsToTrack": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]}

pysolovideo.py

-2
Original file line numberDiff line numberDiff line change
@@ -1577,8 +1577,6 @@ def writeActivity(self, fps=0, extend=True):
15771577
1 09 Dec 11 19:02:19 1 0 1 0 0 0 ? [actual_activity]
15781578
"""
15791579

1580-
print "activity"
1581-
15821580
#Here we build the header
15831581
dt = datetime.datetime.fromtimestamp( self.getFrameTime() )
15841582

server.py

+19-13
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from signal import SIGTERM
77
import json
88

9-
basedir=path.dirname(__file__)
9+
basedir=path.dirname(os.path.realpath(__file__))
1010

1111
app = Bottle()
1212

@@ -139,7 +139,7 @@ def downloadData(machineID):
139139
mid = checkMachineId()
140140
if mid == machineID:
141141
#TODO:Add a "last downloaded"
142-
return static_file(outputfile, root='/', download=outputfile)
142+
return static_file(outputfile, root='/')
143143
else:
144144
redirect("/")
145145

@@ -151,14 +151,17 @@ def deleteData(machineID):
151151
if mid == machineID:
152152
if isAlreadyRunning:
153153
#save the last 10 lines
154-
f = open(outputfile, 'r')
155-
f.seek(10, 2)
154+
f = open(outputfile, 'rb')
155+
f.seek(-1000,2)
156156
data = f.readlines()
157157
f.close()
158158
f = open(outputfile, 'w')
159-
f.write(data)
159+
for line in data[1:]:
160+
l = line.decode('utf-8')
161+
f.write(l)
160162
else:
161163
#erease everything.
164+
print(outputfile)
162165
f=open(outputfile, 'w')
163166
f.close()
164167
redirect("/")
@@ -207,15 +210,18 @@ def checkMachineId():
207210
return piId
208211

209212
def readData():
210-
f = open(outputfile,'r')
211-
lines = f.readlines()
213+
f = open(outputfile,'rb')
214+
try:
215+
f.seek(-1000,2)
216+
lines = f.readlines()
217+
line = lines[-1].decode('utf8').split('\t')
218+
jsonData = json.dumps(line)
219+
except:
220+
print("no data in outpufile")
221+
222+
pass
212223
f.close()
213-
jsonData = 0
214-
if len(lines)>0:
215-
lastData = lines[-1]
216-
splitedData = lastData.split('\t')
217-
jsonData = json.dumps(splitedData)
218-
#print (jsonData)
224+
219225
return jsonData
220226

221227
"""The main program"""

static/js/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ app.controller('deleteDataCtrl',['$scope', '$http',function($scope,$http){
382382
$scope.deleteData = function(){
383383
var d = confirm("Are You sure you want to delete all the data?");
384384
if(d == true){
385-
var mid = $("#machineid").text().split(": ")[1];
385+
var mid = $("#machineid").text();
386386
$http.delete("/deleteData/"+mid);
387387
}
388388
};

0 commit comments

Comments
 (0)