2023-04-16 09:55:33 +03:00
|
|
|
import os
|
|
|
|
import datetime
|
|
|
|
|
|
|
|
|
2023-04-16 18:40:08 +03:00
|
|
|
def generate_name(
|
|
|
|
name=False, subfolder="stacked", extension="png", format="%Y-%m-%d_%H-%M-%S"
|
|
|
|
):
|
2023-04-16 10:12:04 +03:00
|
|
|
os.makedirs(os.path.join(".", "output", subfolder), exist_ok=True)
|
2023-04-16 09:55:33 +03:00
|
|
|
|
|
|
|
if name is False or name == "":
|
|
|
|
name = get_date_text(format)
|
|
|
|
|
2023-04-16 10:12:04 +03:00
|
|
|
return os.path.join(".", "output", subfolder, f"{name}.{extension}")
|
2023-04-16 09:55:33 +03:00
|
|
|
|
|
|
|
|
2023-04-16 10:36:29 +03:00
|
|
|
def generate_name_with_file_name(name, subfolder):
|
|
|
|
os.makedirs(os.path.join(".", "output", subfolder), exist_ok=True)
|
|
|
|
|
|
|
|
return os.path.join(".", "output", subfolder, name)
|
|
|
|
|
|
|
|
|
2023-04-16 18:40:08 +03:00
|
|
|
def get_date_text(format="%Y-%m-%d_%H-%M-%S"):
|
2023-04-16 09:55:33 +03:00
|
|
|
return datetime.datetime.now().strftime(format)
|