# About:
This application monitors your Twitter home timeline or any number (within the Twitter API limits) of hashtags of your choice and prints all incoming Tweets via an ESC/POS compatible thermal printer.

# Installation:
### System requirements
This application has been developed and tested on Linux, targeting python3.6 or newer.
It might work on macOS (likely) and Windows (very unlikely).

### Create a virtualenv with the required dependencies
```bash
python3 -m venv venv
venv/bin/pip install -r requirements.txt
```
### Getting Twitter API access
- If you already have access enter your consumer key/secret and access token/secret in the next step.
- If you don't have such credentials you must create a Twitter App and get the required information after you've created it.

### Create and fill in config.toml
```bash
cp config.toml.example config.toml
$EDITOR config.toml
# Put the required information into config.toml
```
Besides the already mentioned API credentials the config.toml contains other (interesting) settings.
For each setting there is a short explanation on what the setting does and what the default value is if the setting is not defined.

# Printing Tweets
### Check your thermal printer
- Ensure it supports ESC/POS.
- See if your operating system detects your printer (look at the output of dmesg).
- Check if the user that will be running this application can access the printer (check `ls -l /dev/usb/lp*`, `id $USER`).
- A line width of 48 characters and Latin-1 as printer codepage 6 are assumed.
- This application was tested with a Excelvan/Hoin HOP-E801 printer. No other models/printers have been tested yet.

### Printing your home timeline
```bash
venv/bin/python3 printer.py --printer /path/to/printer
```
If you don't want to see retweets make sure to include the `-n` or`--no-retweets` option in the command line above

### Printing a specific (or multiple) hashtags
```bash
venv/bin/python3 printer.py --printer /path/to/print "#hashtag1" "#hashtag2"
```
If you want to see retweets in this mode make sure to include the `-r` or `--retweets` option in the command line above

# Developing/Testing
You can test this application without a thermal printer connected by simply omitting the `-p`/`--printer` argument when starting it. In that case you'll just get the output in your terminal.
