summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/flufigut.py33
-rw-r--r--src/test.json12
-rw-r--r--templates/example/http-stream.xml10
3 files changed, 50 insertions, 5 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index 04216ea..635b48c 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -226,14 +226,45 @@ for cluster in stream.keys():
for profile in transcode[format]:
feeder = 'muxer-%s-%s' % (format, profile)
name = '%s-%s%i-%s-%s' % (stream[cluster]['type'], cluster, idx+1, format, profile)
+ mount_point = '/%s-%s.%s' % (format, profile, globals['formats'][format]['muxer'])
+ if streamer_cnt > 1:
+ hostname = "%s.%s" % (stream[cluster]['hostname'] % (idx+1), globals['domain'])
+ if idx != 0:
+ hostname_next = "%s.%s" % (stream[cluster]['hostname'] % (idx), globals['domain'])
+ else:
+ hostname_next = "%s.%s" % (stream[cluster]['hostname'] % (streamer_cnt), globals['domain'])
+ else:
+ hostname = "%s.%s" % (stream[cluster]['hostname'], globals['domain'])
flow['streamer'][name] = {
'type': "%s-stream" % stream[cluster]['type'],
- 'desc': "%s streamer for %s-%s (part %i of %s)" % (stream[cluster]['type'], format, profile, idx+1, cluster),
+ 'desc': "%s streamer for %s-%s (part %i of %s cluster)" % (stream[cluster]['type'], format, profile, idx+1, cluster),
'worker': worker,
'feeder': feeder,
+ 'rrd_clients' : "%s/%s_clients.rrd" % (globals['rrd-dir'], name),
+ 'rrd_bytes' : "%s/%s_bytes.rrd" % (globals['rrd-dir'], name),
'properties': {
+ 'description': globals['description'],
+ 'type': 'slave',
+ 'porter-socket-path': machines[machine]['porter'][port]['socket-path'],
+ 'porter-username': machines[machine]['porter'][port]['username'],
+ 'porter-password': machines[machine]['porter'][port]['password'],
+ 'mount-point': mount_point,
+ 'hostname': hostname,
+ 'port': port,
}
}
+ for prop in stream[cluster]:
+ if prop == 'max-con':
+ flow['streamer'][name]['properties']['client-limit'] = stream[cluster][prop]
+ if streamer_cnt > 1:
+ flow['streamer'][name]['properties']['redirect-on-overflow'] = "http://%s:%i%s" % (hostname_next, port, mount_point)
+ if prop == 'max-bw':
+ flow['streamer'][name]['properties']['bandwidth-limit'] = stream[cluster][prop]
+ if streamer_cnt > 1:
+ flow['streamer'][name]['properties']['redirect-on-overflow'] = "http://%s:%i%s" % (hostname_next, port, mount_point)
+ if prop == 'burst-on-connect':
+ flow['streamer'][name]['properties']['burst-on-connect'] = 'true'
+ flow['streamer'][name]['properties']['burst-time'] = stream[cluster][prop]
### initialize and render templates #############################
diff --git a/src/test.json b/src/test.json
index d03845e..abe35f8 100644
--- a/src/test.json
+++ b/src/test.json
@@ -1,8 +1,10 @@
{
"globals":{
- "name": "emc",
+ "name": "elevate-live",
+ "description": "Live from Elevate Festival 2012",
"domain": "spreadspace.org",
"passwdfile": "/etc/flumotion/passwd",
+ "rrd-dir": "/var/lib/flumotion/rrd",
"manager": "titan",
"version": "0.10.0",
"resolutions": {
@@ -46,11 +48,15 @@
"stream": {
"streamer-local": {
"formats": [ "flash", "webm", "ogg-audio" ],
- "type": "http", "count": 1, "port": 8000, "max-con": 5
+ "type": "http", "count": 1, "port": 8000,
+ "max-con": 5, "burst-on-connect": 5,
+ "hostname": "elevate-feed"
},
"streamer-pub": {
"formats": [ "flash", "webm" ],
- "type": "http", "count": 3, "port": 8000, "max-bw": 290000
+ "type": "http", "count": 3, "port": 8000,
+ "max-bw": 290000, "burst-on-connect": 5,
+ "hostname": "elevate-live%i"
}
}
}
diff --git a/templates/example/http-stream.xml b/templates/example/http-stream.xml
index 5896651..8027b9f 100644
--- a/templates/example/http-stream.xml
+++ b/templates/example/http-stream.xml
@@ -7,6 +7,14 @@
<eater name="default">
<feed alias="default">{{ component.feeder }}</feed>
</eater>
- <!-- TODO: add properties here -->
+ <plug socket="flumotion.component.plugs.rrd.ComponentRRDPlug" type="component-rrd">
+ <property name="clients-connected-file">{{ component.rrd_clients }}</property>
+ <property name="bytes-transferred-file">{{ component.rrd_bytes }}</property>
+ </plug>
+%% for name, value in component.properties.items()
+%% if name != 'samplerate'
+ <property name="{{ name }}">{{ value }}</property>
+%% endif
+%% endfor
<clock-master>false</clock-master>
</component>