basiomeuspuga / twitchy Goto Github PK
View Code? Open in Web Editor NEWCLI streamlink wrapper for twitch.tv
License: GNU General Public License v3.0
CLI streamlink wrapper for twitch.tv
License: GNU General Public License v3.0
$ twitchy
Checking 39 channel(s)...
ChannelName Uptime StreamStatus
1 rendogtv 40m MINECRAFT | BRAND NEW SURVIVAL SERVER!!! || RENDOG
2 Soaryn 35m Boop | Free Sub: !prime | Twitter: @Soaryn117
Channel number(s)? 2
q / Ctrl + C to quit
Now watching:
Soaryn | Source
Soaryn: 8s (4) | Minecraft: 24s (2)
$
I'm not sure how to debug this? It works if I open the stream directly with Streamlink though.
Hi. I was following an example from twitchy/blob/master/README.md
Watch specified channel(s) - Do not have to be in local database:
$ twitchy -w northernlion cobaltstreak
Checking channels...
The Binding of Isaac: Afterbirth
1 northernlion 5757 Egg
Channel number(s): 1
1d [lasers:~/src/twitchy] master ± ./twitchy.py -w northernlion cobaltstreak
Checking 2 channel(s)...
The Binding of Isaac: Afterbirth
1 CobaltStreak 1,309 200-0 Eden streaks. LETS GO
Channel number(s)? 1
q / Ctrl + C to quit
Now watching:
CobaltStreak | High
Traceback (most recent call last):
File "./twitchy.py", line 1353, in <module>
main()
File "./twitchy.py", line 1341, in main
watch(args.w, 'w')
File "./twitchy.py", line 990, in watch
playtime_instances(final_selection)
File "./twitchy.py", line 1142, in playtime_instances
playtime_instance[count].play()
File "./twitchy.py", line 1063, in play
uses_aq = database.execute("SELECT AltQuality FROM channels WHERE Name = '{0}'".format(self.final_selection)).fetchone()[0]
TypeError: 'NoneType' object is not subscriptable
I've been getting this error since a day or two ago when running twitchy, in any mode beyond configuration. Installed from the twitchy-git AUR package, which I also tried updating but that didn't help.
$ rm -rf ~/.config/twitchy3
$ twitchy --configure
Configure:
Media player [mpv]:
Default stream quality [low/medium/HIGH/source]:
Truncate stream status at [AUTO]:
Interval (seconds) in between channel status checks [60]:
Current Settings:
Media player: mpv
Default Quality: high
Truncate status at: 0
Check interval: 60
Does this look correct to you? [Y/n]:
Config written to /home/XXXXXX/.config/twitchy3/twitchy.cfg. Read for additional settings.
$ twitchy -a gogcom
Additions to database:
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 377, in main
channel_addition('add', args.a)
File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 45, in channel_addition
valid_channels = twitchy_api.name_id_translate(
File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 87, in name_id_translate
for i in stream_data['data']:
TypeError: 'NoneType' object is not subscriptable
$ twitchy -s XXXXXX
Additions to database:
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 404, in main
channel_addition('sync', args.s)
File "/usr/lib/python3.8/site-packages/twitchy/__main__.py", line 48, in channel_addition
valid_channels = twitchy_api.sync_from_id(channels)
File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 118, in sync_from_id
username_id = name_id_translate(
File "/usr/lib/python3.8/site-packages/twitchy/twitchy_api.py", line 87, in name_id_translate
for i in stream_data['data']:
TypeError: 'NoneType' object is not subscriptable
$ sudo pacman -Qi twitchy-git
Name : twitchy-git
Version : r210.92e5176-1
Description : CLI streamlink wrapper for twitch.tv
Architecture : any
URL : https://github.com/BasioMeusPuga/twitchy
Licenses : GPL3
Groups : None
Provides : twitchy
Depends On : python streamlink python-requests python-setuptools
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : twitchy
Replaces : None
Installed Size : 155.72 KiB
Packager : Unknown Packager
Build Date : Mon 11 May 2020 11:03:55 AM MST
Install Date : Mon 11 May 2020 11:04:00 AM MST
Install Reason : Explicitly installed
Install Script : No
Validated By : None
I am unable to launch streams using twitchy-rofi. The streams show up in rofi but when i try to open any of them nothing happens. Everything works fine using the terminal script though.
Just updated via the AUR to the most recent release; twitchy crashes when trying to check channel statuses (e.g. by just executing twitchy
) , with this error:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 260, in get_game
'EQUALS')[0]
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.1.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 393, in main
watch_channel(None)
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 189, in watch_channel
id_string_list).check_channels()
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 354, in check_channels
game_data = self.get_game(game_id)
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 270, in get_game
game_name = game_details[0][1].replace("'", "")
IndexError: list index out of range
(Aside: I don't know if this is intentional, but AUR package version numbers and git release commit numbers aren't consistent, threw me off for a bit; e.g. AUR package r31.38f8c54-1
retrieves release r185.214c8c0-1
from the git repo.)
the output of --non-interactive consists of 4 coma separated parts e.g.
Overwatch,Overwatch,mL7_ow,ml7_ow
for me the first and last two parts are always the same, i guess its intentional and maybe the streamer hasn't set up a custom title or whatever.
question is basically what each part of the string is representing?
Is it possible to disable chat when starting to watch?
Or use irc client instead?
I'm using twitchy on an old config, and I would like to reduce resource consumption by disabling webchat.
There seems to be an issue if a stream has unicode characters in the title. Is this an issue with the script or my terminal setup?
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.3.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 400, in main
watch_channel(None)
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 199, in watch_channel
channels_online).begin()
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_display.py", line 255, in begin
self.table_display(final_columns)
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_display.py", line 205, in table_display
Colors.ENDC)
UnicodeEncodeError: 'ascii' codec can't encode character '\u3010' in position 58: ordinal not in range(128)
It would be cool if a streamer is hosting someone else, that you could see and choose the hosted stream
twitchy didn't seem to respect the player config option and just used mpv no matter what I specified.
In twitchy_config.py
, changing:
if player == 'mpv' and hw_accel != 'false':
player_final = 'mpv --hwdec={0} --cache 8192'.format(hw_accel)
else:
player_final = 'mpv --cache 8192'
to
if player == 'mpv' and hw_accel != 'false':
player_final = 'mpv --hwdec={0} --cache 8192'.format(hw_accel)
else:
player_final = player
fixed my issue. I also had to remove the --title
parameter in twitchy_play.py
since it's not a valid mplayer parameter.
I suspect the underlying cause here is a Twitch API change because I'm quite certain it used to work fine on the same git rev, but basically twitchy -w
no longer accepts upper-case characters, even when the channel name is supposed to have them.
Case in point:
$ twitchy -w Chess
No valid channels.
$ twitchy -w chess
Checking 1 channel(s)...
Chess
1 Chess 1,004 2018 PRO Chess League, Week 2
Number? ^C
The channel in question is supposed to be Chess
, not chess
, and that's what twitchy's own output is returning.
Found another one :)
executing twitchy
followed by e.g. 3
never starts the stream (ends after ~30s).
The executed query (args_to_subprocess) for me contains exactly this string:
livestreamer twitch.tv/'rush' 'source' --player 'mpv --hwdec=vaapi --vo=vaapi --cache 8192 --title Rush' --hls-segment-threads 3
something is going wrong here!
Edit: the problem is caused by the hw-acc. Disabling that part in mpv solves the problem, although I am not sure why hw-acc is causing an Issue
Edit2: I'm using a 2015 13" rMBP 10.11.6 with the following MPV:
mpv 0.20.0 (C) 2000-2016 mpv/MPlayer/mplayer2 projects
built on Fri Aug 26 23:02:21 BST 2016
ffmpeg library versions:
libavutil 55.28.100
libavcodec 57.48.101
libavformat 57.41.100
libswscale 4.1.100
libavfilter 6.47.100
libswresample 2.1.100
ffmpeg version: 3.1.3
just in case thats relevant for the hw-acc problem
I'm getting a notification on my phone via Twitch app that a stream is online, and I can view the stream in my browser, but Twitchy doesn't detect the stream as online until several minutes later.
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?
Titles with the å
, ä
and ö
like "Semesterlir med Rönnlund" becomes "Semesterlir med Rönnlund".
I'm using Arch Linux, URxvt 9.22 and twitchy-git r133.478dddf from AUR.
Hello,
After executing :
python setup.py build
python setup.py install
on launch "twitchy" i have :
File "/usr/local/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
File "/home/orgams/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/home/orgams/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
return ep.load()
File "/home/orgams/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/home/orgams/.local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/local/lib/python2.7/dist-packages/twitchy-3.4.0-py2.7.egg/twitchy/__main__.py", line 100
f' Delete {Colors.YELLOW + i + Colors.ENDC} (y/N) ')
I'm novice with Python, you have a idea ?
Hi,
big fan, tyvm! After upgrading my Arch setup, my twitchy does not seem to work anymore. Normally I would assume it is a python problem, deinstall, delete the folder and recompile it again. But this time it does not work unfortunately. This is the error I'm getting, if I try watching vods with
twitchy -v channelname
(most recent call last):
File "/usr/bin/twitchy", line 11, in
load_entry_point('twitchy==3.2.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.6/site-packages/twitchy-3.2.0-py3.6.egg/twitchy/main.py", line 394, in main
watch_vods(args.v)
File "/usr/lib/python3.6/site-packages/twitchy-3.2.0-py3.6.egg/twitchy/main.py", line 228, in watch_vods
twitchy_play.play_instance_generator(final_selection)
File "/usr/lib/python3.6/site-packages/twitchy-3.2.0-py3.6.egg/twitchy/twitchy_play.py", line 199, in play_instance_generator
Colors.RED + playtime_instance[i].channel_params['display_name'] +
AttributeError: 'VOD' object has no attribute 'channel_params'
Maybe it has something to with the Twitch API change? I tried both the AUR Version (which seems to be outdated) and the git clone. I'm on Python 3.6.4
Hi. I saw something in the code. It is possible to split fields incorrectly with ,
when using non-interactive
because some (alt) fields can have their own ,
too.
I am getting 100% CPU usage on a single core when launching a stream from the rofi-twitchy plugin. When launching a stream from cli via twitchy or 'mpv ', I'm only seeing around 10% usage. I've also tried enabling hardware acceleration but get the same results.
This occurs with either mpv or vlc when set in the config.
I am able to reproduce this on two machines both with arch/intel cpu's.
OS: Arch
Kernal: 5.3.10
Nvidia Drivers: 440.31
CPU: Intel i7-4790k
Above error is being thrown even when running twitchy --configure
. Everything worked perfectly on the earlier version (not sure which one)
Edit: from Rev 25
https://aur.archlinux.org/packages/twitchy-git/
Please and thanks. 🙂
I have two computers with Arch Linux, both using URxvt with Zsh and they should have pretty much the same setups, because I'm boring. But only on of them shows colors correctly. The faulty ones shows only white, grey and red.
I currently have version r123.cd04489-1
installed via AUR on the machine which is not working.
I'm not sure how to debug this? Colors is working just fine outside of Twitchy.
Hi. If you run this command twice with empty database, you get this. Thought you should know.
⚡ twitchy --non-interactive
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.4.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.7/site-packages/twitchy/__main__.py", line 386, in main
non_interactive('get_online')
File "/usr/lib/python3.7/site-packages/twitchy/__main__.py", line 242, in non_interactive
id_string_list = [str(i[0]) for i in channel_data]
TypeError: 'NoneType' object is not iterable
It would be nice if there was an option to launch the stream in its own instance so that the stream could continue to run in mpv when I exit out of twitchy. Currently I am using twitchy to see who is online, and then using streamlink to manually launch the stream with 'disown' to keep the terminal free.
Also just want to say thanks for twitchy. I've tried many different cli twitch apps and this is my favorite.
First of all, it's great to see a TUI alternative to the now long dead project livestreamer-curses! It's so nice to be able to list only channels that live and not just hosting someone. :)
I have a few ideas though, I hope you don't mind. I also made a mockup to go with my ideas and I hope you like it and that this is something you would consider.
1. Colours
It would be nice to have optional colours and to be able to define them yourself. Colours is a nice way to make a lot of text more readable.
2. Custom columns
I don't care what game someone plays, but the someone else might. It would be able to choose what to display and not.
3. Uptime
I know it's possible to fetch the uptime, it would be nice to be able to see it. Since it would be a factor to consider when choosing to watch a stream.
4. Comptact list
It would be nice to have a option for a more comact list.
5. Config file
This is more like a demand than a request. :D I'd like to see an actual file I could edit myself. The wizard is a nice feature, if it's optional to use it or not when you try to run twitchy without an actual config.
6. Option to disable chat
I use IRC for the chatting and I'm probably not the only one. It would be nice it the chat could be optional.
Oh, btw. I copied the titles from twitchy and I don't know why it cut them off so short? Any ideas?
Cheers!
I would like to use twitchy with rofi also for vod streams. An ideal api would be:
Is it possible to do something like that?
Hi. I did it wrong anyway... attempting an username instead of channel. Thought you should know.
lasers~ twitchy -w some_random_username
Checking 1 channel(s)...
Traceback (most recent call last):
File "/usr/bin/twitchy", line 1294, in <module>
main()
File "/usr/bin/twitchy", line 1285, in main
watch(args.w, 'w')
File "/usr/bin/twitchy", line 800, in watch
get_status(status_check_required)
File "/usr/bin/twitchy", line 772, in get_status
alt_name = [v[1] for i, v in enumerate(status_check_required) if v[0] == channel_name][0]
IndexError: list index out of range
The Twitch API doesn't like it when you pass a value larger than 100 to the limit
parameter of the /kraken/users/{user}/follows/channels
API call. Currently the code just puts in the follower total:
Line 474 in dacae12
This gets thrown as an exception and twitchy just reports "User {} doesn't exist".
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.2.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
return ep.load()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2408, in load
return self.resolve()
File "/usr/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2414, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 16, in <module>
from twitchy import twitchy_database
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_database.py", line 7, in <module>
from twitchy import twitchy_api
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 13, in <module>
Options.parse_options()
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_config.py", line 193, in parse_options
video_section = config['VIDEO']
File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__
raise KeyError(key)
KeyError: 'VIDEO' ```
im sorry if this is already known but if not i want to tell you that if the streamer doesnt define a game he streams twitchy fails to load with the following warning:
[jason@whitepearl ~]$ twitchy
Checking 45 channel(s)...
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 268, in get_game
'EQUALS')[0]
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/twitchy", line 11, in <module>
load_entry_point('twitchy==3.2.0', 'console_scripts', 'twitchy')()
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 400, in main
watch_channel(None)
File "/usr/lib/python3.6/site-packages/twitchy/__main__.py", line 194, in watch_channel
id_string_list).check_channels()
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 365, in check_channels
game_data = self.get_game(game_id)
File "/usr/lib/python3.6/site-packages/twitchy/twitchy_api.py", line 278, in get_game
game_name = game_details[0][1].replace("'", "")
IndexError: list index out of range
its not happenig every day that a streamer doesnt set the game he plays but i would say once a week
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.