BasioMeusPuga / twitchy

CLI streamlink wrapper for twitch.tv
GNU General Public License v3.0
91 stars 14 forks source link

Add a `--machine-readable` flag #14

Closed apetresc closed 7 years ago

apetresc commented 7 years ago

I am writing a little rofi/dmenu script to interact with twitchy. While I can get it to work, it is annoying to have to constantly be faking a tty and parsing human-readable output. I would love to add a --machine-readable flag to a couple of the commands that basically lists the appropriate output in CSV or JSON or something similar, and doesn't expect anything on stdin.

I can quickly implement something like this myself, would it be merged?

apetresc commented 7 years ago

Okay, I just noticed --conky. I think this meets most of my needs, except that it doesn't seem to have any way to include information about the games, is that right?

BasioMeusPuga commented 7 years ago

Indeed. --conky just shows either the alternate names set in the database, or a CSV listing of the actual channel names. Including game names shouldn't be issue at all, really.

In case you want to write something for it, go ahead. I would do it myself, but I'm currently doing a complete rewrite of the entire project @ https://github.com/BasioMeusPuga/twitchy/tree/v3 You'll see why that is necessary in case you decide to go into the current code for --conky. It's a mess of entangled functions, and code convention violations. But if you can make do with what you're getting with --conky currently, give me an idea of the values you'd like returned, and I'll put it on my TODO.

apetresc commented 7 years ago

Yes, I was able to get it working with --conky, more or less :) Looks like this (triggers from Alt-t):

2017-09-24-222106_1918x1079_scrot

And then clicking a stream opens it up in twitchy. It's extremely simple, but works well (rofi does the heavy lifting of doing the filtering, etc). The only thing I would like to add is the game subsections, for which I would like an output mode similar to --conky csvnames except instead of

channel1,channel2,...,channeln

it would instead be:

game1,channel1
game1,channel2
game1,channel3
game2,channel4
...
game(k),channel(n)

This would be easiest to parse in bash.

BasioMeusPuga commented 7 years ago

Yes, I can see this working. In fact, since the channel names come pre-checked from the API, I can make it so that we can skip the additional step of having to select something again. This is definitely going on the list.

I'm leaving this issue open for now. I'll close it when I merge the new branch.

apetresc commented 7 years ago

Ah yes, that would also be great - if I could pass in a channel name from the list returned by twitchy and have it skip the API call to search it up again :)

Thanks! I look forward to v3.

Hund commented 7 years ago

@apetresc Where can I find the script? :)

BasioMeusPuga commented 7 years ago

v3 is now live. I'd been waiting for twitch to get their new API ready. Well, they have. They got severely drunk in the process, but they have.

The --conky flag is now --non-interactive.