diff options
author | kennyballou <kballou@onyx.boisestate.edu> | 2013-02-24 12:20:18 -0700 |
---|---|---|
committer | kennyballou <kballou@onyx.boisestate.edu> | 2013-02-24 12:20:18 -0700 |
commit | 3a375662f3553e99e12c9760cd679e7200b1234d (patch) | |
tree | 921c4fefab757129954f1b838df4c09fa1785574 | |
download | dlStream-3a375662f3553e99e12c9760cd679e7200b1234d.tar.gz dlStream-3a375662f3553e99e12c9760cd679e7200b1234d.tar.xz |
Initial Commit
-rw-r--r-- | README.markdown | 17 | ||||
-rw-r--r-- | dlStream.py | 35 |
2 files changed, 52 insertions, 0 deletions
diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..60eb602 --- /dev/null +++ b/README.markdown @@ -0,0 +1,17 @@ +# dlStream # + +Save video streams (like youtube videos) as `ogg` files. I may later add the +ability to have the output format configurable; if I get some more time... + +``dlStream.py`` reads from stdin a line-space delineated list of URL's and +file names to save, individually passes a stream to be saved to ``cvlc`` to +have outputted to a file. + +## Example Source File ## + + #url-to-stream file-name + http://www.youtube.com/watch?v=kXEgk1Hdze0 wat.ogg + #Line to be ignored + + #empty lines are ignored as well + http://www.youtube.com/watch?v=U4oB28ksiIo pwndbyowner.ogg diff --git a/dlStream.py b/dlStream.py new file mode 100644 index 0000000..e536789 --- /dev/null +++ b/dlStream.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python + +import os +import sys +import subprocess +import time + +def parseStreams(f): + sources = [] + for line in f.readlines(): + line = line.strip() + if not line or line.startswith('#'): + continue + s = (stream, name) = line.split(' ') + sources.append(s) + return sources + +def saveStream(source): + assert len(source) == 2 + stream = source[0] + name = source[1] + cmd = ["cvlc", + "--play-and-exit", + "--quiet", + stream, + "--sout=file/ogg:" + name] + subprocess.call(cmd) + +def main(): + sources = parseStreams(sys.stdin) + for (i, s) in enumerate(sources): + saveStream(s) + +if __name__ == "__main__": + main() |