From e203b931d605f7ca423b3ec417a9d5ec3dd6cdd8 Mon Sep 17 00:00:00 2001 From: yorch Date: Thu, 29 Sep 2016 18:35:10 -0700 Subject: [PATCH] Added a python script to figure out if a MAkinE project has already a floder for todays reviews, and if not, it creates it. --- python/get_project_root.py | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 python/get_project_root.py diff --git a/python/get_project_root.py b/python/get_project_root.py new file mode 100755 index 0000000..fbfeef8 --- /dev/null +++ b/python/get_project_root.py @@ -0,0 +1,42 @@ +#! /usr/bin/env python3 +import os, datetime + +current_path=os.getcwd() +server_base="/Volumes/pegasus/01_PROJECTS/" +reviews_base="10_Review/" + +def get_timestamp(): + + today = datetime.date.today() + curr_year = str(today.year)[2:4] + curr_month = str(today.month) + curr_day = str(today.day) + if len(curr_month) < 2 : + curr_month = '0' + curr_month + if len(curr_day) < 2 : + curr_day = '0' + curr_day + + time_stamp = curr_month + curr_day + curr_year + return time_stamp + +def get_project_base(): + project_base=current_path.split("/")[4] + return project_base + +def is_project(): + result = current_path.find(server_base) == 0 + return result + +def create_todays_review_folder(): + + tentative_path = server_base + get_project_base() + os.sep + reviews_base + get_timestamp() + + if not os.path.exists(tentative_path): + #os.makedirs(tentative_path) + print('folder_created at : '+ tentative_path) + else: + print('folder already exists') + + return + +print(create_todays_review_folder())