dimanche 25 février 2018

create output file and save it to users local machine using python

I have created a webpage which takes an audio file as input and sends it python script web.py. web.py should remove the tags of audio files and it should save the processed file to users local machine.I have done with removing tags to an audio file using pytaglib library but stuck with saving the file to local machine. I have used save method of pytaglib but it did not work.

<html>

 <body>

     <form action="web.py" method="post">

     <input type="file" name="songin" accept="audio/*">
         <input type="submit" value="EditSongInfo" name="kira">

     </form>
</body>

web.py

#!C:/Users/L/AppData/Local/Programs/Python/Python36-32/python.exe
import taglib
print("Content-Type: text/html\n")
form =cgi.FieldStorage()
song=taglib.File(form['songin'].value)
arrw=song.tags.keys()
for i in list(arrw):
      song.tags.pop(i)    
song.save()




Aucun commentaire:

Enregistrer un commentaire