Advertisement
Stybyk

Timelapse

Jun 7th, 2019
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.13 KB | None | 0 0
  1. #!/usr/bin/perl
  2. # This code is public domain
  3. #Insert to /usr/lib/cgi-bin/ nazev sample.cgi
  4. #sudo a2enmod cgi
  5. #sudo service apache2 restart
  6. #url je potom http://ip/cgi-bin/sample.cgi
  7.  
  8. # grab the current time
  9. my @now = localtime();
  10.  
  11. # rearrange the following to suit your stamping needs.
  12. # it currently generates YYYYMMDDhhmmss
  13. my $timeStamp = sprintf("%04d%02d%02d%02d%02d",
  14.                         $now[5]+1900, $now[4]+1, $now[3],
  15.                         $now[2],      $now[1],);
  16.  
  17. # insert stamp into constant portion of file name.
  18. # the constant portion of the name could be included
  19. # in the sprintf() above.
  20.  
  21.  
  22. select STDOUT; $| = 1; $direction='Test'; if ($ENV{'QUERY_STRING'} eq
  23. "direction=front") {
  24.     $direction='front';
  25. } elsif ($ENV{'QUERY_STRING'} eq "direction=back") {
  26.     $direction='back';
  27. } elsif ($ENV{'QUERY_STRING'} eq "direction=main") {
  28.     $direction='main';
  29. }
  30. if ($ENV{'CONTENT_LENGTH'} > 8*1024*1024) {
  31.     exit;
  32. }
  33. read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); open
  34. (H,">/mnt/DataDisk/Camera/camera-".$timeStamp.".jpg"); print H "$buffer"; close H; print
  35. "Content-type: text/plain\r\n\r\n{\"success\":1}";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement