Add the prototype "find_person" script from our openbeacon tracking experiment

This commit is contained in:
Stefan `Sec` Zehl 2012-01-02 20:25:32 +01:00
parent dfc0e0a368
commit abac24b2d6
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
use JSON;
use Data::Dumper;
my $content;
#open(F,"<",shift);
open(F,"-|","wget -qO- http://176.99.39.100/tracking.json");
while(<F>){
$content.=$_;
};
my $json = from_json($content, {ascii => 1});
#print Dumper $json;
my $room;
my $floor;
for (@{$json->{tag}}){
if($_->{nick} =~ qr/$ARGV[0]/i){
for my $r (@{$json->{reader}}){
if($r->{id} eq $_->{reader}){
# print Dumper $r;
$room=$r->{name};
$floor=$r->{floor};
};
};
print $_->{nick}, " is at ",$room," (Level ",qw(A B C)[$floor-1],")\n";
# print Dumper $_
}
};