Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def list_camera_files(camera, path='/'):
""" Returns a list of all the image files on the camera """
result = []
# get files
for name, value in gp.check_result(
gp.gp_camera_folder_list_files(camera, path)):
result.append(os.path.join(path, name))
# read folders
folders = []
for name, value in gp.check_result(
gp.gp_camera_folder_list_folders(camera, path)):
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_camera_files(camera, os.path.join(path, name)))
return result
def list_camera_files(camera, path='/'):
result = []
# get files
gp_list = gp.check_result(
gp.gp_camera_folder_list_files(camera, path))
for name, value in gp_list:
result.append(os.path.join(path, name))
# read folders
folders = []
gp_list = gp.check_result(
gp.gp_camera_folder_list_folders(camera, path))
for name, value in gp_list:
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_camera_files(camera, os.path.join(path, name)))
return result
def list_files(camera, path='/'):
result = []
# get files
for name, value in gp.check_result(
gp.gp_camera_folder_list_files(camera, path)):
result.append(os.path.join(path, name))
# read folders
folders = []
for name, value in gp.check_result(
gp.gp_camera_folder_list_folders(camera, path)):
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_files(camera, os.path.join(path, name)))
return result
def list_camera_files(camera, path='/'):
""" Returns a list of all the image files on the camera """
result = []
# get files
for name, value in gp.check_result(
gp.gp_camera_folder_list_files(camera, path)):
result.append(os.path.join(path, name))
# read folders
folders = []
for name, value in gp.check_result(
gp.gp_camera_folder_list_folders(camera, path)):
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_camera_files(camera, os.path.join(path, name)))
return result
def list_files(camera, path='/'):
result = []
# get files
for name, value in gp.check_result(
gp.gp_camera_folder_list_files(camera, path)):
result.append(os.path.join(path, name))
# read folders
folders = []
for name, value in gp.check_result(
gp.gp_camera_folder_list_folders(camera, path)):
folders.append(name)
# recurse over subfolders
for name in folders:
result.extend(list_files(camera, os.path.join(path, name)))
return result