Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/minimaxir/magic-the-gifening

A Twitter bot which tweets Magic: the Gathering cards with appropriate GIFs superimposed onto them.
https://github.com/minimaxir/magic-the-gifening

Last synced: 16 days ago
JSON representation

A Twitter bot which tweets Magic: the Gathering cards with appropriate GIFs superimposed onto them.

Awesome Lists containing this project

README

        

# Magic: The GIFening
![](howl_from_beyond.gif)

A Twitter bot which tweets Magic: the Gathering cards with appropriate GIFs superimposed onto them. Made in Python using the [GIPHY API](https://developers.giphy.com) and [MoviePy](https://github.com/Zulko/moviepy).

You can see the bot in action at [the Twitter account @MTGIFening](https://twitter.com/MTGIFening).

Some highlights:

* [Vendetta](https://twitter.com/MTGIFening/status/916902255277760514)
* [Sudden Shock](https://twitter.com/MTGIFening/status/913981726182981632)
* [Metamorphosis](https://twitter.com/MTGIFening/status/914012656167559168)
* [Constant Mists](https://twitter.com/MTGIFening/status/917080928853254144)
* [Screaming Fury](https://twitter.com/MTGIFening/status/912525635632775168)

In order to tweet on a regular schedule, the Dockerfile contains a cronjob which runs the script at the specified interval of time (currently set at 4 times a day/every 6 hours).

## Usage

First, create a `secrets.py` with the appropriate GIPHY and Twitter API Keys:

```
GIPHY_API_KEY = ''
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_KEY = ''
ACCESS_SECRET = ''
```

The current list of cards used to generate images is derived from `cards.csv`. If you want to update the list, use `get_cardlist.py` and the `AllSets.json` file from [MTG JSON](https://mtgjson.com).

Then run `mtgifening.py` and it should save and tweet a random GIF!

To run as a Twitter bot on the schedule, after you've added your `secrets.py` file, build the Docker container. Then run the container in detached mode, starting it up using `/sbin/my_init`:

```
docker run --rm -d magic /sbin/my_init
```

## Notes
* The files generated are actually videos, not proper GIFs. Videos are created much faster, take less disk space, and on Twitter, functionally identical to GIFs (videos less than 6 seconds will also autoloop).

## Requirements
moviepy, ffmpeg, twython, Pillow

## Maintainer/Creator

Max Woolf ([@minimaxir](http://minimaxir.com))

*Max's open-source projects are supported by his [Patreon](https://www.patreon.com/minimaxir). If you found this project helpful, any monetary contributions to the Patreon are appreciated and will be put to good creative use.*

## License
MIT