jGrabber

Version 1.0 Alpha
Copyright 2002
Pete Arvanitis - Software Engineer


SourceForge Logo


What is jGrabber?

jGrabber is an command-line webcam capture utility that is configured via and XML document. It is distributed as a JAR file and requires Java J2SE 1.4 to run.

Where can I download jGrabber?

jGrabber is available for download on Sourceforge.net.

How do I run jGrabber?

Usage: java -jar jGrabber.jar

By default, jGrabber will look for a configuration file called jgrabber.xml  in the directory its executed in. You can also specify a custom configuration file for jGrabber

Usage: java -jar jGrabber.jar c:\webconfigs\jgrabber.xml 

How do I configure jGrabber?

jGrabber is configured via a simple xml file. A sample config file is 
provided in the /bin directory of this distribution.

The top level element is "jgrabber" which contains sub-elements used to
configure the application. It contains the "rootdir" attribute which is used to specify the top directory that the webcam images will be stored

The <debug> element is used for setting the debug level of jgrabber. The first attribute is "level" which is used to determine the amount of logging that will take place. The available levels are debug, info, warn, and error.  jGrabber ships w/ "info" as the default level. The second attribute is "logfile" which specified the path and name of the file that will record the debug log entries.

The <webcams> element is used to specify each webcam that jGrabber will be tracking. It may contain 1 or more <cam> nodes, one for each webcam being grabbed. The attributes of the cam node are:

  •  "name": The name of the image. This will be the prefix of the image when it is downloaded
  • "url": The URL of the webcam image.
  • "reload": The refreshrate in ms. For example, a refresh rate of 15000 will reload the webcam every 15 seconds.
  • "sleepThreshold": This is the number of duplicate images that can be downloaded before putting the thread in a sleep state.
  • "sleepTime": The amount of time the individual thread will sleep if its sleepThreshold has been reached.
  • "username": [Optional] The username to use if the webcam image is protected using Basic Authentication
  •  "password": [Optional] The password to use if the webcam image is protected using Basic Authentication

The "sleepThreshold" feature is useful if you are downloading a webcam that is not updated 24 hours a day. For example, if your sleep threshold is set to 4,  then your thread will automatically go to sleep after 4 duplicate images have  been downloaded. If your sleepTime has been set to 1800000 (30 min), the application will not try to download that webcam image until the 30 minutes has
expired. This will save you and the webcam host the bandwidth required to  download duplicate images. It will also keep the webcam host's logs from being  crowded with duplicate requests. To disable this feature set the sleepThreshold to 0.

 

Sample jgrabber.xml file

<?xml version='1.0' encoding='UTF-8'?>

<jgrabber rootdir="webcams">
<!-- The -->

<debug level="info"
             logfile="jgrabber.log"
/>

<!-- sample webcams -->
<webcams>

     <!-- standard webcam -->
     <cam name="medusa1"
               reload="1000"
              sleepThreshold="5"
              sleepTime="1800000"
              url="http://216.234.118.40/webcams/medusa_test1.jpg"
     />

     <!-- password protected webcam -->
     <cam name="medusa2"
              reload="1000"
             sleepThreshold="5"
             sleepTime="1800000"
             url="http://216.234.118.40/webcams/medusa_test2.jpg"
             username="myUserName"
            password="myPassword"
       />
</webcams>
</jgrabber>

Can I modify jGrabber or use it in my own projects?

The answer to both questions is yes. jGrabber is Open Source and my be modified in accordance to its license.  Source code and build scripts are available in the zip distribution.

jGrabber License

Copyright (c) 2002, Pete Arvanitis - Software Engineer

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 

* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 

* Neither the name of PeteCode.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright 2002. Pete Arvanitis