diff options
-rwxr-xr-x | rip.py | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -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 |