Giter Site home page Giter Site logo

tparker-usgs / camfetcher Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 38 KB

I use IMAP-SSL to retrieve images which a Spartan cam has sent to an email address

License: Creative Commons Zero v1.0 Universal

Dockerfile 7.70% Python 84.83% Shell 7.46%

camfetcher's Introduction

camfetcher

Build Status Code Climate

Configuration

camfetcher looks to its environment for configuration. It requires the following four environment variables to be set:

  • IMAPSERVER remote server hosting mailboxes to be polled
  • CF_USER Usename used to connect to IMAPSERVER
  • CF_PASSWD Password used to connect to IMAPSERVER
  • CF_CAMS A colon-seperated list of mailboxes to poll for images
  • CF_OUT_DIR Base directory. Images will be placed here.

Optionally, camfetcher will email messages logged at level error or greater. To enable this, set the following environment variables:

  • MAILHOST SMTP server
  • LOG_SENDER Address used for From:
  • LOG_RECIPIENT Address used for To:

A timeout value for requests can also be optionally set using the following environment variable:

  • CF_TIMEOUT The number of seconds before a request times out.

Installation

camfetcher can be installed directly or run in a Docker container.

To install directly, place the two .py files somethere convienent and install the required Python libs with something like pip install -r requirements.txt.

The support/ directory has example files for building a docker image. Start with support/deploy.sh and go from there.

Operation

camfetcher.py

camfetcher.py does the work of retrieving the images. When launched, camfetcher.py will connect to the remote IMAP server and download all unread messages in the folders pointed to by the CF_CAMS environment variable. Each message will be searched for attachements and those with a filename matching the Spartan standard will be downloaded and placed into a directory structure suitable for long-term storage.

update_current_image.py

update_current_image.py writes metadata for the most recent image, creates a copy of that image at a well-known location, and also creates a thumbnail of the image.

When launched, update_current_image.py will work through camera-specific directories for cams pointed to by the CF_CAMS environment variable. It will read the current metadata file and look for an image uploaded in the current hour that is more recent than indicated in that file. If one is found, the metadata file, image copy, and thumbnail will all be updated.

camfetcher's People

Contributors

tparker-usgs avatar wtollett-usgs avatar

Watchers

James Cloos avatar  avatar

Forkers

wtollett-usgs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.