Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- import sys
- import shutil
- import os
- if len(sys.argv) != 2 :
- print ("Please give a name for the new project")
- else :
- #Copy the Orchestre folder which has to be in the same folder as the script
- shutil.copytree("Orchestre", sys.argv[1], symlinks=True)
- os.chdir(sys.argv[1])
- ardourName = sys.argv[1] + ".ardour"
- os.rename("Orchestra.ardour", ardourName)
- os.rename("Orchestra.history", sys.argv[1] + ".history")
- os.remove("Orchestra.ardour.bak");
- os.remove("Orchestra.history.bak")
- #Modification of new .ardour file to incorporate the name of the session
- # We assume that <Session version="3001" name="Orchestra" sample-rate="44100" id-counter="27095" event-counter="0">
- # is the second line of the file
- f = open(ardourName, "r")
- modifiedFile = open(ardourName + "2", "w")
- nLine = 0
- for line in f :
- if nLine == 1 :
- modifiedFile.write("<Session version=\"3001\" name=\"" + sys.argv[1] + "\" sample-rate=\"44100\" id-counter=\"27095\" event-counter=\"0\">\n")
- else:
- modifiedFile.write(line)
- nLine += 1
- f.close()
- modifiedFile.close()
- os.rename(ardourName + "2", ardourName)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement