aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: fbe1091f34472550e2a1b2cbda711f011ccdfba4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# chzzkd
Stream notification daemon for <https://chzzk.naver.com>. It executes
shell hooks (by `/bin/sh -c`) when listed channels go live or
offline. Useful context, such as the stream title, is passed to the
script as environment variables.

Example configuration:
```toml
timeout = 10

[hooks]
went_open = '''
url="https://chzzk.naver.com/live/$CHZZKD_ID"
action=$(notify-send -a chzzkd \
  -A default="mpv" \
  "$CHZZKD_ALIAS: hello" \
  "$CHZZKD_LIVE_TITLE")

case "$action" in
  default) mpv "$url" ;;
esac
'''
went_close = 'notify-send -a chzzkd "$CHZZKD_ALIAS: bye"'

[[channel]]
id = "c847a58a1599988f6154446c75366523"
alias = "dopa"

[[channel]]
id = "a7e175625fdea5a7d98428302b7aa57f"
alias = "chamcham"

[[channel]]
id = "6e06f5e1907f17eff543abd06cb62891"
alias = "nokduro"

[[channel]]
id = "c100f81959d1c17044be0541eed56f5b"
alias = "megajw"

[[channel]]
id = "8b3e8e3a13201cff0836c69cfab62f45"
alias = "flame"

[[channel]]
id = "732f6f16d20991243ec3f2d7afed8821"
alias = "0du"
```

This polls each channel every 10 seconds. When a stream goes live
(`went_open`), it sends a clickable desktop notification. Clicking it
opens the stream directly in `mpv`. When a stream goes offline
(`went_close`), it says goodbye and leaves.

Also, you may find it useful that
```sh
chromium --app="https://chzzk.naver.com/live/$CHZZKD_ID/chat"
```
opens the popup chat window for the channel. :)

---

How to run:
```sh
git clone https://github.com/dilluti0n/chzzkd
cd chzzkd
cargo install --path .
chzzkd < config.toml
```

Currently, configuration is read from stdin. The first release will
replace it with a default config file (such as `/etc/chzzkd.toml`) and
a command-line override.