gifshare

Store images in S3


License
MIT
Install
pip install gifshare==0.0.4

Documentation

GifShare

Build Status Coverage Status Code Health Gitter

A command-line tool to upload images to S3, for sharing over IRC or whatever. Gifshare can copy an image directly from the Web to your S3 bucket. It will auto-detect the image type and rename it if necessary. Once the image is in your S3 bucket, it supports listing and deletion (more functions coming soon!)

Don't try this at home, kids

Requirements

  • Python 2.7 (it might run on earlier versions)
  • libmagic (install on OSX with brew install libmagic, or on debian/ubuntu with sudo apt-get install file
  • An AWS account

Installation

At the moment

  • Run pip install -r requirements.txt
  • Copy gifshare into your path somewhere.
  • Create a file at ~/.gifshare - it should be an ini file, and should contain the following:
[default]
aws_access_id=<your-aws-access-id>
aws_secret_access_key=<your-aws-secret-access-key>
web_root=<http://your.s3.bucket.domain.name/>
region=<aws-region-code>
bucket=<your-bucket-name>

Usage

The most common usages are probably the following:

gifshare upload /path/to/my.gif

... will upload my.gif to your S3 bucket, and print out the URL of the uploaded gif.

gifshare upload http://funnygifz.guru/a/funny.gif

... will upload funny.gif to your S3 bucket and print out the URL of the uploaded gif.

You can rename a file with a second argument - do not add the filetype suffix!

gifshare upload /path/to/my.gif kitty-hates-whales

... will upload my.gif to your S3 bucket with the new name 'kitty-hates-whales.gif'. If the file isn't a gif, it will rename it with the correct suffix - one of .gif, .jpeg, or .png. If your file isn't one of these types, gifshare will exit with an error.

See Uploaded Files

You can list all the images you have stored in your S3 bucket with the 'list' subcommand:

gifshare list

If you're not fussy about which image you want to display, you can use the -r flag to list, which will print out one, random entry:

gifshare list -r

If you need the URL for an uploaded file, you can use the expand subcommand, if you can remember the file name:

$ gifshare expand badger-dance.gif
http://gifs.ninjarockstar.guru/badger-dance.gif

If you can't remember the exact filename, you can use grep which searches for text anywhere in the filename:

$ gifshare grep ger
http://gifs.ninjarockstar.guru/badger-dance.gif
http://gifs.ninjarockstar.guru/germans-are-coming.gif
http://gifs.ninjarockstar.guru/gerunds.gif

Delete Files

You can delete files from your remote store with the delete subcommand:

gifshare delete surfing-puppiez.gif

Advanced Usage

You'll usually want the new URL on your clipboard so you can paste it into your IRC channel or wherever. Because gifshare prints out the new URL, you can pipe it to your operating system's clipboard utility! On OSX, this is:

gifshare upload /path/to/my.gif funniest-gif-evarr | pbcopy

When gifshare has completed the upload, you can then switch to your chat app and hit paste. Funny pic goodness, guaranteed.