https://github.com/valodim/zsh-livestreamer-completion
zsh completion for livestreamer (with twitch teams and followed channels)
https://github.com/valodim/zsh-livestreamer-completion
Last synced: about 2 months ago
JSON representation
zsh completion for livestreamer (with twitch teams and followed channels)
- Host: GitHub
- URL: https://github.com/valodim/zsh-livestreamer-completion
- Owner: Valodim
- Created: 2013-10-18T01:39:55.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2013-11-06T23:55:41.000Z (over 12 years ago)
- Last Synced: 2025-01-17T00:12:31.304Z (over 1 year ago)
- Language: Shell
- Size: 125 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
zsh livestreamer / twitch.tv / justin.tv completion
===
This is a zsh completion for
[livestreamer](https://github.com/chrippa/livestreamer). At this point, it only
completes options as usual, and channels from twitch.tv as well as justin.tv.

installation and configuration
---
Installation works by copying or symlinking the _livestreamer completion file
somewhere into your fpath, or putting the repo directory in your fpath variable
like this:
fpath+=( /path/to/zsh-livestreamer-completion )
Without configuration, options and stuff will be completed, but no channels.
There are two types of completions supported for channels, followed and teams.
twitch.tv followed channel config
---
To get completion of channels followed by an account, a twitch
[implicit grant flow](https://github.com/justintv/Twitch-API/blob/master/authentication.md#implicit-grant-flow)
oauth token with scope user_read for that account is required. To get one,
simply run the 'oauth.zsh' script, which should guide you through the process.
In the end, you should end up with a zstyle like this:
zstyle ":completion:*:twitch:follows" oauth-token abcdefghijklmnopqrstuvwxyz12345
That's it! Completion should otherwise just work™
twitch.tv team channel config
---
This is the easier one, it completes twitch teams. All you need to do is set a
style to all teams you want completed:
zstyle ":completion:*:twitch" teams srl
This completes the [SpeedRunsLive](http://twitch.tv/team/srl) team. More than
one is possible by just adding more names to the line.
justin.tv favorite channel config
---
Unlike the twitch.tv followed channels, favorites for justin.tv do NOT need
authentication. Yay! Simply set your username like this:
zstyle ":completion:*:justin:favorites" username MyTwitchUsername
fine tuning
---
There are a couple more zstyles for fine tuning:
# minimum number of viewers a stream needs to have to show up
zstyle ":completion:*:twitch:x" viewmin 0
# max streams to show for one category
zstyle ":completion:*:twitch:x" maxstreams 20
# completion description format. placeholders %n, %d, %c, %g, %t are
# available for name, displayname, viewercount, game and title.
zstyle ":completion:*:twitch:x" format "%-5c %15d %t"
The x in the style can be either "follows" for followed streams, "teams:*"
to set styles for all teams, or "teams:teamname" to set for a specific team.
For example, to show srl streams with more than 100 viewers only:
zstyle ":completion:*:twitch:teams:srl" viewmin 100
By default, there is no minimum viewer count, and at most 20 streams per
category are shown.
caveats
---
One thing I am not quite happy about is that the completion is not pure zsh, it
calls to python for json parsing.
[I tried](https://gist.github.com/Valodim/7017924) doing the parsing in zsh,
but it's just not feasible in an efficent manner. But since livestreamer itself
is python, I figured it'd be okay to outsource this with some lines of python.
Then again, it uses curl for fetching the data so~