• Stars
    star
    490
  • Rank 89,811 (Top 2 %)
  • Language
    Python
  • License
    Do What The F*ck ...
  • Created about 11 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Python script to generate gifs from star wars

Star Wars DOT Gif

Quickstart

Setup

Copy the contents of config.cfg.example into config.cfg and make sure to change the relevant paths for VLC or ffmpeg and the Star Wars episodes. Any format that can be read by VLC or ffmpeg should be acceptable for the movies. Note, if you don't plan on running the twitter bot you only need to fill out the general section of the cfg file.

Install python requirements:

pip install -r requirements.txt

Verify you have either vlc or ffmpeg installed (we just need one of both):

$ whereis vlc
vlc: /usr/bin/vlc /usr/lib64/vlc /usr/share/vlc /usr/share/man/man1/vlc.1.gz
$ whereis ffmpeg
ffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz

Usage

To Run with search UI (sample run)

By default the gif is created as star_wars.gif

python star_wars_gif.py

To get a random gif

python make_gifs.py

Embedding in another python-script

If you want to use make_gifs elsewhere use:

from make_gifs import make_gif
# source should be a slug from config.cfg
# index is the index of the quote in the SRT
# for more options see make_gifs.py
make_gif(source, index)

Running the twitter bot

  • make sure you create API accounts for both twitter and imgur
  • update config.cfg to have the keys for both
  • run python twitter_bot.py

The bot will tweet once every hour.

Notes

In detail

It is assumed you have virtualenv installed. If not, it is not very difficult to install or use and will keep your system-python free of fancy packages we are using here.

Requirements

  • python (tested with 2.7 and 3.6)
  • ffmpeg or vlc
  • video-files for movies/videos you want to extract from

Setup Procedure

Create a virtalenv and install python requirements:

cd starwars-dot-gif
virtualenv .env
source .env/bin/activate
(.env)$ pip install -r requirements.txt

Now copy the example config provided and edit with your favourite editor:

cp config.cfg.example config.cfg
vim config.cfg

You must set a path for vlc or ffmpeg, if both are set, ffmpeg will be preferred over vlc. Setting 'vlc' or 'ffmpeg' instead of a path is acceptable if those are executable as-is on your system.

The repository currently includes subtitles for Star Wars episode IV to VIII, you are free to add more video-files with corresponding subtitles (see config.cfg.example). It is recommended that you remove any entires which you do not want to use from the videos-list in the config.

To test the configuration you may run the script with the --help-option, which will give you an extensive explanation of options.

(.env)$ python make_gifs.py --help
usage: make_gifs.py [-h] [--movie [MOVIE [MOVIE ...]]] [--index [INDEX]]
...

Detailed Usage

You may use the script with your config.cfg either with an interactive commandline-tool or directly pass options on the commandline.

Commandline-tool

The commandline-tool has a GUI of sorts and allows you to search in the subtitles. This allows you to look for specific words or quotes you are looking for.

(.env)$ python star_wars_gif.py

This script will ignore any arguments passed to it.

Direct

The direct method can be called from the commandline or from another python script. These options are nearly equally powerful. Using the commandline you may pass any number of options (call with --help to see all of them).

The following command will create a gif with the quote "Aren't you a little short for a stormtrooper?".

(.env)$ python make_gifs.py --movie hope --index 848

Now adding some options:

(.env)$ python make_gifs.py --movie hope --index 848 --padding 0 0.6 --subtitle "I have been expecting you"

This added 0.6 seconds (and a confused Luke) to the end of the gif and changed the rendered subtitle to "I have been expecting you". As previously mentioned there are many more options available.

When called from python usage follows a general pattern:

from make_gifs import make_gif
# source should be a slug from config.cfg
# index is the index of the SRT
# for more options see make_gifs.py
make_gif('hope', 848, padding=[0, 0.6], custom_subtitle="I have been expecting you", filename="say_what.gif")

This example will reproduce the above shell example and save it as "say_what.gif". Feel free to try this example in ipython.

More Repositories

1

dummy

Trash for the trash god πŸ—‘οΈ
Python
69
star
2

tarot-api

A simple tarot API
Ruby
42
star
3

videos-to-gif

takes video(s) and associated subtitle files and creates gifs for every line of dialogue
Python
39
star
4

AsciiAsciiRevolution

A Game for the OSGCC4
HTML
22
star
5

not-pepe

Basic Pepe/Not-pepe image classifier
Python
21
star
6

XOmBot

A perl and ruby bot made for #xomb
Ruby
14
star
7

kessel-run

phaser.io game
JavaScript
13
star
8

github-contribution-graph-art-generator

Generates Art for your contribution graph
JavaScript
13
star
9

cutiefinder

AI guaranteed to find cuties
HTML
11
star
10

quick_gif

Quickly create a gif
Python
11
star
11

WiCVis

A visualization using processing.js of the Women in Computing Timeline
Processing
10
star
12

magic-crystal

A crystal for the on-the-go witch
C++
8
star
13

intro-to-git

An introduction to git for GDI PGH
JavaScript
7
star
14

notification-filterer

Notification filterer
Ruby
7
star
15

messangerbag

Arduino
7
star
16

CuppaTea

2015's best (only) tea simulation game
C#
7
star
17

sjw-chrome-extension

A chrome extension to do stupid things
JavaScript
6
star
18

as-the-crow-flies

Lua
6
star
19

HNPL

Harm None Public License
6
star
20

TriangleSelectors

New ways to collect gender identity and sexaulity information
JavaScript
6
star
21

pride-prejudice-dungeons-dragons

Markov nonsense generated from D&D 5e Monster Manual and Pride and Prejudice
Python
6
star
22

Margin-and-Tonic

A social reading web application
JavaScript
6
star
23

love

some kind of game eventually written using LΓ–VE
Lua
6
star
24

package-tracking-simulator-2015

Package Tracking Simulator 2015 - All the excitement of waiting for packages to be delivered without the annoyance of the package!
HTML
6
star
25

blog

A blog in Sinatra for great good
HTML
5
star
26

resume

my JSON resume
HTML
5
star
27

stencils

A collection of all of my stencils (that I remembered to save)
5
star
28

Bibliomania

Syncs up goodreads statuses from the metadata read from a sony ebook reader
C#
5
star
29

DownloadAllTheThings

Keep track of Comcast data usage right from the windows tray
C#
5
star
30

trivia-llama

It's a llama. On Twitter. It LOVES trivia.
Ruby
4
star
31

rusty-dagger

Rogue-like in Rust
Rust
4
star
32

minorProjects

All my small projects that I work on
C#
4
star
33

invaders

octocat vs the identiconssssss
JavaScript
4
star
34

JARRETTTBot

I am here to annoy Jarrett
Ruby
4
star
35

revenantrivia

A simple trivia bot written in perl
Perl
4
star
36

pull-request-on-bundle-update-with-optional-jfrog

This is probably not useful to anyone but me, sorry
Shell
3
star
37

WubClock

The C# alarm clock that plays dubstep
C#
3
star
38

Computing-Demographics-Data

Survey results from the following computing demographics survey: https://www.surveymonkey.com/s/TFFKHRJ
3
star
39

coffeebean

The simple PHP-based CMS for Caffeine Powered Automaton
PHP
3
star
40

love_weather

weather using LOVE2D particle systems
Lua
3
star
41

electron-react-template

A electron app template that uses React.js and has some other useful tools
JavaScript
3
star
42

Windows

A small audio prose artgame in Unity
C#
3
star
43

xomb-cms

This is the minimal cms used on xomb.org
Ruby
3
star
44

Hunky-Dodecahedron

Ever thought, hey what would it be like to date a dodecahedron... well
3
star
45

lindseyb.zsh-theme

my custom zsh theme
2
star
46

volumify

Increase/decrease the volume of the TV when the ambient sound passes a threshold
Arduino
2
star
47

cawcaw

Simple RoR web gallery
Ruby
2
star
48

fART

collection of ART
HTML
2
star
49

test-empty-repo

2
star
50

GIFs

ALL THE GIFS
HTML
2
star
51

nat20-py

Making Python track D&D rolls for me
Python
2
star
52

GitHub-Logo-LED-Matrix

Simple flashing GitHub logo on the Adafruit 32x32 LED Matrix using Matrix Portal
Python
2
star
53

HardwareHulaHoopsAndFlow

slides for OSBridge 2016 talk
2
star
54

moon-api

RESTful API for the Moon
Ruby
2
star
55

SmashingPumpkins

C#
2
star
56

celestial-bodies

A game about stuff
C#
2
star
57

project-status-auto-report

Ruby
2
star
58

Everybody-Loves-Pizza

WHAT HAVE I DONE
Ren'Py
2
star
59

blog-jekyll

My blog written in jekyll
JavaScript
2
star
60

sturdy-engine

not sure where I'm going with this yet, bear with me
JavaScript
2
star
61

color-to-swatch

command line tool to convert adobe color palettes to procreate .swatches files
Python
2
star
62

bmp-to-pov

Makefile
2
star
63

procreate-palattes

.swatches files for procreate
1
star
64

LEDMiniHoops

Arduino
1
star
65

phrases-machine

A game where you need to guess the phrase from the machine backtranslation
JavaScript
1
star
66

Project-Seshat

C
1
star
67

dotfiles

idk my bff jill
Shell
1
star
68

nepeta-cataria

Ludum Dare 34 Game
C#
1
star
69

eir

intended to be a cleaning task tracking app
JavaScript
1
star
70

FirePendant-FeatherWing

Arduino
1
star
71

bobs-burgers-gifs

Tools and scripts for generating all the bob's burgers gifs
Python
1
star
72

hello-world

hello world kong plugin
Lua
1
star
73

cosee

1
star
74

the-text

Twine game about text messaging
HTML
1
star
75

LindseyB

✨special ✨
1
star
76

nepeta-cataria-server

high score server for nepeta carataria
Ruby
1
star
77

z3lf.tripod.com

A crawled copy of z3lf.tripod.com
HTML
1
star
78

galaxy-scarf

A scarf of magic
C++
1
star
79

keyboardtime

part of project fun
Visual Basic
1
star
80

PhotocopierHero

A game - in unity - about Photocopiers
C#
1
star