Skip to content

Commit

Permalink
add option to export legacy files
Browse files Browse the repository at this point in the history
  • Loading branch information
skydeo committed Feb 4, 2022
1 parent 2d8a96b commit c334c34
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions collection-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def export_kml(dataframe, filename):
)


def process_holes(holes_database, filename):
def process_holes(holes_database, filename, export_legacy_files=False):
print(f"Loading {holes_database}...", end="\r", flush=True)
load_start_time = timeit.default_timer()

Expand All @@ -164,8 +164,9 @@ def process_holes(holes_database, filename):
)

print(flush=True)
export_csv(dataframe=dataframe, filename=filename + ".csv")
export_html(dataframe=dataframe, filename=filename + ".txt")
if export_legacy_files:
export_csv(dataframe=dataframe, filename=filename + ".csv")
export_html(dataframe=dataframe, filename=filename + ".txt")
export_kml(dataframe=dataframe, filename=filename + ".kml")
print(flush=True)

Expand Down Expand Up @@ -223,6 +224,13 @@ def main():
action="store_true",
help="Export files with the date in the filename (e.g., collection_YYYYMMDD.csv).",
)
options.add_argument(
"-l",
"--legacy-files",
metavar="Generate legacy files",
action="store_true",
help="Generate and export legacy files (csv, txt).",
)

args = parser.parse_args()

Expand All @@ -246,7 +254,7 @@ def main():
else "collection_" + datetime.datetime.now().strftime("%Y%m%d")
)
export_filename = os.path.join(args.output_directory, export_filename)
process_holes(args.database_file, export_filename)
process_holes(args.database_file, export_filename, args.legacy_files)


if __name__ == "__main__":
Expand Down

0 comments on commit c334c34

Please sign in to comment.