{"id":13595890,"url":"https://github.com/LindseyB/starwars-dot-gif","last_synced_at":"2025-04-09T13:33:44.660Z","repository":{"id":10893833,"uuid":"13186343","full_name":"LindseyB/starwars-dot-gif","owner":"LindseyB","description":"Python script to generate gifs from star wars","archived":false,"fork":false,"pushed_at":"2021-05-05T20:28:24.000Z","size":7200,"stargazers_count":489,"open_issues_count":2,"forks_count":46,"subscribers_count":25,"default_branch":"trunk","last_synced_at":"2025-04-05T11:11:12.138Z","etag":null,"topics":["bot","python","star-wars","twitter-bot"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LindseyB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-29T04:24:37.000Z","updated_at":"2025-03-30T00:40:51.000Z","dependencies_parsed_at":"2022-07-09T23:16:19.971Z","dependency_job_id":null,"html_url":"https://github.com/LindseyB/starwars-dot-gif","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LindseyB%2Fstarwars-dot-gif","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LindseyB%2Fstarwars-dot-gif/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LindseyB%2Fstarwars-dot-gif/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LindseyB%2Fstarwars-dot-gif/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LindseyB","download_url":"https://codeload.github.com/LindseyB/starwars-dot-gif/tar.gz/refs/heads/trunk","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248049740,"owners_count":21039269,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","python","star-wars","twitter-bot"],"created_at":"2024-08-01T16:02:00.515Z","updated_at":"2025-04-09T13:33:44.155Z","avatar_url":"https://github.com/LindseyB.png","language":"Python","funding_links":[],"categories":["3rd party","Python"],"sub_categories":["Swift"],"readme":"# Star Wars DOT Gif\n\n## Quickstart\n\n### Setup\n\nCopy 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.\n\nInstall python requirements:\n\n```bash\npip install -r requirements.txt\n```\n\nVerify you have either vlc or ffmpeg installed (we just need one of both):\n\n```bash\n$ whereis vlc\nvlc: /usr/bin/vlc /usr/lib64/vlc /usr/share/vlc /usr/share/man/man1/vlc.1.gz\n$ whereis ffmpeg\nffmpeg: /usr/bin/ffmpeg /usr/share/ffmpeg /usr/share/man/man1/ffmpeg.1.gz\n```\n\n### Usage\n\n#### To Run with search UI [(sample run)](http://www.youtube.com/watch?v=n387eBqnw1o)\n\nBy default the gif is created as **star_wars.gif**\n\n```bash\npython star_wars_gif.py\n```\n\n#### To get a random gif\n\n```bash\npython make_gifs.py\n```\n\n### Embedding in another python-script\n\nIf you want to use ```make_gifs``` elsewhere use:\n\n```python\nfrom make_gifs import make_gif\n# source should be a slug from config.cfg\n# index is the index of the quote in the SRT\n# for more options see make_gifs.py\nmake_gif(source, index)\n```\n\n### Running the twitter bot\n\n- make sure you create API accounts for both twitter and imgur\n- update **config.cfg** to have the keys for both\n- run ```python twitter_bot.py```\n\nThe bot will tweet once every hour.\n\n### Notes\n\n- if you know what a [virtualenv](https://virtualenv.pypa.io/en/stable/userguide/) is, we recommend you use one\n- for more options on creating gifs, please read the [embbeded documentation](make_gifs.py)\n\n## In detail\n\nIt is assumed you have [virtualenv](https://virtualenv.pypa.io/en/stable/installation/) 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.\n\n### Requirements\n\n- python (tested with 2.7 and 3.6)\n- ffmpeg or vlc\n- video-files for movies/videos you want to extract from\n\n### Setup Procedure\n\nCreate a virtalenv and install python requirements:\n\n```bash\ncd starwars-dot-gif\nvirtualenv .env\nsource .env/bin/activate\n(.env)$ pip install -r requirements.txt\n```\n\nNow copy the example config provided and edit with your favourite editor:\n\n```bash\ncp config.cfg.example config.cfg\nvim config.cfg\n```\n\nYou 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.\n\nThe 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](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.\n\nTo test the configuration you may run the script with the ```--help```-option, which will give you an extensive explanation of options.\n\n```bash\n(.env)$ python make_gifs.py --help\nusage: make_gifs.py [-h] [--movie [MOVIE [MOVIE ...]]] [--index [INDEX]]\n...\n```\n\n### Detailed Usage\n\nYou may use the script with your config.cfg either with an interactive [commandline-tool](star_wars_gif.py) or directly pass options on the commandline.\n\n#### Commandline-tool\n\nThe 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.\n\n```bash\n(.env)$ python star_wars_gif.py\n```\n\nThis script will ignore any arguments passed to it.\n\n#### Direct\n\nThe 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).\n\nThe following command will create a gif with the quote \"Aren't you a little short for a stormtrooper?\".\n\n```bash\n(.env)$ python make_gifs.py --movie hope --index 848\n```\n\nNow adding some options:\n\n```bash\n(.env)$ python make_gifs.py --movie hope --index 848 --padding 0 0.6 --subtitle \"I have been expecting you\"\n```\n\nThis 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.\n\nWhen called from python usage follows a general pattern:\n\n```python\nfrom make_gifs import make_gif\n# source should be a slug from config.cfg\n# index is the index of the SRT\n# for more options see make_gifs.py\nmake_gif('hope', 848, padding=[0, 0.6], custom_subtitle=\"I have been expecting you\", filename=\"say_what.gif\")\n```\n\nThis example will reproduce the above shell example and save it as \"say_what.gif\". Feel free to try this example in [ipython](http://ipython.readthedocs.io/en/stable/).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLindseyB%2Fstarwars-dot-gif","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLindseyB%2Fstarwars-dot-gif","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLindseyB%2Fstarwars-dot-gif/lists"}