Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import ttk
- from tkinter import filedialog
- import os
- import shutil
- import time
- import tkinter.scrolledtext
- from tkinter import *
- import tkinter.scrolledtext as ScrolledText
- from pathlib import Path
- import glob
- GUI = Tk()
- bname = StringVar()
- mpls = StringVar()
- playlist = StringVar()
- gtag = StringVar()
- msub = StringVar()
- mvtid = StringVar()
- matid = StringVar()
- comm1 = StringVar()
- comm2 = StringVar()
- comm3 = StringVar()
- commnum1 = StringVar()
- commnum2 = StringVar()
- commnum3 = StringVar()
- commnum4 = StringVar()
- rmpls = StringVar()
- path2 = "D:\HEVC.Encoder.1.0\Tools\Eac3to\eac3to.exe"
- path3 = "D:\HEVC.Encoder.1.0\Tools\MKV_Tools\mkvmerge.exe"
- def combine_funcs(*funcs):
- def combined_func(*args, **kwargs):
- for f in funcs:
- f(*args, **kwargs)
- return combined_func
- def fdopenfol():
- import tkinter as tk
- from tkinter import ttk
- blu = bname.get()
- dirname = filedialog.askdirectory(parent=GUI,initialdir="/",title='Please select a File')
- mplayq = ("\""+str(dirname)+"\"")
- tmp = os.popen("D:\HEVC.Encoder.1.0\Tools\Eac3to\eac3to.exe -log=\"filename.txt\" "+str(mplayq)+"")
- time.sleep(5)
- lines = open('filename.txt').readlines()
- open(''+str(blu)+'.txt', 'w').writelines(lines[3:])
- readd = open(''+str(blu)+'.txt')
- rread = readd.read()
- readd.close()
- #time.sleep(1)
- Label(GUI, text = "Eac3to Results", font = "underline", bg='Light gray').place(x=600,y=5)
- Label(GUI, bg='White', width=53, height=30, borderwidth=4, relief="ridge").place(x=486,y=30)
- st = ScrolledText.ScrolledText(GUI, bg='White', width=50, height=30, font = "Helvetica 9")
- Label(GUI, text = "1", bg='Light gray').place(x=475,y=45)
- st.pack()
- st.place(x=488,y=30)
- st.insert(INSERT, rread)
- e2.delete(0,END)
- e2.insert(0, dirname)
- time.sleep(1)
- filelist = glob.glob("*.txt")
- for f in filelist:
- os.remove(f)
- def deltxt():
- blu = bname.get()
- os.remove('filename.txt')
- os.remove(''+str(blu)+'.txt')
- def output():
- mplay = mpls.get()
- mpsub = msub.get()
- mplay = mpls.get()
- play = playlist.get()
- blu = bname.get()
- gt = gtag.get()
- Reln = blu.replace(" ", ".")
- mplayq = ("\""+str(mplay)+"\"")
- #print(mplayq)
- #dirname = filedialog.askdirectory(parent=GUI,initialdir="/",title='Please Select Output Folder')
- #status = Label(GUI,text = "Demuxing Title.......%", bg='Light gray').place(x=50,y=400)
- os.system(""+str(path2)+" "+str(mplayq)+" "+str(play)+") -demux -log=\""+str(Reln)+" - Eac3to Logfile.txt\"")
- #status = Label(GUI,text = "Demuxing Title.......Complete", bg='Light gray').place(x=50,y=400)
- #status = Label(GUI,text = "Processing Subtitles.......%", bg='Light gray').place(x=50,y=425)
- os.system(""+str(path3)+" " "--ui-language en --output subs.mks --no-global-tags --no-track-tags --no-audio --no-video --no-chapters --no-attachments --default-track 0:no --default-track 1:no --default-track 2:no --default-track 3:no --default-track 4:no --default-track 5:no --default-track 6:no --default-track 7:no --default-track 8:no --default-track 9:no --default-track 10:no --default-track 11:no --default-track 12:no --default-track 13:no --default-track 14:no --default-track 15:no --default-track 16:no --default-track 17:no --default-track 18:no --default-track 19:no --default-track 20:no --default-track 21:no --default-track 22:no --default-track 23:no --default-track 24:no --default-track 25:no --default-track 26:no --default-track 27:no --default-track 28:no --default-track 29:no --default-track 30:no " ""+str(mplayq)+"\BDMV\PLAYLIST\\"+str(mpsub)+".mpls")
- #status = Label(GUI,text = "Processing Subtitles.......Complete", bg='Light gray').place(x=50,y=425)
- #status = Label(GUI,text = "Remuxing Title.......%", bg='Light gray').place(x=50,y=450)
- #status = Label(GUI,text = "Remuxing Title.......Complete", bg='Light gray').place(x=50,y=450)
- #video Vars
- for file_path2 in Path('').glob('**/*English, 5.1*.ac3'):
- my_file = Path(file_path2)
- if my_file.is_file():
- acodec = ("DD")
- for file_path1 in Path('').glob('**/*German*.dtsma'):
- os.remove(''+str(file_path1)+'')
- for file_path2 in Path('').glob('**/*English*.dtsma'):
- my_file = Path(file_path2)
- if my_file.is_file():
- acodec = ("DTS-HD.MA")
- file_path2 = file_path2
- for file_path2 in Path('').glob('**/*Atmos*.thd+ac3'):
- my_file = Path(file_path2)
- if my_file.is_file():
- acodec = ("Atmos.TrueHD")
- #achan = ("7.1")
- for file_path1 in Path('').glob('**/*English*.dtsma'):
- os.remove(''+str(file_path1)+'')
- for file_path3 in Path('').glob('**/*.h264'):
- if my_file.is_file():
- vcodec = ("AVC")
- file_path3 = file_path3
- for file_path3 in Path('').glob('**/*.vc1'):
- if my_file.is_file():
- vcodec = ("VC-1")
- file_path3 = file_path3
- for file_path4 in Path('').glob('**/*Chapters*.txt'):
- print(file_path4)
- for file_path6 in Path('').glob('**/*English*.dts'):
- os.remove(''+str(file_path6)+'')
- for file_path3 in Path('').glob('**/*.m2v'):
- if my_file.is_file():
- vcodec = ("MPEG-2")
- file_path3 = file_path3
- #audio Vars
- for file_path10 in Path('').glob('**/*5.1*.ac3'):
- my_file = Path(file_path10)
- if my_file.is_file():
- achan = ("5.1")
- for file_path8 in Path('').glob('**/*5.1*.dtsma'):
- my_file = Path(file_path8)
- if my_file.is_file():
- achan = ("5.1")
- for file_path8 in Path('').glob('**/*7.1*.thd+ac3'):
- my_file = Path(file_path8)
- if my_file.is_file():
- achan = ("7.1")
- #rem Auto Track Tagging
- if vcodec == "MPEG-2":
- for file_path9 in Path('').glob('**/*1080p24*.m2v'):
- fps = "23.976"
- e5.insert(0, ""+str(vcodec)+"" " Video / Biterate PH / 1080p / """+str(fps)+""" / 16:9""")
- if vcodec == "VC-1":
- e5.insert(0, ""+str(vcodec)+"" " Video / Biterate PH / 1080p / """+str(fps)+""" / 16:9 / Profile PH""")
- if vcodec == "AVC":
- for file_path9 in Path('').glob('**/*1080p24*.h264'):
- fps = "23.976"
- e5.insert(0, "MPEG-4 " ""+str(vcodec)+"" " Video / Biterate PH / 1080p / """+str(fps)+""" / 16:9 / Profile PH""")
- if acodec == "DTS-HD.MA":
- for file_path9 in Path('').glob('**/*48kHz*.dtsma'):
- khz = "48kHz"
- for file_path10 in Path('').glob('**/*24*.dtsma'):
- abit = "24 bits"
- for file_path10 in Path('').glob('**/*16*.dtsma'):
- abit = "16 bits"
- e6.insert(0, "DTS-HD Master Audio / "" / """+str(achan)+""" / """+str(khz)+""" / """+str(abit)+"")
- vtrack = ("\""+str(file_path3)+"\"")
- mtaudio = ("\""+str(file_path2)+"\"")
- chapters = ("\""+str(file_path4)+"\"")
- Label(GUI, text = " ", bg='Light gray').place(x=475,y=45)
- Label(GUI, bg='White', width=50, height=30, borderwidth=4, relief="ridge").place(x=486,y=30)
- ScrolledText.ScrolledText(GUI, bg='White', width=50, height=30, font = "Helvetica 9")
- Label(GUI, text = "Source Files", bg='white', font = "Times 12").place(x=625,y=45)
- Label(GUI, text = "Video", bg='Light gray', font = "Times 8").place(x=500,y=90)
- Label(GUI, text = ""+str(vcodec)+"", bg='Light gray', font = "Times 8").place(x=530,y=90)
- Label(GUI, text = ""+str(vtrack)+"", bg='white', font = "Times 7").place(x=500,y=110)
- Label(GUI, text = "Audio", bg='Light gray', font = "Times 8").place(x=500,y=130)
- Label(GUI, text = ""+str(achan)+"", bg='Light gray', font = "Times 8").place(x=530,y=130)
- Label(GUI, text = ""+str(acodec)+"", bg='Light gray', font = "Times 8").place(x=545,y=130)
- Label(GUI, text = ""+str(mtaudio)+"", bg='White', font = "Times 7").place(x=500,y=150)
- Label(GUI, text = "Chapters", bg='Light gray', font = "Times 8").place(x=500,y=165)
- Label(GUI, text = ""+str(chapters)+"", bg='white', font = "Times 7").place(x=500,y=180)
- Label(GUI, text = "Subtitles", bg='Light gray', font = "Times 8").place(x=500,y=200)
- Label(GUI, text = "Subs.mks", bg='white', font = "Times 7").place(x=500,y=220)
- def rmpls():
- gt = gtag.get()
- Reln = blu.replace(" ", ".")
- #vtrack = ("\""+str(file_path3)+"\"")
- #mtaudio = ("\""+str(file_path2)+"\"")
- #chapters = ("\""+str(file_path4)+"\"")
- outname = ("\""+str(Reln)+"\".1080p.BluRay.REMUX."+str(vcodec)+"""."""+str(acodec)+""+str(achan)+"-"+str(gt)+"")
- #print(""+str(path3)+" -o "+str(outname)+".mkv --track-name 0:Video "+str(vtrack)+" --language 0:\"English\" "+str(mtaudio)+" --track-order 0:0,1:0 --chapter-language eng --chapters "+str(chapters)+"")
- os.system(""+str(path3)+" -o "+str(outname)+".mkv --track-name 0:Hevc "+str(vtrack)+" --language 0:\"English\" "+str(mtaudio)+" --track-order 0:0,1:0 --chapter-language eng --chapters "+str(chapters)+" subs.mks")
- os.remove(""+str(file_path2)+"")
- os.remove(""+str(file_path3)+"")
- os.remove(""+str(file_path4)+"")
- os.remove("subs.mks")
- filelist = glob.glob("*.ac3")
- for f in filelist:
- os.remove(f)
- filelist2 = glob.glob("*.sup")
- for f in filelist2:
- os.remove(f)
- filelist3 = glob.glob("*.dts")
- for f in filelist3:
- os.remove(f)
- filelist4 = glob.glob("*.dtsma")
- for f in filelist4:
- os.remove(f)
- def pmpls():
- mplay = mpls.get()
- mpsub = msub.get()
- print(""+str(mplay)+"\BDMV\PLAYLIST\\"+str(mpsub)+".mpls")
- os.popen(""+str(mplay)+"\BDMV\PLAYLIST\\"+str(mpsub)+".mpls")
- GUI.geometry('860x485+200+200')
- GUI.title('PHD Eac3to Remux GUI')
- GUI.iconbitmap('addons/privatehd-favicon.ico')
- e1 = Entry(GUI, textvariable=bname, bg='White', width=35, font = "Helvetica 8 italic")
- e1.insert(0,"Enter Bluray Title Here S#E# \"Year\"")
- e1.place(x=1,y=1)
- e2 = Entry(GUI, textvariable=mpls, bg='White', width=75, font = "Helvetica 8 italic")
- e2.insert(0,"Source Destination")
- e2.place(x=1,y=55)
- e3 = Entry(GUI, textvariable=gtag, bg='White', width=15, font = "Helvetica 8 italic")
- e3.insert(0,"Group Tag")
- e3.place(x=225,y=1)
- e4 = Entry(GUI, textvariable=msub, bg='White', width=15, font = "Helvetica 8 italic")
- e4.insert(0,"MPLS #")
- e4.place(x=50,y=84)
- e5 = Entry(GUI, textvariable=mvtid, bg='White', width=65, font = "Helvetica 8 italic")
- e5.place(x=75,y=165)
- e6 = Entry(GUI, textvariable=matid, bg='White', width=65, font = "Helvetica 8 italic")
- e6.place(x=75,y=200)
- e7 = Entry(GUI, textvariable=comm1, bg='White', width=65, font = "Helvetica 8 italic")
- e7.place(x=75,y=230)
- e8 = Entry(GUI, textvariable=comm2, bg='White', width=65, font = "Helvetica 8 italic")
- e8.place(x=75,y=265)
- e9 = Entry(GUI, textvariable=comm3, bg='White', width=65, font = "Helvetica 8 italic")
- e9.place(x=75,y=300)
- but4 = Button(GUI, text = "1. Open Blu-Ray Folder",command=combine_funcs(fdopenfol)).place(x=1,y=25)
- but5 = Button(GUI, text = "2. Demux Playlist",command=combine_funcs(output, deltxt)).place(x=150,y=80)
- but6 = Button(GUI, text = "Play MPLS",command=pmpls).place(x=255,y=80)
- but7 = Button(GUI, text = "3. Remux MKV",command=rmpls).place(x=325,y=80)
- Label(GUI,text="Assing Tracks as Commentary", bg='Light gray').place(x=0,y=115)
- spinbox2 = Spinbox(GUI,textvariable=commnum1,width=4, bg="White", values=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).place(x=175,y=115)
- spinbox3 = Spinbox(GUI,textvariable=commnum2,width=4, bg="White", values=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).place(x=225,y=115)
- spinbox4 = Spinbox(GUI,textvariable=commnum3,width=4, bg="White", values=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).place(x=275,y=115)
- spinbox5 = Spinbox(GUI,textvariable=commnum4,width=4, bg="White", values=(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).place(x=325,y=115)
- Label(GUI,text="Track Tagging", bg='Light gray').place(x=225,y=135)
- Label(GUI,text="Video", bg='Light gray').place(x=15,y=165)
- Label(GUI,text="Main Audio", bg='Light gray').place(x=0,y=200)
- Label(GUI,text="Comm. 1", bg='Light gray').place(x=5,y=230)
- Label(GUI,text="Comm. 2", bg='Light gray').place(x=5,y=265)
- Label(GUI,text="Comm. 3", bg='Light gray').place(x=5,y=300)
- spinbox1 = Spinbox(GUI,textvariable=playlist,width=4, bg="White", values=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)).place(x=5,y=85)
- frame = Frame(GUI)
- GUI.configure(bg='Light gray')
- frame.pack()
- GUI = mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement