English
Deutsch
  

Code


About Matthias Nott
Business Objects
Picture Galleries
Code
Technical
Download





Locations of visitors to this page

We now have the ultra modern Sony Cybershot DSC-N1, the first digital camera with touchscreen operation. The settings of the camera can be controlled by touching buttons on the display. One cool feature is that with manual focus, you can actually tip on the display the location which you want to be sharp, i.e. you can use your fingertip as a cursor. Equally excellent is the diashow: It gives you nice dia shows with music right on your TV. Videos can have any length (depending on the size of the memory stick; we bought 1 GB and could theoretically record about 30 minutes of video), and they actually do look pretty good on a TV screen and as well in full screen mode on a laptop. The battery really keeps you going - I never ran into an empty battery so far. The flash is excellent. In low light situations, a red light is used for the autofocus. The camera has 8 megapixels, 3x optical zoom, F2.8-5.4 aperture and a focal length of 38 - 114 mm (35mm equivalent).

 

The camera connects as a memory stick to a Windoze Computer. For a reason I ignore, I was not able to read the memory stick from Linux. So I decided to use gphoto2 to read the data from the camera. The following script downloads the files from the camera and immediately puts them into directories according to the file date:

  1. #!/usr/bin/perl -w
  2. #
  3. # This script extracts files from the camera and
  4. # automatically puts them in subdirectories.
  5. #
  6.  
  7. use strict;
  8. use File::stat;
  9. use Time::localtime;
  10.  
  11. my $viewer = "/opt/kde3/bin/gwenview";
  12. my $target = "/data/mnott/pictures/";
  13. my $tmpdir = "/tmp/bilder";
  14. my $dir1st = "";
  15. my $found  = 0;
  16.  
  17. if(!-d "$tmpdir") {
  18.   system("mkdir \"$tmpdir\"");
  19. }
  20.  
  21. `kdialog --title "Kamera" --msgbox "Kamera anschliessen und dann weiter..."`;
  22.  
  23. system ("konsole --workdir $tmpdir -e gphoto2 -P");
  24.  
  25. opendir(DIR, $tmpdir);
  26. while (my $name=readdir(DIR)) {
  27.   if($name !~ /^\.?\.*$/ && !-d $name) {
  28.     $found = 1;
  29.     my $tm = localtime(stat("$tmpdir/$name")->mtime);
  30.     my $subdir = sprintf( "%4d-%2d-%2d",
  31.     $tm->year+1900, $tm->mon+1, $tm->mday);
  32.     $subdir =~ s/ /0/g;
  33.     $subdir =~ s/_/ /g;
  34.  
  35.     if (!-d "$tmpdir/$subdir") {
  36.       mkdir "$tmpdir/$subdir";
  37.     }
  38.  
  39.     system("mv \"$tmpdir/$name\" \"$tmpdir/$subdir/$name\"");
  40.  
  41.     if($dir1st eq "") {
  42.       $dir1st = "$target/$subdir";
  43.     }
  44.   }
  45. }
  46. closedir(DIR);
  47.  
  48. if($found != 0) {
  49.   system("cp -Rpvf \"$tmpdir\"/* \"$target\"\n");
  50.   system("rm -rf \"$tmpdir\"/*");
  51.   system("$viewer \"$dir1st\"");
  52. }
  53.  
 


11.01.2006, 16:16 Copyright © 2005 MN Soft Industry Software, 108, route de la Fin, CH-1874 Champéry
Tel.: +41 797 844554; Fax: +41 860 797 844554, Responsible: Matthias Nott., mn(at)mnsoft.org
Top of Page