Skip to content

Commit 565d035

Browse files
author
PolygonalTree
committed
solve some bugs in dektopApp
1 parent 87c135f commit 565d035

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

DesktopApp/desktopApp.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self):
1717
QtCore.QThread.__init__(self)
1818

1919
def run(self):
20-
interval = 60
20+
interval = 86400
2121
lastSave = time.time()
2222
#print ("lastSave,{}".format(lastSave))
2323
while autoSaveIsRunning:
@@ -30,7 +30,7 @@ def run(self):
3030
#get data
3131
url = pi+':8088/downloadData/'+parse.quote(nameList[i])
3232

33-
downloadChunks(url,nameList[i])
33+
self.downloadChunks(url,nameList[i])
3434
#print(url)
3535
#try:
3636
req = urllib.Request(url=url)
@@ -51,7 +51,7 @@ def run(self):
5151
i=i+1
5252
lastSave = time.time()
5353

54-
time.sleep(interval)
54+
time.sleep(2)
5555
print("Thread ended")
5656

5757

@@ -68,7 +68,7 @@ def isRecording(self,pi):
6868
except:
6969
print("error getting state")
7070

71-
def downloadChunks(url,filename):
71+
def downloadChunks(self,url,filename):
7272
"""
7373
Helper to download large files
7474
the only arg is a url
@@ -84,9 +84,9 @@ def downloadChunks(url,filename):
8484
#temp_path = "/tmp/"
8585
try:
8686
#file = os.path.join(temp_path,baseFile)
87-
file = "./dowloadedData"+filename
87+
file = "./"+filename
8888
req = urllib.urlopen(url)
89-
total_size = int(req.info().getheader('Content-Length').strip())
89+
total_size = int(req.info().get('Content-Length').strip())
9090
downloaded = 0
9191
CHUNK = 256 * 10240
9292
with open(file, 'wb') as fp:
@@ -99,7 +99,7 @@ def downloadChunks(url,filename):
9999
except error.HTTPError:
100100
print ("HTTP Error:", url)
101101
return False
102-
except urllib.error.URLError:
102+
except error.URLError:
103103
print ("URL Error:", url)
104104
return False
105105

mask.msk

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"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], "serial": "NO_SERIAL", "referencePoints": "none", "ROIS": [[[9, 12], [9, 48], [398, 48], [398, 12]], [[9, 48], [9, 83], [398, 83], [398, 48]], [[9, 84], [9, 120], [398, 120], [398, 84]], [[9, 120], [9, 155], [398, 155], [398, 120]], [[9, 156], [9, 192], [398, 192], [398, 156]], [[9, 192], [9, 227], [398, 227], [398, 192]], [[9, 228], [9, 264], [398, 264], [398, 228]], [[9, 264], [9, 299], [398, 299], [398, 264]], [[9, 300], [9, 336], [398, 336], [398, 300]], [[9, 336], [9, 371], [398, 371], [398, 336]], [[9, 371], [9, 406], [398, 406], [398, 371]], [[9, 408], [9, 443], [398, 443], [398, 408]], [[9, 443], [9, 478], [398, 478], [398, 443]], [[9, 480], [9, 515], [398, 515], [398, 480]], [[9, 515], [9, 550], [398, 550], [398, 515]], [[9, 552], [9, 587], [398, 587], [398, 552]], [[398, 12], [398, 48], [787, 48], [787, 12]], [[398, 48], [398, 83], [787, 83], [787, 48]], [[398, 84], [398, 120], [787, 120], [787, 84]], [[398, 120], [398, 155], [787, 155], [787, 120]], [[398, 156], [398, 192], [787, 192], [787, 156]], [[398, 192], [398, 227], [787, 227], [787, 192]], [[398, 228], [398, 264], [787, 264], [787, 228]], [[398, 264], [398, 299], [787, 299], [787, 264]], [[398, 300], [398, 336], [787, 336], [787, 300]], [[398, 336], [398, 371], [787, 371], [787, 336]], [[398, 371], [398, 406], [787, 406], [787, 371]], [[398, 408], [398, 443], [787, 443], [787, 408]], [[398, 443], [398, 478], [787, 478], [787, 443]], [[398, 480], [398, 515], [787, 515], [787, 480]], [[398, 515], [398, 550], [787, 550], [787, 515]], [[398, 552], [398, 587], [787, 587], [787, 552]]]}
1+
{"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, 1], "serial": "NO_SERIAL", "ROIS": [[[16, 52], [16, 452], [790, 452], [790, 52]], [[16, 52], [16, 78], [403, 78], [403, 52]], [[16, 78], [16, 104], [403, 104], [403, 78]], [[16, 102], [16, 128], [403, 128], [403, 102]], [[16, 128], [16, 153], [403, 153], [403, 128]], [[16, 153], [16, 179], [403, 179], [403, 153]], [[16, 177], [16, 203], [403, 203], [403, 177]], [[16, 203], [16, 228], [403, 228], [403, 203]], [[16, 227], [16, 252], [403, 252], [403, 227]], [[16, 252], [16, 278], [403, 278], [403, 252]], [[16, 278], [16, 304], [403, 304], [403, 278]], [[16, 302], [16, 328], [403, 328], [403, 302]], [[16, 328], [16, 353], [403, 353], [403, 328]], [[16, 353], [16, 379], [403, 379], [403, 353]], [[16, 377], [16, 403], [403, 403], [403, 377]], [[16, 403], [16, 428], [403, 428], [403, 403]], [[16, 427], [16, 452], [403, 452], [403, 427]], [[403, 52], [403, 78], [790, 78], [790, 52]], [[403, 78], [403, 104], [790, 104], [790, 78]], [[403, 102], [403, 128], [790, 128], [790, 102]], [[403, 128], [403, 153], [790, 153], [790, 128]], [[403, 153], [403, 179], [790, 179], [790, 153]], [[403, 177], [403, 203], [790, 203], [790, 177]], [[403, 203], [403, 228], [790, 228], [790, 203]], [[403, 227], [403, 252], [790, 252], [790, 227]], [[403, 252], [403, 278], [790, 278], [790, 252]], [[403, 278], [403, 304], [790, 304], [790, 278]], [[403, 302], [403, 328], [790, 328], [790, 302]], [[403, 328], [403, 353], [790, 353], [790, 328]], [[403, 353], [403, 379], [790, 379], [790, 353]], [[403, 377], [403, 403], [790, 403], [790, 377]], [[403, 403], [403, 428], [790, 428], [790, 403]], [[403, 427], [403, 452], [790, 452], [790, 427]]]}

0 commit comments

Comments
 (0)