script update wip 2
import os
from pathlib import Path
path=Path(r"c:\temp\franzFerdinand")
num=1
for dirs in path.iterdir():
print(dirs.name)
files_in_path=dirs.iterdir()
for item in files_in_path:
file_path=os.path.join(path,dirs.name,item.name)
print (file_path)
file_pa=os.path.join(path,dirs.name)
if item.name=="bass.wav":
os.rename(file_pa+"\\"+item.name,file_pa+"\\"+item.name.replace("bass","3"))
elif item.name=="drums.wav":
os.rename(file_pa+"\\"+item.name,file_pa+"\\"+item.name.replace("drums","4"))
elif item.name=="other.wav":
os.rename(file_pa+"\\"+item.name,file_pa+"\\"+item.name.replace("other","1"))
elif item.name=="vocals.wav":
os.rename(file_pa+"\\"+item.name,file_pa+"\\"+item.name.replace("vocals","2"))
filename="TRACK.TXT"
trackpath=os.path.join(path,dirs.name,filename)
with open(trackpath,"w") as f:
f.write("{\n")
f.write("\t\"TrackColour\": [ \n")
f.write("\t\"#fffb00\",\n \t\"#ff0000\"\n")
f.write("\t],\n")
f.write("\t\"tempos\": [ \n")
f.write("\t{\n")
f.write("\t\"tempo_bpm\": TEMPOVARIABLE,\n")
f.write("\t\"time_ms\": 0\n")
f.write("\t}\n")
f.write("\t],\n")
f.write("\t\"TrackGain_dB\": 5,\n")
f.write("\t\"metadata\":{\n")
f.write("\t\"artist\":\" ARTISTVARIABLE \",\n")
f.write("\t\"title\":\" TITLEVARIABLE \",\n")
f.write("\t\"global_id\": \"bbd758cb-3f33-5f25-5bf3-8bc943e8bcd8\",\n") #randommise this
f.write("\t\"meta_version\": \"1\",\n")
f.write("\t\"stems_version\": \"1\",\n")
f.write("\t}\n")
f.write("}\n")
f.write("}")
newDirName="T"+format(num)
newDirPath=os.path.join(path,newDirName)
print (newDirName)
print (newDirPath)
os.rename(file_pa,newDirPath)
num+=1
Comments
Post a Comment