Commit e067c977 authored by Tony Mai's avatar Tony Mai

update

parent afa27fda
This diff is collapsed.
...@@ -87,6 +87,9 @@ def run(folder_dst=None,ptr=None): ...@@ -87,6 +87,9 @@ def run(folder_dst=None,ptr=None):
#msg("Restart wlan1...")
#os.system("systemctl daemon-reload")
#os.system("systemctl restart dhcpcd")
msg("Checking wlan1...") msg("Checking wlan1...")
try: try:
...@@ -97,6 +100,16 @@ def run(folder_dst=None,ptr=None): ...@@ -97,6 +100,16 @@ def run(folder_dst=None,ptr=None):
gpCam = GoProCamera.GoPro() gpCam = GoProCamera.GoPro()
try:
gpCam.pair(usepin=False)
#gpCam.pair(usepin=True)
except:
msg("Cannot Pair to Gopro. Exit...")
return
#if ping(gpCam.ip_addr): #if ping(gpCam.ip_addr):
# msg ("Ping gopro ("+gpCam.ip_addr+") failed. Exit...") # msg ("Ping gopro ("+gpCam.ip_addr+") failed. Exit...")
# return # return
...@@ -104,9 +117,6 @@ def run(folder_dst=None,ptr=None): ...@@ -104,9 +117,6 @@ def run(folder_dst=None,ptr=None):
# msg ("Ping gopro ok.") # msg ("Ping gopro ok.")
gpCam.pair(usepin=False)
#gpCam.pair(usepin=True)
os.system("mkdir "+folder_dst) os.system("mkdir "+folder_dst)
...@@ -121,12 +131,17 @@ def run(folder_dst=None,ptr=None): ...@@ -121,12 +131,17 @@ def run(folder_dst=None,ptr=None):
start_time = time.time() start_time = time.time()
msg ("Start time :"+str(localtime)) msg ("Start time :"+str(localtime))
camera_info(gpCam) camera_info(gpCam)
data=gpCam.listMedia(True,True) data=gpCam.listMedia(True,True)
for i in range (len(data)): for i in range (len(data)):
msg(str(data[i])) msg(str(data[i]))
#data=gpCam.listMedia(True,True) #data=gpCam.listMedia(True,True)
try:
for i in data: for i in data:
folder=i[0] folder=i[0]
if not os.path.exists(folder_dst+"/"+folder): if not os.path.exists(folder_dst+"/"+folder):
...@@ -150,7 +165,8 @@ def run(folder_dst=None,ptr=None): ...@@ -150,7 +165,8 @@ def run(folder_dst=None,ptr=None):
thm_file=re.sub(".MP4",".THM",mp4_file) thm_file=re.sub(".MP4",".THM",mp4_file)
#msg("copy "+folder+"/"+thm_file+" to "+folder_dst); #msg("copy "+folder+"/"+thm_file+" to "+folder_dst);
gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file) gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file)
except:
msg("Fail copy to "+folder_dst);
msg ("Done") msg ("Done")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment