-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathloadgit.py
More file actions
65 lines (51 loc) · 1.68 KB
/
loadgit.py
File metadata and controls
65 lines (51 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import random, sys, os, time
from time import sleep
import urllib2
import zipfile
import shutil
import subprocess
import string
#----------------------------------
ramdiskPath = "/home/pi/ramdisk/"
updaPathDw = r"/home/pi/github/"
urlUpdate='https://raw.githubusercontent.com/octopusengine/simple3dscanner/master/'
#https://github.com/octopusengine/simple3dscanner/blob/master/scan.py
#https://raw.githubusercontent.com/octopusengine/simple3dscanner/master/scan.py
numUpdaOk=0
numUpda=0
#----------------------------------
def doNetUpdate(upath,ufile):
global numUpda, numUpdaOk
print ufile
#hh.neXtxt2("d0",ufile)
try:
ufileNet=ufile
#ufileNet=ufile.lower()
urlr = urllib2.urlopen(urlUpdate+ufileNet)
utemp = urlr.read()
urlr.close()
fwu = open(ramdiskPath+ufile,"w")
fwu.write(utemp)
fwu.close()
#hh.neXtxt2("p2",ramdiskPath+ufile)
shutil.copy(ramdiskPath+ufile,upath+ufile)
hh.iSRAdd("net[<span class=red>ok</span>] >> "+ufile)
numUpdaOk=numUpdaOk+1
print "file update OK: "+str(numUpdaOk)
time.sleep(0.5)
except:
numUpda=numUpda+1
#hh.infoRC(".....",tr2,"WHI")
#hh.iSRAdd("net[ ] .. "+ufile)
#hh.neXtxt2("p2","file update OK: "+str(numUpdaOk))
#hh.neXtxt2("p3","no update... "+str(numUpda))
proc = (numUpda+numUpdaOk)*10
#hh.neXcmd("page print")
#hh.neXval("j0",str(int(proc)))
#hh.neXtxt2("pp",str(int(proc))+"%")
print "load scan.py > github"
doNetUpdate(updaPathDw,'scannStart.py')
doNetUpdate(updaPathDw,'oeGPIO.py')
doNetUpdate(updaPathDw,'scannHelp.py')
doNetUpdate(updaPathDw,'scannInit.py')
doNetUpdate(updaPathDw,'scannSetup.py')