Schonmal danke für den Tip - hab das gleich mal geändert, mit dem aufteilen.
Mit tut nichts - mein ich, es kommt weder eine Ausgabe, Fehlermeldung in der Konsole, noch wird die .mkv erstellt.
Code: Alles auswählen
['/home/pi/handbrake/HandBrake-1.0.2/build/HandBrakeCLI', '-i', '/dev/dvd', '-o', '/home/pi/Downloads/download/JARHEAD.mkv', '-X', '1920', '-e', 'x264', '-b', '2048', '-audio-lang-list', 'deu,ger', '--all-audio', '--subtitle-lang-list', 'deu,ger', '--all-subtitle', '-E', 'ac3', '-B', '320', '-s', '1', '-m', '-O']
Code: Alles auswählen
from tkinter import *
import os.path
import os
import time
import re
import subprocess
from subprocess import Popen
import sys
fenster = Tk()
fenster.title("Jack the Ripper :-)")
fenster.geometry("1920x1080")
def get_dvd_title():
vols = os.listdir('/media/pi')
candidates = list()
for vol in vols:
if vol.startswith('.'):
continue
candidates.append(vol)
if len(candidates) > 0:
for vol in candidates:
dirs = os.listdir('/media/pi/' + vol)
if 'VIDEO_TS' in dirs:
return vol
title=get_dvd_title()
dvd_title=get_dvd_title()
out_dir='/home/pi/Downloads/download'
HANDBRAKE='/home/pi/handbrake/HandBrake-1.0.2/build/HandBrakeCLI'
#input und autput für Handbrake
#infile='/media/pi/%s' % (dvd_title)
infile='/dev/dvd'
outfile= '%s/%s.mkv' % (out_dir, dvd_title)
def start():
text= open('/home/pi/movie.txt').read()
my_regex=r'^.*' + re.escape(dvd_title) + '.*$'
if re.search(get_dvd_title(), text, re.I):
dvdtext = Text(fenster, height=1, width=35,bg="lightgrey", fg="red")
dvdtext.pack()
dvdtext.insert(END, re.findall(my_regex,text,re.I|re.M))
dvdtext.place(x=50, y=250)
dvdtext.config(font=("Arial", 80))
T = Text(fenster, height=1, width=35,bg="lightgrey", fg="red")
T.pack()
T.insert(END, "Ist das der Film?")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
knopf3 = Button(fenster, text="Ja", height=3, width=15, bd=9, fg="green", activeforeground="green", command=nextdvd)
knopf3.place(x=50, y=550)
knopf3.config(font=("Arial", 60))
knopf4 = Button(fenster, text="Nein", height=3, width=15, bd=9, fg="green", activeforeground="green", command=rip)
knopf4.place(x=1050, y=550)
knopf4.config(font=("Arial", 60))
else:
rip()
def druck():
print (infile)
def rip():
T = Text(fenster, height=1, width=35,bg="lightgrey", fg="green")
T.pack()
T.insert(END, "Film wird gerippt")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
subprocess.run(["/home/pi/handbrake/HandBrake-1.0.2/build/HandBrakeCLI", '-i', infile, '-o', outfile, '-X', '1920', '-e', 'x264', '-b', '2048', '-audio-lang-list', 'deu,ger', '--all-audio', '--subtitle-lang-list', 'deu,ger', '--all-subtitle', '-E', 'ac3', '-B', '320', '-s', '1', '-m', '-O'])
def nextdvd():
T = Text(fenster, height=1, width=35,bg="lightgrey", fg="red")
T.pack()
T.insert(END, "Film vorhanden, Nächste DVD einlegen")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
knopf1 = Button(fenster, text="START", height=3, width=15, bd=9, fg="green", activeforeground="green", command=start)
knopf1.place(x=50, y=550)
knopf1.config(font=("Arial", 60))
knopf2 = Button(fenster, text="Connect", height=3, width=15, bd=9, fg="green", activeforeground="green", command=connect)
knopf2.place(x=1050, y=550)
knopf2.config(font=("Arial", 60))
def connect():
subprocess.run("/home/pi/mount.sh")
time.sleep(5)
if os.path.isfile ("/home/pi/Downloads/download/Connected.txt") & os.path.isdir ("/home/pi/Downloads/nas/Serien"):
T = Text(fenster, height=1, width=35,bg="lightgrey", fg="green")
T.pack()
T.insert(END, "Mit Server verbunden")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
f = open ("/home/pi/movie.txt", "w")
for subdir, dirs, files in os.walk("/home/pi/Downloads/nas/"):
for file in files:
f.write(file + '\n')
knopf1 = Button(fenster, text="START", height=3, width=15, bd=9, fg="green", activeforeground="green", command=start)
knopf1.place(x=50, y=550)
knopf1.config(font=("Arial", 60))
knopf2 = Button(fenster, text="Connect", height=3, width=15, bd=9, fg="green", activeforeground="green", command=connect)
knopf2.place(x=1050, y=550)
knopf2.config(font=("Arial", 60))
if os.path.isfile ("/home/pi/Downloads/download/Connected.txt")& os.path.isdir ("/home/pi/Downloads/nas/Serien"):
T = Text(fenster, height=1, width=18,bg="lightgrey", fg="green")
T.pack()
T.insert(END, "Mit Server verbunden")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
f = open ("/home/pi/movie.txt", "w")
for subdir, dirs, files in os.walk("/home/pi/Downloads/nas/"):
for file in files:
f.write(file + '\n')
else:
T = Text(fenster, height=1, width=18,bg="lightgrey", fg="red")
T.pack()
T.insert(END, "Mit Server Verbinden")
T.place(x=50, y=50)
T.config(font=("Arial", 60))
Wenn ich die Zeile im Terminal eingebe, ohne die ' dann funktionierts.
Hab mich bei den Optionen verhauen "--audio-lang-list" nicht "-audio-lang-list" und das -s 1 musste raus.
Jetzt wärs noch prima wenn mir wer erklären könnte wie ich die ausgaben vom subprocess "handbrake" in das textfeld "dvdtext" bekomme.