forked from brendonbeebe/AutoMovieArchive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ripper.py
executable file
·39 lines (36 loc) · 1.11 KB
/
ripper.py
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
from System.Diagnostics import Process
from System.IO import Path, Directory
def transcode(mkvFile, movieName):
p = Process()
p.StartInfo.UseShellExecute = False
#p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = "HandBrakeCLI"
p.StartInfo.Arguments = "-i %s -o %s.mp4 -f mp4 -e x264" % (mkvFile, movieName)
if p.Start():
print("Transcoding")
p.WaitForExit()
if p.ExitCode == 0:
print("Successfully transcoded %s" % movieName)
else:
print("Error: %d" % p.ExitCode)
else:
print("Error transcoding, quitting")
def rip(driveLetter, movieName):
out = Path.Combine(Path.GetTempPath(), movieName)
p = Process()
p.StartInfo.UseShellExecute = False
#p.StartInfo.RedirectStandardOutput = True
p.StartInfo.FileName = "makemkvcon"
p.StartInfo.Arguments = "--minlength=300 mkv disc:0 all %s" % out
print("Saving to:", out)
print(p.StartInfo.Arguments)
if p.Start():
print("Ripping")
p.WaitForExit()
if p.ExitCode == 0:
print("Successfully ripped %s" % movieName)
return Directory.GetFiles(out)[0]
else:
print("Error: %d" % p.ExitCode)
else:
print("Error ripping, quitting")