summaryrefslogtreecommitdiff
path: root/splitchapters
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-15 00:14:28 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-15 00:14:28 +0100
commitbb767c7e338414beee132af3e96829c1448e214b (patch)
treebec2858dcc7225a9bcc2acd8170c25508f6df6cb /splitchapters
parent66c9be6bdb1361e5681e094a0c8170d268aa9518 (diff)
Move things round a bit.
Diffstat (limited to 'splitchapters')
-rwxr-xr-xsplitchapters30
1 files changed, 30 insertions, 0 deletions
diff --git a/splitchapters b/splitchapters
new file mode 100755
index 000000000..1e5cff084
--- /dev/null
+++ b/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)
+
+