Update README with mailcap information

This commit is contained in:
Paul Nameless 2020-06-12 20:35:38 +08:00
parent e92eb979fa
commit e80e639cc1

View file

@ -27,6 +27,9 @@ TODO:
## Usage
`python3.8` required.
From pip:
```sh
@ -36,6 +39,7 @@ pip3 install tg
From sources:
```sh
pip3 install python-telegram
git clone git@github.com:paul-nameless/tg.git
cd tg
PYTHONPATH=. python3 tg/main.py
@ -48,16 +52,14 @@ docker run -it --rm tg
## Optional dependencies
- `terminal-notifier` or other program for notifications (see configuration)
- `ffmpeg` to record voice msgs and upload videos correctly
- [tdlib](https://tdlib.github.io/td/build.html?language=Python) - in case of incompatibility with built in package
For macOS:
For example, macOS:
```sh
brew install tdlib
```
and then set in config `TDLIB_PATH`
- `python3.8`
- `pip3 install python-telegram` - dependency for running from sources
- `terminal-notifier` or other program for notifications (see configuration)
- `ffmpeg` to record voice msgs and upload videos correctly
## Configuration
@ -127,6 +129,28 @@ MSG_FLAGS = {
}
```
### Mailcap file
Mailcap file is used for deciding how to open telegram files (docs, pics, voice notes, etc.).
Example: `~/.mailcap`
```ini
# media
video/*; mpv "%s"
audio/ogg; mpv --speed 1.33 "%s"
audio/mpeg; mpv --no-video "%s"
image/*; qView "%s"
# text
text/html; w3m "%s"
text/html; open -a Firefox "%s"
text/plain; less "%s"
# fallback to vim
text/*; vim "%s"
```
## Keybindings
@ -151,10 +175,10 @@ For navigation arrow keys also can be used.
- `J,K`: move 10 msgs up/down
- `G`: move to the last msg (at the bottom)
- `l`: if video, pics or audio then open app specified in mailcap file, for example:
```
```ini
# Images
image/png; icat %s && read
audio/*; mpv %s
image/png; qView "%s"
audio/*; mpv "%s"
```
if text, open in `less` (to view multiline msgs)
- `e`: edit current msg