diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-05-28 01:11:52 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-05-28 01:11:52 +0200 |
commit | 2593e981c84f4bc0d8ba35f844d987ac2570a297 (patch) | |
tree | 2d67f54a4a9ce3d5f272ff1a6f3b4e534441a44f /src/livestreamer/stream.py | |
parent | ccaa3f3093f7b78783d2f813ed8bce59d1860dca (diff) |
Add -c option again that prints internal commandline when possible.
Diffstat (limited to 'src/livestreamer/stream.py')
-rw-r--r-- | src/livestreamer/stream.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/livestreamer/stream.py b/src/livestreamer/stream.py index 21fc8ac..03949f2 100644 --- a/src/livestreamer/stream.py +++ b/src/livestreamer/stream.py @@ -10,23 +10,30 @@ class Stream(object): def open(self): raise NotImplementedError -class RTMPStream(Stream): +class StreamProcess(Stream): def __init__(self, params): self.params = params or {} + def cmdline(self): + return str(self.cmd.bake(**self.params)) + def open(self): - try: - rtmpdump = pbs.rtmpdump - except pbs.CommandNotFound: - raise StreamError("Unable to find 'rtmpdump' command") + stream = self.cmd(**self.params) + + return stream.process.stdout + +class RTMPStream(StreamProcess): + def __init__(self, params): + StreamProcess.__init__(self, params) self.params["flv"] = "-" self.params["_bg"] = True self.params["_err"] = open(os.devnull, "w") - stream = rtmpdump(**self.params) - - return stream.process.stdout + try: + self.cmd = pbs.rtmpdump + except pbs.CommandNotFound: + raise StreamError("Unable to find 'rtmpdump' command") class HTTPStream(Stream): def __init__(self, url): |