GithubHelp home page GithubHelp logo

kueda / changebrackets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nerdsfornature/changebrackets

0.0 2.0 0.0 28 KB

This is a public repo for our project that uses angle brackets to monitor environmental change

License: MIT License

Ruby 64.22% CSS 5.29% HTML 4.01% JavaScript 26.49%

changebrackets's Introduction

changebrackets

This is a public repo for our project that uses angle brackets to monitor environmental change, including the scripts we use harvest image metadata, display a slideshow on a web page, download images, and compile movies. We've also included our sign designs.

SCRIPTS

These are a couple Ruby scripts we use to help automate the process of getting information about tag usage and making timelapse movies from the images. You don't need to know Ruby to use them, but you should be comfortable with running scripts from the command line. These instructions presume you're runnign some flavor of *nix, but all the underlying libraries are available for Windows so these scripts should work there too.

REQUIREMENTS

INSTALL

git clone https://github.com/nerdsfornature/changebrackets.git
cd changebrackets
bundle

fireslurp.rb

This Ruby script harvests image metadata from social media photos using your tags and stores them in local CSV files or a Google Spreadsheet. Run ruby fireslurp.rb --help to see all the options, but basic usage looks like this:

# Save info about Instagram photos for two tags in a local CSV file
bundle exec ruby fireslurp.rb --instagram-key=xxx morganfire01 morganfire02

# Save info about Twitter photos for two tags to a Google Spreadsheet
bundle exec ruby fireslurp.rb \
  --twitter-key=xxx \
  --twitter-secret=yyy \
  --google-application-credentials=/path/to/your/key.json \
  --google-spreadsheet-id=1234abcd \
  morganfire01 morganfire02

# Save info about photos for two tags using config from a YAML file
bundle exec ruby fireslurp.rb -c fireslurp.yaml morganfire01 morganfire02

The last option using a config file is probably the easiest way to go. fireslurp.yaml provides an example for the config file. The Google Spreadsheet ID is just the unique part of your Google Spreadsheet URL, so if the URL when you're editing it looks like https://docs.google.com/spreadsheets/d/1HF1fEF4j69Ny6ng9TZYNLYnnRb4J6mPCqmckyOrsomI/edit, then the ID is 1HF1fEF4j69Ny6ng9TZYNLYnnRb4J6mPCqmckyOrsomI. Now here's the tricky part: in order to write to a Google Spreadsheet, you'll need to do these annoying things:

  1. Set up a project in the Google Developer Console and create a Service Account. Painful (but functional) instructions at https://developers.google.com/identity/protocols/OAuth2ServiceAccount. You don't need to delegate domain-wide authority, but you do need to hold on to that JSON key file you generate as a part of creating the service account
  2. In the Google Developer Console, enable the Drive API.
  3. Share your spreadsheet with the service account's email address and grant it editing permissions.
  4. Specify the path to that JSON key file you downloaded as an ENV variable named GOOGLE_APPLICATION_CREDENTIALS, in your configureation YAML, or using --google-application-credentials

Note that this script only retrieves info about recent photos, so it should be run at least daily, more often if your tags get a lot of use. We recommend cron or launchd.

moviemaker.rb

Downloads the image files referenced in a Google Spreadsheet made by fireslurp.rb, aligns them using TimeLapser, and stitches them into an animated GIF using ImageMagick. This is really just a little bit of logic on top of some basic shell commands, which should be pretty obvious in the script. Note that you can force it to download the files to a particular folder using the -f flag, and skip the relatively slow processes of downloading and alignment.

# Basic usage
bundle exec ruby moviemaker.rb -c fireslurp.yaml morganfire01

# Download all the image files to a folder named myfolder
bundle exec ruby moviemaker.rb -c fireslurp.yaml -f myfolder morganfire01

# Skip download, just do the alignment based on files in myfolder, and make the movie
bundle exec ruby moviemaker.rb -c fireslurp.yaml -f myfolder --skip-download morganfire01

CHANGEOMATIC

This is a little jQuery-based tool that sort of does what fireslurp does in the browser by pulling in photo data and creating a slideshow. It will only retrieve photos from Flickr and Instagram due to the limitations of Twitter's API in a strictly client-side context like this.

Using Google Spreadsheet

It can also read data from a Google Spreadsheet made by fireslurp, which is one way of getting around the Twitter thing, though doing so requires that you publish your Google Spreadsheet.

Your spreadsheet must meet the following requirements:

  1. If there's more than one sheet, the one containing the photo data must be named Data
  2. It must have columns just like those made by fireslurp.rb, which means it has the following columns as the first row, in this order:
  3. provider
  4. tag
  5. datetime
  6. username
  7. usable_tag
  8. image_url
  9. url
  10. image_url_s
  11. image_url_m
  12. license
  13. title

REQUIREMENTS

USAGE

See changeomatic.example.html

changebrackets's People

Contributors

kueda avatar nerdsfornature avatar

Watchers

 avatar  avatar

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.