Example #1
0
	def createSong(self, name=None, notes=None):
		try:
			if(len(name) == 0 or notes == "undefined:undefined"):
				raise Exception

			name = name.decode("utf-8") #decodes url to string
			notes = notes.decode("utf-8") #decodes url to string

			create_image(generate_pairs(name+':'+notes),'img/'+str(last_id())+'.jpg') #create image
			create_song(name, notes) #sents data to database
			return "Sucess"
		except Exception, e:
			return "Something went wrong"
Example #2
0
	def createInterpretation(self, registration = None, id = None, effects = None, name = None):
		try:
			if(not registration.isdigit() or len(registration) != 9 or len(name) == 0 or len(effects) == 0 or len(id) == 0 or not id.isdigit() or str(registration).find("9") != -1):
				raise Exception

			getno = get_notes_and_name(id) #gets notes and name
			pauta = getno[0] + ":" + getno[1] # join name and notes
			filelocation = 'audio/'+str(last_id_interpretations())+'.wav'

			create_wav_file(filelocation, generate_sounds(generate_pairs(pauta), registration), effects) #creates .wav file with name as id of interpretation
			create_interpretation(registration,effects,id,name) #sents data do database

			return "Sucess"
		except Exception, e:
			return "Something went wrong"