50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
|
import pyperclip
|
||
|
import os
|
||
|
|
||
|
#this script takes every item from a CSV file and processes them into a simple list
|
||
|
|
||
|
#go up one directory then down into fear factory using relative file path wonkery
|
||
|
path = "../1.20.1-FearFactoryTest/minecraft/config/tellme/"
|
||
|
|
||
|
x = ""
|
||
|
|
||
|
def Extract(dict,iStr,item,index):
|
||
|
with open(dict[item]) as file:
|
||
|
input = file.readlines()[1:] # read all lines and then slice the list to skip first line
|
||
|
for i in input:
|
||
|
# get the biome (index 1) slice ends off list, add new line
|
||
|
iStr+=str(i.split(",")[index][1:-1]+"\n")
|
||
|
print(iStr)
|
||
|
return iStr
|
||
|
|
||
|
def ExtractBiomes(dict,iStr):
|
||
|
return Extract(dict,iStr,'biomes-basic',1)
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
# create a dictonary of file names without timestamps linked back to their path
|
||
|
Inputdict = {i[:-24]:path+i for i in os.listdir(path)}
|
||
|
|
||
|
|
||
|
hbar = "=========================================================="
|
||
|
|
||
|
ScanItems = {
|
||
|
f"[BIOMES]{hbar}\n":("biomes-basic",1),
|
||
|
f"[ENTITIES]{hbar}\n":("entities",1),
|
||
|
f"[DIMENSIONS]{hbar}\n":("dimensions",0),
|
||
|
}
|
||
|
|
||
|
OutputStr = ""
|
||
|
for i in ScanItems:
|
||
|
OutputStr+=i
|
||
|
# add item key name as a header
|
||
|
#strs are pass by ref
|
||
|
OutputStr+=Extract(Inputdict,OutputStr,ScanItems[i][0],ScanItems[i][1])
|
||
|
|
||
|
with open('report.txt','w') as file:
|
||
|
file.write(OutputStr)
|
||
|
|
||
|
print(OutputStr)
|
||
|
|