Created
September 6, 2013 21:16
-
-
Save robmathers/6470128 to your computer and use it in GitHub Desktop.
Converts a OGG format chapters to csv format for use with Handbrake. Uses stdin/stdout for easy use with other command-line utilities.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from sys import stdin, stdout | |
import re | |
pattern = re.compile("CHAPTER0*(\\d+)=[\\d:\\.]+\\nCHAPTER0*\\1NAME=(.*)$", flags = re.MULTILINE) | |
replacement = "\\1,\\2" | |
input = stdin.read() | |
output = pattern.sub(replacement, input) | |
stdout.write(output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment