From: Jan Michel Date: Mon, 20 Apr 2015 21:18:14 +0000 (+0200) Subject: added rooms to presenter X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=140eaa8b12253bf984d7741c363dde46dfbfdb15;p=labtools.git added rooms to presenter --- diff --git a/presenter/.gitignore b/presenter/.gitignore new file mode 100644 index 0000000..435e7d1 --- /dev/null +++ b/presenter/.gitignore @@ -0,0 +1 @@ +.kateproject.d/ diff --git a/presenter/.kateproject b/presenter/.kateproject new file mode 100644 index 0000000..4bc5cd7 --- /dev/null +++ b/presenter/.kateproject @@ -0,0 +1,4 @@ +{ + "name": "Presenter" +, "files": [ { "git": 1 } ] +} diff --git a/presenter/currentstate b/presenter/currentstate new file mode 120000 index 0000000..17fb8d9 --- /dev/null +++ b/presenter/currentstate @@ -0,0 +1 @@ +/dev/shm/currentstate \ No newline at end of file diff --git a/presenter/getPic.pl b/presenter/getPic.pl index 53f1c28..bf1d77b 100755 --- a/presenter/getPic.pl +++ b/presenter/getPic.pl @@ -1,11 +1,28 @@ #!/usr/bin/perl use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +use CGI; print "Content-type: text/html\n\n"; -open FILE, "<", "presenter"; -my @data = ; -close FILE; -my $f = $data[0]; +my $cgi = new CGI(); + + +my $room = $cgi->param('room'); +if (!($room =~ /^[a-zA-Z0-9]+$/) || !(-d "store/$room")) { + print "Invalid room"; + return 1; +} + +my $old = $cgi->param('old'); +my $timer = 0; +my $f; +do { + open FILE, "<", "store/$room/currentstate"; + my @data = ; + close FILE; + $f = $data[0]; + chomp($f); + sleep(1) if($f eq $old); + }while($timer++ < 30 && $f eq $old); print $f; \ No newline at end of file diff --git a/presenter/getfiles.pl b/presenter/getfiles.pl index c917f1f..5010e7e 100755 --- a/presenter/getfiles.pl +++ b/presenter/getfiles.pl @@ -1,11 +1,24 @@ #!/usr/bin/perl use CGI::Carp qw(warningsToBrowser fatalsToBrowser); +use CGI; print "Content-type: text/html\n\n"; -my @files = qx(cd store; ls -1 * | sort); + +my $cgi = new CGI(); + + +my $room = $cgi->param('room'); +if (!($room =~ /^[a-zA-Z0-9]+$/) || !(-d "store/$room")) { + print "Invalid room"; + return 1; +} + +my $cmd = "cd store;cd $room; ls -1 -v"; +my @files = qx($cmd); print ""; diff --git a/presenter/index.pl b/presenter/index.pl index 4994e3d..ff8d763 100755 --- a/presenter/index.pl +++ b/presenter/index.pl @@ -3,14 +3,7 @@ use CGI::Carp qw(warningsToBrowser fatalsToBrowser); print "Content-type: text/html\n\n"; -use Data::Dumper; -use warnings; -use strict; -use utf8; -binmode(STDIN, ":utf8"); -binmode(STDOUT, ":utf8"); -use URI::Escape qw(uri_unescape uri_escape); print < @@ -21,27 +14,20 @@ print < + +

Remote Presenter

+ - - +my @files = qx(cd store; ls -1 -v ); -
Files -
 
- - - -HDOC - -print ""; - - - - - +foreach my $f (@files) { + chomp($f); + print "