From 0b4fc0f69d3bde6645aebdc0f3a0f37646bee32a Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 6 Jul 2009 17:36:05 -0400 Subject: View 20% in. --- rip.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/rip.py b/rip.py index e19affa..bcb355d 100755 --- a/rip.py +++ b/rip.py @@ -25,10 +25,20 @@ class Rip(threading.Thread): def isVob(file): return file.endswith(".VOB") movies = filter(isVob, movies) movies.sort() - index = 0 - if len(movies) > 1: - index = 1 - os.system("vlc ./ripping/%s/VIDEO_TS/%s" % (movie, movies[index])) + totalSize = 0 + if len(movies) >= 3: + os.path.getsize("./ripping/%s/VIDEO_TS/%s" % (movie, movies[0])) + 300 < os.path.getsize("./ripping/%s/VIDEO_TS/%s" % (movie, movies[1])): + del movies[0] + for vob in movies: + totalSize += os.path.getsize("./ripping/%s/VIDEO_TS/%s" % (movie, vob)) + partialSize = 0 + twentyPercent = movies[0] + for vob in movies: + partialSize += os.path.getsize("./ripping/%s/VIDEO_TS/%s" % (movie, vob)) + if float(partialSize) / float(totalSize) >= .2: + twentyPercent = vob + break + os.system("vlc ./ripping/%s/VIDEO_TS/%s" % (movie, twentyPercent)) os.system("zenity --entry --text=\"Please enter the correct audio track number. This must be a digit.\" --entry-text=1 > ./ripping/%s/VIDEO_TS/audiotrack.txt" % movie) except: pass -- cgit v1.2.3-59-g8ed1b