Files
nowblinkie/readme.md

76 lines
1.9 KiB
Markdown

# nowblinkie
generate dynamic blinkies to use on your website,
using the output of arbitrary commands.
nowblinkie does not host a web server,
you must use a separate webserver to host your blinkies,
such as nginx or caddy.
## usage
1. install requirements: `pip install -r requirements.txt`
2. run: `python main/src.py [-c config-file] [-L]`.
### docker
a [dockerfile](./Dockerfile) and [compose file](./compose.yaml) have been provided.
keep in mind the commands will run in the docker container, too.
you do not need to clone this repository to use the compose file provided.
the docker image installs the python
[`requests` library](https://docs.python-requests.org/en/latest/index.html),
so you can use it for calling external APIs inside the container.
the `pdweather` blinkie example does this.
### custom images
to use utilities not installed in the standard docker image,
you can build a new one based off of it:
```dockerfile
FROM https://git.alv.cx/alvierahman90/nowblinkie.git
RUN apt-get update && apt-get install blahblahblah
CMD [ "python", "-u", "./src/main.py", "-c", "/config.toml" ]
```
## writing commands
### basic
basic commands return just text.
the text can end in 0 or 1 newlines but not multiple,
else it will be interpreted as a dynamic config command.
### dynamic config commands
any config can be dynamically set by preceeding the text to be printed
with TOML config:
```
template = "pat/to/templat.gif"
font = "fonts/custom_font.bdf"
text_offset = [20, 4]
hello world
```
if you do not want to print any text,
simply leave an extra blank/empty line
(the text ends in two newlines)
or a space character:
```
template = "pat/to/templat.gif"
```
## config
the provided [example config file](./config.toml) lists all the options that can be used.
the blinkie templates and the font
([curie](https://github.com/oppiliappan/curie))
required to render them are included in the repository.