1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
# importation bibliotheque graphique Tkinter et explorateur windows
from tkinter import *
from tkinter.filedialog import askopenfilename
import os
global master
master = "quelquechose"
global fichier_srt
fichier_srt = "quelquechose"
global nom_du_fichier
nom_du_fichier = "quelquechose"
# --- définition des fonctions gestionnaires d'événements : ---
def openmaster():
"Explorateur pour fichier master"
global master
master = askopenfilename()
print ("fichier master : ", master)
def opensrt():
"explorateur pour fichier srt"
global fichier_srt
fichier_srt = askopenfilename(filetypes = [("srt","*.srt")])
print ("fichier srt = ", fichier_srt)
nom_du_fichier = os.path.splitext(fichier_srt)[0]
print ("nom du fichier sans l'extension : ", nom_du_fichier)
def encodage():
# fichier_
"lancement ffmpeg"
print("lancement ffmpeg")
# path to ffmpeg bin
FFMPEG_PATH = 'C:\\ffmpeg-20160227-git-5156578-win64-shared\\bin\\ffmpeg.exe'
print ("fichier master : ", master)
command = [
FFMPEG_PATH, ' -i "', master, '" -vf subtitles="', fichier_srt, '" test.mp4', ]
print ("commande = ", command)
print (type(command))
command = ''.join(command)
print(command)
print (type(command))
os.system("ping 127.0.0.1") #os.system(cmd) exécute cmd
os.system(command)
#------ Programme principal -------
# Création du widget principal ("maître") :
fen1 = Tk()
# création des boutons :
bou1 = Button(fen1,text='Quitter',command=fen1.quit)
bou1.pack(side=BOTTOM)
bou2 = Button(fen1,text='fichier master',command=openmaster)
bou2.pack()
bou3 = Button(fen1,text='fichier srt',command=opensrt)
bou3.pack()
bou4 = Button(fen1,text='encoder',command=encodage)
bou4.pack()
fen1.mainloop() # démarrage du réceptionnaire d'événements
fen1.destroy() # destruction (fermeture) de la fenêtre |
Partager