X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Flinux%2Fvlc_streaming.py;h=49e2e7e054d580b2e2e47f1106c2adac30fafb81;hb=e7eb6ef8873e1e197b3db8842f67a483c004a77a;hp=25db8fba46cdbcae020d9eb791f526b5f98d2e21;hpb=6edad7ea622a35c759a3667385dbb6a294245ec0;p=nepi.git diff --git a/examples/linux/vlc_streaming.py b/examples/linux/vlc_streaming.py index 25db8fba..49e2e7e0 100644 --- a/examples/linux/vlc_streaming.py +++ b/examples/linux/vlc_streaming.py @@ -17,15 +17,10 @@ # # Author: Alina Quereilhac # -# Instructions to run this example: -# -# 1. First edit the script file where required (See ASSING messages) -# -# 2. Then, run the script: +# Example of how to run this experiment (replace with your information): # # $ cd -# $ PYTHONPATH=$PYTHONPATH:~/repos/nepi/src python examples/linux/vlc_streaming.py -u inria_nepi -i ~/.ssh/id_rsa_planetlab -a planetlab1.u-strasbg.fr -b planetlab1.utt.fr | vlc - - +# python examples/linux/vlc_streaming.py -a -b -u -i from nepi.execution.ec import ExperimentController from nepi.execution.resource import ResourceState, ResourceAction @@ -33,7 +28,6 @@ from nepi.execution.resource import ResourceState, ResourceAction from optparse import OptionParser, SUPPRESS_HELP import os - usage = ("usage: %prog -a -b -u -i ") parser = OptionParser(usage = usage) @@ -54,7 +48,7 @@ username = options.username ssh_key = options.ssh_key ## Create the experiment controller -ec = ExperimentController(exp_id = "demo_CCN") +ec = ExperimentController(exp_id = "vlc_streamming") ## Register node 1 node1 = ec.register_resource("LinuxNode") @@ -99,6 +93,7 @@ ec.set(server, "files", local_path_to_video) ec.set(server, "command", command) ec.register_connection(server, node1) +# Register VLC client command = ("sudo -S dbus-uuidgen --ensure; sleep 3; " "vlc -I dummy rtp://%s:5004/%s " "--sout '#std{access=file,mux=ts,dst=VIDEO}'") % \ @@ -119,8 +114,12 @@ ec.deploy() # Wait until the ccncat is finished ec.wait_finished([server]) -print ec.trace(client, "VIDEO") +video = ec.trace(client, "VIDEO") +f = open("video.ts", "w") +f.write(video) +f.close() ec.shutdown() +print "Streamed VIDEO stored localy at video.ts"