コード例 #1
0
ファイル: manage.py プロジェクト: jlakin67/Alcon-Surgeon-City
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
コード例 #2
0
ファイル: gui.py プロジェクト: Sohalt/Ankipubsub-Client
def publishDeckGuiOk(form, ankiDeckForm):
    selectedDeck = str(form.ui.comboBox.currentText())
    localDeckID = mw.col.decks.id(selectedDeck, False)
    upload(localDeckID,
           mw.col.conf.get('ankipubsubServer',
                           "http://144.76.172.187:5000/v0"),
           mw.col.conf.get('pubSubName', ""),
           mw.col.conf.get('pubSubPassword', ""))
    drawTable(ankiDeckForm)
    form.done(0)
コード例 #3
0
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')
コード例 #4
0
ファイル: app.py プロジェクト: chrisislin/Eyelight
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)
コード例 #5
0
ファイル: main.py プロジェクト: tony12345655/weather
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/8/24 下午 06:20
# @Author : Aries
# @Site :
# @File : main.py
# @Software: PyCharm

from data import spider
from database import upload

if __name__ == '__main__':

    print("歡迎使用天氣爬取~")
    year = input("請輸入年分(西元): ")

    # 爬蟲抓取資料
    Date, Time, StnP, SeaP, Temp, Td, RH, WS, WD, WSG, WDG, Pre, PreH, Sun, Glob, Visb, UV, Cloud = spider(
        year)

    # 將資料存入資料庫
    upload(year, Date, Time, StnP, SeaP, Temp, Td, RH, WS, WD, WSG, WDG, Pre,
           PreH, Sun, Glob, Visb, UV, Cloud)