diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-06-24 14:38:57 -0400 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2009-06-24 14:38:57 -0400 |
commit | 1ef3ba256204f670db497acf992b47ef46486499 (patch) | |
tree | 84433ee7f21318e2e59195ac8ec223015648cd4c | |
parent | Initial commit. (diff) | |
download | OldSchoolRipper-1ef3ba256204f670db497acf992b47ef46486499.tar.xz OldSchoolRipper-1ef3ba256204f670db497acf992b47ef46486499.zip |
Use ascii_letters. Fix ffmpeg quality settings. Automatically delete menu VOB. Don't upload between 9 and 18.
-rwxr-xr-x | rip.py | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -7,8 +7,9 @@ import sys import time import string from random import choice +import datetime -def makeRandomString(length=8, chars=string.letters + string.digits): +def makeRandomString(length=8, chars=string.ascii_letters + string.digits): return ''.join([choice(chars) for i in range(length)]) class Rip(threading.Thread): @@ -26,11 +27,19 @@ class Encode(threading.Thread): while True: listing = os.listdir("./toencode") for i in range(len(listing)): - os.system("nautilus ./toencode/" + listing[i] + "/VIDEO_TS/") - os.system("zenity --warning --text=\"A file browser has just appeared. Please delete any VOB files that are not part of the main feature of the film. Do not touch non VOB files. When you are done, close the file browser window, press OK and the encoding will begin.\"") + for j in range(0, 16): + if i < 10: + num = "0" + str(j) + else: + num = str(j) + template = "./toencode/" + listing[i] + "/VIDEO_TS/VTS_" + num + "_%s.VOB" + if os.path.exists(template % "0") and os.path.exists(template % "1") and os.path.exists(template % "2"): + if os.path.getsize(template % "0") < os.path.getsize(template % "1"): + os.remove(template % "0") + print "Removing " + (template % "0") logEvent("Encoding Begin", listing[i]) - os.system("cat ./toencode/" + listing[i] + "/VIDEO_TS/*.VOB | ffmpeg -y -i - -pass 1 -vcodec libx264 -deinterlace -vpre fastfirstpass -b 400k -bt 400k -threads 2 -f mp4 -an /dev/null") - os.system("cat ./toencode/" + listing[i] + "/VIDEO_TS/*.VOB | ffmpeg -i - -pass 2 -acodec libfaac -ab 96k -ac 2 -vcodec libx264 -deinterlace -vpre hq -b 400k -bt 400k -threads 2 -f mp4 " + listing[i] + ".mp4") + os.system("cat ./toencode/" + listing[i] + "/VIDEO_TS/*.VOB | ffmpeg -y -i - -pass 1 -vsync 1 -vcodec libx264 -deinterlace -vpre slowfirstpass -b 512k -bt 512k -qmax 33 -threads 0 -f mp4 -an /dev/null") + os.system("cat ./toencode/" + listing[i] + "/VIDEO_TS/*.VOB | ffmpeg -i - -pass 2 -vsync 1 -acodec libfaac -ar 44100 -ab 96k -ac 2 -vcodec libx264 -deinterlace -vpre hq -b 512k -bt 512k -qmax 33 -threads 0 -f mp4 " + listing[i] + ".mp4") os.system("/home/anyclip/ffmpeg/tools/qt-faststart " + listing[i] + ".mp4 " + listing[i] + "_fast.mp4") logEvent("Encoding End", listing[i]) os.system("rm *.log " + listing[i] + ".mp4") @@ -41,6 +50,9 @@ class Encode(threading.Thread): class Upload(threading.Thread): def run(self): while True: + now = datetime.datetime.now() + if now.hour > 9 and now.hour < 18: + continue listing = os.listdir("./toupload") if len(listing) > 0: ftp = ftplib.FTP("ftp2.edgecastcdn.net") @@ -60,7 +72,7 @@ class Upload(threading.Thread): os.rename("./toupload/" + listing[i], "./uploaded/" + listing[i]) if len(listing) > 0: ftp.quit() - time.sleep(4) + time.sleep(60) if not os.path.exists("./toupload"): os.mkdir("./toupload") |