From 8faea2551c8991e054c0b694f99e559a1e9d2c84 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 1 Oct 2012 01:40:02 +0200 Subject: refactoring, redoing streamer representation --- src/flufigut.py | 90 +++++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 47 deletions(-) diff --git a/src/flufigut.py b/src/flufigut.py index 6e20e7e..966a935 100755 --- a/src/flufigut.py +++ b/src/flufigut.py @@ -51,13 +51,12 @@ cf.close(); ### initialization ############################################## # -atmosphere = {} -flow = {} -machines = {} globals = config['globals'] input = config['input'] transcode = config['transcode'] stream = config['stream'] +atmosphere = {} +flow = {} ### sanity checks ############################################### @@ -65,48 +64,6 @@ stream = config['stream'] # - worker<->machine only 1:1 # - list of workers (mark usage later) -### generate porter for all streamer/machines ################### -# -idx = 0 -for streamer in stream: - worker = 'streamer%i'%(idx) - port = streamer['config']['port'] - found = False - for machine in globals['machines'].keys(): - if worker in globals['machines'][machine]: - if machine in machines: - if 'porter' in machines[machine]: - if port in machines[machine]['porter']: - print "Porter: machine %s already uses port %i" % (machine, port) - sys.exit(1) - else: - machines[machine]['porter'] = {} - else: - machines[machine] = { 'porter': {} } - - found = True - machines[machine]['porter'][port] = { - 'socket-path': "porter%i-%s"%(idx, rand_string()), - 'username': rand_string(size=12), - 'password': rand_string(size=12), - } - - atmosphere['porter-%s-%i'%(machine, port)] = { - 'type': "porter", - 'desc': "Porter for %s on port %i"%(machine, port), - 'worker': worker, - 'properties': { - 'port': port, - 'socket-path': machines[machine]['porter'][port]['socket-path'], - 'username': machines[machine]['porter'][port]['username'], - 'password': machines[machine]['porter'][port]['password'], - }, - } - if not found: - print "Streamer %i has no machine assigned" % (idx) - sys.exit(1) - idx+=1 - ### generate input components ################################### flow['input'] = {} @@ -140,8 +97,7 @@ for format in transcode.keys(): if resolution not in resolutions: if input['resolution'] != resolution: if globals['resolutions'][resolution]['rate'] != globals['resolutions'][input['resolution']]['rate']: - print "video rate conversion is not yet supported!!!" - sys.exit(-1) + raise SystemExit("video rate conversion is not yet supported!!!") resolutions.append(resolution) for resolution in resolutions: @@ -232,6 +188,46 @@ for format in transcode.keys(): flow['streamer'] = {} # TODO +### generate porter for all streamer/machines ################### +# +# idx = 0 +# for streamer in stream: +# worker = 'streamer%i'%(idx) +# port = streamer['config']['port'] +# found = False +# for machine in globals['machines'].keys(): +# if worker in globals['machines'][machine]: +# if machine in machines: +# if 'porter' in machines[machine]: +# if port in machines[machine]['porter']: +# raise SystemExit("Porter: machine %s already uses port %i" % (machine, port)) +# else: +# machines[machine]['porter'] = {} +# else: +# machines[machine] = { 'porter': {} } + +# found = True +# machines[machine]['porter'][port] = { +# 'socket-path': "porter%i-%s"%(idx, rand_string()), +# 'username': rand_string(size=12), +# 'password': rand_string(size=12), +# } + +# atmosphere['porter-%s-%i'%(machine, port)] = { +# 'type': "porter", +# 'desc': "Porter for %s on port %i"%(machine, port), +# 'worker': worker, +# 'properties': { +# 'port': port, +# 'socket-path': machines[machine]['porter'][port]['socket-path'], +# 'username': machines[machine]['porter'][port]['username'], +# 'password': machines[machine]['porter'][port]['password'], +# }, +# } +# if not found: +# raise SystemExit("Streamer %i has no machine assigned" % (idx)) +# idx+=1 + ### initialize and render templates ############################# # -- cgit v1.2.3