import sys

if len(sys.argv) <= 1:
	exit(0)

fielddef = [
	("Amb",             "RGB"),
	("Amb_Obj",         "RGB"),
	("Dir",             "RGB"),
	("Sky top",         "RGB"),
	("Sky bot",         "RGB"),
	("SunCore",         "RGB"),
	("SunCorona",       "RGB"),
	("SunSz",           "float"),
	("SprSz",           "float"),
	("SprBght",         "float"),
	("Shdw",            "int"),
	("LightShd",        "int"),
	("PoleShd",         "int"),
	("FarClp",          "float"),
	("FogSt",           "float"),
	("LightOnGround",   "float"),
	("LowCloudsRGB",    "RGB"),
	("BottomCloudRGB",  "RGB"),
	("WaterRGBA",       "RGBA"),   # actually read as %f
	("Alpha1",          "int"),    # actually read as %f
	("RGB1",            "RGB"),    # actually read as %f
	("Alpha2",          "int"),    # actually read as %f
	("RGB2",            "RGB"),    # actually read as %f
	("CloudAlpha",      "int"),    # actually read as %f
	("IntensityLimit",  "int"),
	("WaterFogAlpha",   "int"),
	("DirMult",         "float")
]

fieldnames = [d[0] for d in fielddef]

weathernames = ["EXTRASUNNY_LA", "SUNNY_LA", "EXTRASUNNY_SMOG_LA", "SUNNY_SMOG_LA",
"CLOUDY_LA", "SUNNY_SF", "EXTRASUNNY_SF", "CLOUDY_SF", "RAINY_SF", "FOGGY_SF",
"SUNNY_VEGAS", "EXTRASUNNY_VEGAS", "CLOUDY_VEGAS", "EXTRASUNNY_COUNTRYSIDE",
"SUNNY_COUNTRYSIDE", "CLOUDY_COUNTRYSIDE", "RAINY_COUNTRYSIDE", "EXTRASUNNY_DESERT",
"SUNNY_DESERT", "SANDSTORM_DESERT", "UNDERWATER", "EXTRACOLOURS_1", "EXTRACOLOURS_2"]
NWEATHER = len(weathernames)

timenames = ["Midnight", "5AM", "6AM", "7AM", "Midday", "7PM", "8PM", "10PM"]
NHOUR = len(timenames)

def toNumbers(f):
	def getval(i, t):
		if t == 'int':
			try:
				return (int(f[i]), i+1)
			except:
				return (-1000, i+i)
		elif t == 'float':
			try:
				return (float(f[i]), i+1)
			except:
				return (1.0, i+i)
		elif t == 'RGB':
			try:
				return ([int(f[i]), int(f[i+1]), int(f[i+2])], i+3)
			except:
				return ([-100, -100, -100], i+3)
		elif t == 'RGBA':
			try:
				return ([int(f[i]), int(f[i+1]), int(f[i+2]), int(f[i+3])], i+4)
			except:
				return ([-100, -100, -100, -100], i)
	i = 0
	dict = {}
	for d in fielddef:
		(dict[d[0]], i) = getval(i, d[1])
	return dict

def interpolate(l1, l2, f):
	out = {}
	for d in fielddef:
		if d[1] == 'int':
			out[d[0]] = int((1.0-f)*l1[d[0]] + f*l2[d[0]])
		elif d[1] == 'float':
			out[d[0]] = round((1.0-f)*l1[d[0]] + f*l2[d[0]],2)
		elif d[1] == 'RGB':
			out[d[0]] = [int((1.0-f)*l1[d[0]][0] + f*l2[d[0]][0]),
			             int((1.0-f)*l1[d[0]][1] + f*l2[d[0]][1]),
			             int((1.0-f)*l1[d[0]][2] + f*l2[d[0]][2])]
		elif d[1] == 'RGBA':
			out[d[0]] = [int((1.0-f)*l1[d[0]][0] + f*l2[d[0]][0]),
			             int((1.0-f)*l1[d[0]][1] + f*l2[d[0]][1]),
			             int((1.0-f)*l1[d[0]][2] + f*l2[d[0]][2]),
			             int((1.0-f)*l1[d[0]][3] + f*l2[d[0]][3])]
	return out

def make24h(lines):
	w = []
	w.append(lines[0])	# midnight
	w.append(interpolate(lines[0], lines[1], 1.0/5.0))	# 1am
	w.append(interpolate(lines[0], lines[1], 2.0/5.0))	# 2am
	w.append(interpolate(lines[0], lines[1], 3.0/5.0))	# 3am
	w.append(interpolate(lines[0], lines[1], 4.0/5.0))	# 4am
	w.append(lines[1])	# 5am
	w.append(lines[2])	# 6am
	w.append(lines[3])	# 7am
	w.append(interpolate(lines[3], lines[4], 1.0/5.0))	# 8am
	w.append(interpolate(lines[3], lines[4], 2.0/5.0))	# 9am
	w.append(interpolate(lines[3], lines[4], 3.0/5.0))	# 10am
	w.append(interpolate(lines[3], lines[4], 4.0/5.0))	# 11am
	w.append(lines[4])	# midday
	w.append(interpolate(lines[4], lines[5], 1.0/7.0))	# 1pm
	w.append(interpolate(lines[4], lines[5], 2.0/7.0))	# 2pm
	w.append(interpolate(lines[4], lines[5], 3.0/7.0))	# 3pm
	w.append(interpolate(lines[4], lines[5], 4.0/7.0))	# 4pm
	w.append(interpolate(lines[4], lines[5], 5.0/7.0))	# 5pm
	w.append(interpolate(lines[4], lines[5], 6.0/7.0))	# 6pm
	w.append(lines[5])	# 7pm
	w.append(lines[6])	# 8pm
	w.append(interpolate(lines[6], lines[7], 1.0/2.0))	# 9pm
	w.append(lines[7])	# 10pm
	w.append(interpolate(lines[7], lines[0], 1.0/2.0))	# 11pm
	return w

def toStrings(weather):
	s = []
	for d in fielddef:
		if d[1] == 'RGB' or d[1] == 'RGBA':
			s += [str(x) for x in weather[d[0]]]
		else:
			s += [str(weather[d[0]])]
	return s

def getFieldWidths(lines):
	widths = []
	for i in range(len(lines[0])):
		width = 0
		for l in lines:
			if len(l[i]) > width:
				width = len(l[i])
		widths.append(width)
	return widths

def alignLine(fields, widths):
	return " ".join([f.rjust(w) for f, w in zip(fields, widths)])

def alignLineR(fields, widths):
	return "    ".join([f.ljust(w) for f, w in zip(fields, widths)])

def combineTuples(lines, widths):
	newlines = []
	for line in lines:
		l = [f.rjust(w) for f, w in zip(line, widths)]
		x = []
		i = 0
		for d in fielddef:
			if d[1] == 'RGB':
				x.append(" ".join(l[i:i+3]))
				i += 3
			elif d[1] == 'RGBA':
				x.append(" ".join(l[i:i+4]))
				i += 4
			else:
				x.append(l[i])
				i += 1
		newlines.append(x)
	return newlines

path = sys.argv[1];
f = open(path, 'r')
lines = [toNumbers(l.strip('\n').split()) for l in f.readlines() if len(l) > 1 and l[0:2] != '//']
f.close()

newlines = []
for i in range(0, 21):
	newlines += make24h(lines[i*8:(i+1)*8])
newlines += lines[21*8:23*8]
for i in range(0, 32):
	newlines.append(lines[23*8-1])
lines = newlines

timenames = ["Midnight", "1AM", "2AM", "3AM", "4AM", "5AM", "6AM", "7AM", "8AM", "9AM", "10AM", "11AM", "Midday",
"1PM", "2PM", "3PM", "4PM", "5PM", "6PM", "7PM", "8PM", "9PM", "10PM", "11PM"]
NHOUR = len(timenames)

## print
compact = False

lines = [toStrings(l) for l in lines]
widths = getFieldWidths(lines)
lines = combineTuples(lines, widths)
widths = getFieldWidths([fieldnames] + lines)
i = 0
for l in lines:
	if i % NHOUR == 0:
		print("//")
		print("/////////////////////////////////////////// " + weathernames[i//NHOUR])
		print("//")
	if NHOUR == 24 and i % 12 == 0 or \
	   i % NHOUR == 0:
		if not compact or i % NHOUR == 0:
			print("// " + alignLineR(fieldnames, widths))
#	if not compact or i % 24 == 0 or i % 24 == 12:
	if not compact:
		print("// "+timenames[i%NHOUR])
	print("   " + alignLineR(l, widths))
	i += 1



перепиши в bat