Add the prototype "find_person" script from our openbeacon tracking experiment
This commit is contained in:
parent
dfc0e0a368
commit
abac24b2d6
|
@ -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 $_
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue