X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=examples%2Flinux%2Fvlc_streaming.py;h=4b5d83d14498deaf399808a90e7d68bc433eff1c;hb=039fbd9629d7570d4c175a5448d24badcd0f3aba;hp=6d01a9b6225a339299d1b47e079987f922015aac;hpb=36f956d214b109de7b8b7ceb34d0718d284c15f8;p=nepi.git diff --git a/examples/linux/vlc_streaming.py b/examples/linux/vlc_streaming.py index 6d01a9b6..4b5d83d1 100644 --- a/examples/linux/vlc_streaming.py +++ b/examples/linux/vlc_streaming.py @@ -3,9 +3,8 @@ # Copyright (C) 2014 INRIA # # This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation; # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -17,11 +16,12 @@ # # Author: Alina Quereilhac # -# Example of how to run this experiment (replace with your credentials): +# 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 __future__ import print_function from nepi.execution.ec import ExperimentController from nepi.execution.resource import ResourceState, ResourceAction @@ -52,7 +52,7 @@ ssh_key = options.ssh_key ec = ExperimentController(exp_id = "vlc_streamming") ## Register node 1 -node1 = ec.register_resource("LinuxNode") +node1 = ec.register_resource("linux::Node") # Set the hostname of the first node to use for the experiment ec.set(node1, "hostname", hostname1) # username should be your SSH user @@ -65,7 +65,7 @@ ec.set(node1, "cleanExperiment", True) ec.set(node1, "cleanProcesses", True) ## Register node 2 -node2 = ec.register_resource("LinuxNode") +node2 = ec.register_resource("linux::Node") # Set the hostname of the first node to use for the experiment ec.set(node2, "hostname", hostname2) # username should be your SSH user @@ -88,7 +88,7 @@ command = ("sudo -S dbus-uuidgen --ensure; sleep 3;" "--sout '#rtp{dst=%s,port=5004,mux=ts}' vlc://quit") % \ (video, hostname2) -server = ec.register_resource("LinuxApplication") +server = ec.register_resource("linux::Application") ec.set(server, "depends", "vlc") ec.set(server, "files", local_path_to_video) ec.set(server, "command", command) @@ -100,7 +100,7 @@ command = ("sudo -S dbus-uuidgen --ensure; sleep 3; " "--sout '#std{access=file,mux=ts,dst=VIDEO}'") % \ (hostname2, video) -client = ec.register_resource("LinuxApplication") +client = ec.register_resource("linux::Application") ec.set(client, "depends", "vlc") ec.set(client, "command", command) ec.register_connection(client, node2) @@ -115,8 +115,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")