def run(argv):
	# Now let's parse the arguements
	try:
		opts, args = getopt.getopt(argv,'hi:o:w:')
	except getopt.GetoptError:
		print "You did something wrong"
		sys.exit(0)

	video_file = None
	output_folder = None
	wavfile_dir = None
	for opt, arg in opts:
		if opt in ('-h'):
			print "HELP!"
			sys.exit(0)
		elif opt in ('-i'):
			video_file = arg
		elif opt in ('-o'):
			output_folder = arg
		elif opt in ('-w'):
			wavfile_dir = arg

	if not (video_file and output_folder and wavfile_dir):
		print "You need more arguments to run this code"
		sys.exit(0)

	### THIS SECTION OF CODE USES THE SHoUT Toolbox ########
	# Now do the diarization to start us out
	file_id_with_ext = reader.GetFileOnly(video_file)
	file_id = reader.ReplaceExt(file_id_with_ext,"")
	raw_file = file_id + ".raw"
	raw_file = os.path.join(wavfile_dir,raw_file)
	# Perform turning the video into ."raw" audiofile
	return_code = shout_vid2wav(video_file,raw_file)

	if return_code:
		print "We had an issue in: VIDEO TRANSCODING"
		sys.exit(0)

	# Perform segmentation
	seg_file = os.path.join(output_folder,file_id + ".seg")
	return_code = shout_segment(raw_file,seg_file)

	if return_code:
		print "We had an issue in: SEGMENTATION"
		sys.exit(0)

	# Perform Diarization
	dia_file = reader.ReplaceExt(seg_file,".dia")
	return_code = shout_cluster(raw_file,seg_file,dia_file)

	if return_code:
		print "We had an issue in: CLUSTERING"
		sys.exit(0)
	###################################################

	# Now let's parse through the clustering file, and find the speaker times for each video
	person_segs = reader.read_diafile(dia_file)
	
	# Now we need to combine the sections of speech that are concurrent between people
	segments = reader.ConnectSpkrSegs(person_segs)

	# This cuts up the video and outputs it to the desired directory
	# Create a directory to hold all of the videos for this particular youtube program
	output_vid_segs_dir = os.path.join(output_folder,file_id)
	if not os.path.exists(output_vid_segs_dir):
		os.makedirs(output_vid_segs_dir)

	####### Video Cutting ########
	# This is for if we just want to use the smaller non-connected speech segments
	#cut_video(person_segs,video_file,output_vid_segs_dir,file_id)
	# This is for if we want to use the diarization results
	cut_video(segments,video_file,output_vid_segs_dir,file_id)

	# Now we need to output a file that has the time segments available
	output_seg_time_file = os.path.join(output_vid_segs_dir,file_id + ".times")
	with open(output_seg_time_file, "w") as f:
		for i,segment in enumerate(segments):
			output = "%03d,%.2f,%.2f\n" % (i,segment[0],segment[0]+segment[1])
			f.write(output)
			
	# TODO: NEED TO REMOVE THE AUDIO FILES THAT ARE NOT NEEDED BUT CREATED
	os.remove(raw_file)


	print "Finished Processing Video: %s" % file_id