def handleFileUpload(): #print("Going to vid.filename") if 'photo' in request.files: print("starting vid") vid = request.files['photo'] print(vid) if vid.filename != '': print(vid.filename) #print("w32323e2e32d") vid.save(os.path.join(uploads_dir, 'surgeryoutput.mp4')) #clip = mp.VideoFileClip(os.path.join('C:/Users/Chris/Documents/GitHub/Alcon-Surgeon-City/ProjectTest/server/static', vid.filename)).subclip(0,30) ####uploadvideo(vid.filename) ##audio_read("static/surgeryoutput.mp4") upload("static/surgeryoutput.mp4") #upload("test.txt") download("static/surgeryoutput.mp4") #vid.save(os.path.join('C:/Users/Chris/Documents/GitHub/Alcon-Surgeon-City/ProjectTest/server', vid.filename)) #vid.save(os.path.join('C:/Users/Chris/Documents/GitHub/Alcon-Surgeon-City/ProjectTest/server/templates', vid.filename)) #upload(vid.filename) return render_template('video.html') #redirect('/') #return report
def handleFileUpload(): # if there is a video in the file if 'photo' in request.files: #vid is the video stream vid = request.files['photo'] if vid.filename != '': #saves the video in the static folder as surgeryoutput.mp4 vid.save(os.path.join(uploads_dir, 'surgeryoutput.mp4')) #shortens the video if needed #clip = mp.VideoFileClip(os.path.join('C:/Users/Chris/Documents/GitHub/Alcon-Surgeon-City/ProjectTest/server/static', vid.filename)).subclip(0,30) #joshfile, will edit the video and saves it to the static folder as surgeryoutput.mp4 #uploadvideo(vid.filename) #uploads the result video to the static folder to firebase upload("static/surgeryoutput.mp4") #upload("test.txt") #downloads the video to the static folder from firebase download("static/surgeryoutput.mp4") return render_template('video.html')
"-p", "--plotfolder", default="/users/stollenw/projects/euo/database/analysis/hetero/avmag/", help="Database file name", ) parser.add_argument("-s", "--short", action="store_true", help="Less output") args = parser.parse_args() if not os.path.exists(args.plotfolder): os.makedirs(args.plotfolder) database = database.heterostructure_database() if args.database != "/users/stollenw/projects/euo/database/hetero.db": database.read(args.database) else: database.download() # get columns of data and remove duplicates by converting to # a set (no duplicates) and back to a list material_list = list(set([row[0] for row in database.data])) N_list = list(set([int(row[1]) for row in database.data])) M_list = list(set([int(row[2]) for row in database.data])) ni_list = list(set([float(row[3]) for row in database.data])) ncr_list = list(set([float(row[4]) for row in database.data])) dW_list = list(set([float(row[5]) for row in database.data])) # sort data material_list.sort() N_list.sort() M_list.sort() ni_list.sort()
def main(): database = CWRU() database.download() database.segment()
parser.add_argument( '-p', '--plotfolder', default='/users/stollenw/projects/euo/database/analysis/bulk/mag/', help='Database file name') parser.add_argument('-s', '--short', action='store_true', help='Less output') args = parser.parse_args() if not os.path.exists(args.plotfolder): os.makedirs(args.plotfolder) database = database.bulk_database() if args.database != '/users/stollenw/projects/euo/database/bulk.db': database.read(args.database) else: database.download() # get columns of data and remove duplicates by converting to # a set (no duplicates) and back to a list material_list = list(set([row[0] for row in database.data])) ni_list = list(set([float(row[1]) for row in database.data])) # sort data material_list.sort() ni_list.sort() # all combinations parameter_list = [material_list, ni_list] parameter = list(itertools.product(*parameter_list)) for p in parameter:
def handleFileUpload(): global value global folder try: folder = folder+1 os.makedirs("static/"+value +"/report" + str(folder)+"/video") os.makedirs("static/"+value +"/report" + str(folder)+"/image") #os.rmdir("static/"+value) except: pass # if there is a video in the file if 'photo' in request.files: #vid is the video stream vid = request.files['photo'] if vid.filename != '': #vid.save(os.path.join(uploads_dir, value+'/' +vid.filename)) #saves the video in the static folder as surgeryoutput.mp4 vid.save(os.path.join(uploads_dir, value +"/report" + str(folder)+'/video'+'/surgeryoutput.mp4')) shutil.copy("static/" + value +"/report" + str(folder)+ "/video/"+ "surgeryoutput.mp4", "static/" + value +"/report" + str(folder)+ "/video/" + vid.filename) shutil.copy("static/" + "toolflow.jpg", "static/" + value +"/report" + str(folder)+ "/image/" + "toolflow.jpg") shutil.copy("static/" + "pygraph.jpg", "static/" + value +"/report" + str(folder)+ "/image/" + "pygraph.jpg") #duplicates the video #shortens the video if needed #clip = mp.VideoFileClip(os.path.join('C:/Users/Chris/Documents/GitHub/Alcon-Surgeon-City/ProjectTest/server/static', vid.filename)).subclip(0,30) #joshfile, will edit the video and saves it to the static folder as surgeryoutput.mp4 #uploadvideo(vid.filename) outputstring = get_output("static/" + value + "/report" + str(folder)+"/video/" + vid.filename) #pic is already saved here #uploads the result video to the static folder to firebase upload("static/" +value+"/report" + str(folder)+"/video" +"/surgeryoutput.mp4") upload("static/" +value+"/report" + str(folder)+"/video/" + vid.filename) #image upload upload("static/" +value+"/report" + str(folder)+"/image/" + "toolflow.jpg") upload("static/" +value+"/report" + str(folder)+"/image/" + "pygraph.jpg") textfile = open("storage/"+value +".txt","a+") textfile.close() #write the saved video into the txt file with open("storage/"+value +".txt", "r") as f: x = "static/" +value+"/" + vid.filename if x not in f.read(): textfile = open("storage/"+value +".txt","a+") textfile.write("static/" +value+"/report" + str(folder)+"/video/" + vid.filename + "\n") ## # text into pdf ## # save FPDF() class into ## # a variable pdf ## pdf = FPDF() ## ## # Add a page ## pdf.add_page() ## ## # set style and size of font ## # that you want in the pdf ## pdf.set_font("Arial", size = 15) ## ## # insert the texts in pdf ## for y in textfile: ## pdf.cell(200, 10, txt = y, ln = 1, align = 'C') ## ## # save the pdf with name .pdf ## pdf.output("storage/"+value +".pdf") textfile.close() #upload("test.txt") #downloads the video to the static folder from firebase download("static/"+value+"/report" + str(folder)+"/video" +"/surgeryoutput.mp4") #these two are redundent #download2("static/"+value+"/toolflow.jpg",value) #download3("static/"+value+"/pygraph.jpg",value) #this is to buffer the correct video time.sleep(5) return render_template('videoresult.html',output = outputstring)