summaryrefslogtreecommitdiff
path: root/hacks/splitchapters
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-30 20:04:11 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-30 20:04:11 +0100
commitb4ff18156c52e65404459966ff4e551604e235c3 (patch)
tree1e764e6886c6b7eae6029d5a8871640d1edf0cc3 /hacks/splitchapters
parent260747962d87ed12115e940f7a9e86fcf7983ea4 (diff)
Move some stuff around.
Diffstat (limited to 'hacks/splitchapters')
-rwxr-xr-xhacks/splitchapters30
1 files changed, 30 insertions, 0 deletions
diff --git a/hacks/splitchapters b/hacks/splitchapters
new file mode 100755
index 000000000..1e5cff084
--- /dev/null
+++ b/hacks/splitchapters
@@ -0,0 +1,30 @@
+#!/usr/bin/python
+
+import os
+import sys
+
+if len(sys.argv) < 2:
+ print 'Syntax: %s <DVD-image>' % sys.argv[0]
+ sys.exit(1)
+
+lsdvd = os.popen('lsdvd -c "%s"' % sys.argv[1])
+lines = lsdvd.readlines()
+
+N = None
+
+for l in lines:
+ w = l.split()
+ if len(w) > 5 and w[4] == 'Chapters:':
+ N = int(w[5][:-1])
+
+if N == None:
+ print 'Could not get chapter count.'
+ sys.exit(1)
+
+for i in range(1, N + 1):
+ os.mkdir('%d' % i)
+ c = 'mplayer dvd:// -chapter %d-%d -dvd-device "%s" -dumpstream -dumpfile %d/%d.vob' % (i, i, sys.argv[1], i, i)
+ print c
+ os.system(c)
+
+