Files
ArcadeDatabase_MiSTer/Automatic.py
2023-01-09 18:05:06 +01:00

19 lines
721 B
Python

import os
import shutil
import subprocess
import time
# get current date in yymmdd format
current_date = time.strftime("%y%m%d")
# delete the folder called mad in current directory
if os.path.exists("mad"):
shutil.rmtree("mad")
# rename MiSTerArcadeDatabase - sheet1.csv to ArcadeDatabase230109.csv if ArcadeDatabase230109.csv does not exist and MiSTerArcadeDatabase - sheet1.csv exists
if not os.path.exists("ArcadeDatabase" + current_date + ".csv") and os.path.exists("MiSTerArcadeDatabase - sheet1.csv"):
os.rename("MiSTerArcadeDatabase - sheet1.csv", "ArcadeDatabase" + current_date + ".csv")
# execute the csv2mad.py script
subprocess.call(["python", "csv2mad.py", "ArcadeDatabase" + current_date + ".csv"])