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):
#msg("Restart wlan1...")
#os.system("systemctl daemon-reload")
#os.system("systemctl restart dhcpcd")
msg("Checking wlan1...")
try:
......@@ -96,6 +99,16 @@ def run(folder_dst=None,ptr=None):
return
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):
# msg ("Ping gopro ("+gpCam.ip_addr+") failed. Exit...")
......@@ -104,9 +117,6 @@ def run(folder_dst=None,ptr=None):
# msg ("Ping gopro ok.")
gpCam.pair(usepin=False)
#gpCam.pair(usepin=True)
os.system("mkdir "+folder_dst)
......@@ -121,36 +131,42 @@ def run(folder_dst=None,ptr=None):
start_time = time.time()
msg ("Start time :"+str(localtime))
camera_info(gpCam)
data=gpCam.listMedia(True,True)
for i in range (len(data)):
msg(str(data[i]))
#data=gpCam.listMedia(True,True)
try:
for i in data:
folder=i[0]
if not os.path.exists(folder_dst+"/"+folder):
os.makedirs(folder_dst+"/"+folder);
mp4_file=i[1]
lrv_file=re.sub(".MP4",".LRV",mp4_file)
for i in data:
folder=i[0]
if not os.path.exists(folder_dst+"/"+folder):
os.makedirs(folder_dst+"/"+folder);
mp4_file=i[1]
lrv_file=re.sub(".MP4",".LRV",mp4_file)
msg("copy "+folder+"/"+mp4_file+" to "+folder_dst);
gpCam.downloadMedia(folder,mp4_file,folder_dst+"/"+folder+"/"+mp4_file)
msg("copy "+folder+"/"+lrv_file+" to "+folder_dst);
gpCam.downloadMedia(folder,lrv_file,folder_dst+"/"+folder+"/"+lrv_file)
if re.search("GPBK",mp4_file) or re.search("GB",mp4_file):
wav_file=re.sub(".MP4",".WAV",mp4_file)
#msg("copy "+folder+"/"+wav_file+" to "+folder_dst);
gpCam.downloadMedia(folder,wav_file,folder_dst+"/"+folder+"/"+wav_file)
if re.search("GPBK",mp4_file):
thm_file=re.sub(".MP4",".THM",mp4_file)
#msg("copy "+folder+"/"+thm_file+" to "+folder_dst);
gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file)
if re.search("GPFR",mp4_file):
thm_file=re.sub(".MP4",".THM",mp4_file)
#msg("copy "+folder+"/"+thm_file+" to "+folder_dst);
gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file)
msg("copy "+folder+"/"+mp4_file+" to "+folder_dst);
gpCam.downloadMedia(folder,mp4_file,folder_dst+"/"+folder+"/"+mp4_file)
msg("copy "+folder+"/"+lrv_file+" to "+folder_dst);
gpCam.downloadMedia(folder,lrv_file,folder_dst+"/"+folder+"/"+lrv_file)
if re.search("GPBK",mp4_file) or re.search("GB",mp4_file):
wav_file=re.sub(".MP4",".WAV",mp4_file)
#msg("copy "+folder+"/"+wav_file+" to "+folder_dst);
gpCam.downloadMedia(folder,wav_file,folder_dst+"/"+folder+"/"+wav_file)
if re.search("GPBK",mp4_file):
thm_file=re.sub(".MP4",".THM",mp4_file)
#msg("copy "+folder+"/"+thm_file+" to "+folder_dst);
gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file)
if re.search("GPFR",mp4_file):
thm_file=re.sub(".MP4",".THM",mp4_file)
#msg("copy "+folder+"/"+thm_file+" to "+folder_dst);
gpCam.downloadMedia(folder,thm_file,folder_dst+"/"+folder+"/"+thm_file)
except:
msg("Fail copy to "+folder_dst);
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