# HG changeset patch # User Daniel O'Connor # Date 1250755490 -34200 # Node ID 6edc508e0775868904983ae62662386f85c57845 # Parent f914f08d69f5aa6adf1130acfecba72d649a5f41 Try and run flvstreamer on init and exit if it fails. It's very annoying if we go and select a bunch of stuff and the user hasn't remember to edit the path for it.. diff -r f914f08d69f5 -r 6edc508e0775 iviewget.py --- a/iviewget.py Thu Aug 20 17:33:35 2009 +0930 +++ b/iviewget.py Thu Aug 20 17:34:50 2009 +0930 @@ -1,6 +1,8 @@ #!/usr/bin/env python import iview +import os.path +import re import subprocess import sys import time @@ -8,6 +10,7 @@ outpath = '.' outext = 'flv16x9' flvstreamerpath = '/home/darius/projects/flvstreamer/flvstreamer_x86' +flvpattern = re.compile("FLVStreamer v") def listChannels(iview): i = 1 @@ -48,8 +51,27 @@ time.sleep(0.1) else: return res - + +def checkFLVStreamer(): + try: + s = subprocess.Popen(flvstreamerpath, stdout = subprocess.PIPE, stderr = subprocess.PIPE) + except OSError: + print "Couldn't execute FLVstreamer" + return False + while s.poll() != 1: + time.sleep(0.1) + + out, err = s.communicate() + if flvpattern.match(err) == None: + print "Unrecognised output from FLVstreamer" + return False + + return True + if __name__ == "__main__": + if not checkFLVStreamer(): + sys.exit(1) + iview = iview.IView() if iview.metered: print "WARNING: iview is metered"