Terminal Preroll Animation in Python
terminal-preroll is a small, configurable python module for displaying a visually-pleasing, simplistic terminal animation in the style of a "loading screen", intended for use with small games or as a pre-roll animation for a livestream or video; thus the name. The script requires and accepts only three pieces of information:
- the location of a file telling it how to draw its banner;
- the location of a file telling it where to find text for the loading screen itself (the "hype" file), and;
- the amount of time, in minutes, you want it to last for.
The banner and hype files are simple json files, easily-edited, and the script itself handles sizing itself dynamically for your terminal window by use of the python package blessings, with colours provided by termcolor.
How to install
If you're running python3 on most systems, you can install the package with the following command:
pip3 install terminal-preroll
You will also need to either download (from this repo) or create a banner file and hype file.
How to run
Assuming you have your banner and hype files, you can run the script very easily from the command line:
python3 -m terminal-preroll -t 15 -b banner.json -s hype.json
Where:
-tis an argument giving the time-to-run in minutes-bis an argument giving the path to the banner object-sis an argument giving the path to the hype object.
Modifying the Banner Object
The banner file is a json object, of the rough structure below:
- a "banner_strings" attribute, itself an array of strings, each representing one line of the banner.
- a "line_colors" attribute, an array of strings giving a valid terminal color to each line. If there are less entries in this array than lines in banner_strings, the default terminal colour is used.
Note: Much like python, the json standard requires two particular characters be "escaped" by adding an extra \ before them in the strings in banner_strings. This is important if you are using ASCII art, such as in the example below. In your ASCII art, replace \ with \\ and " with \" to account for this.
Modifying the Hype Object
The hype object is very simple - it's just an object of arrays. The "name" of each array is used as the value of phase as in the example screenshot, while the strings in each phase's array are scrolled on the bottom as they "complete".
The script uses the total number of lines in this object and the time the animation is expected to last to determine how often to scroll the screen and how quickly to update the "current item" loading bar.
Metadata
Release files for terminal-preroll 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| terminal-preroll-1.0.tar.gz | 4.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| terminal_preroll-1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.0 kB
Release files / terminal-preroll-1.0.tar.gz
| Download URL | terminal-preroll-1.0.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f672c48121144759dcd6390bd5bdcbc30f2d3c96d9c2fddc4df73337d54aaa4b
|
|
BLAKE2b-256 checksum How to use checksums |
e2f757a18ad4e00ecda6040b0f8af120f5d4e7053137edd52a60a2d166fe411e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Release files / terminal_preroll-1.0-py3-none-any.whl
| Download URL | terminal_preroll-1.0-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5cfe4abe789b0ab01a1ec3a4cdf8f2561756319aeec5cb59d6754fe58793e22d
|
|
BLAKE2b-256 checksum How to use checksums |
723777a529f5ea7cc908cbd8a51aa2732b8998d6b6e5c29ca5a28ddd87fda46a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9
|
Security for terminal-preroll 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.