TwitchDropsMiner
TwitchDropsMiner copied to clipboard
[Feature Request] Headless mode
Would be great if there was a --headless
flag to allow it to not spawn the UI at all.
Separately, with a --headless
option, being able to set the location of the cookie.jar
and the settings.json
files would be excellent.
Would make the application much easier to dockerize. ;)
Hello o/
Yes, this is something I do plan on adding to the application at some point. My available time reserves have shrunk quite a bit recently, so I'm putting aside this project for now, but this issue should remain open, to be closed once such mode will be added at some point in the future.
I'd love a headless mode to be implemented, I'm using another bot now, but it's not being maintained and with recent changes on twitch, welp... This one seems like a great alternative, but I only have a headless ubuntu server, so, yeah. I see that the linux support is also not finished, but I would gladly help, even though Im not familiar with python too much.
Right now, it'd be cool to have the application back in working state first. But yes, if you'd be interested in Linux support, please refer to discussion in #35. IIRC, I asked for any traceback that'd arise from running the app on Linux, excluding the current on-going issue from #40 of course.
As a quick update on the state of the headless mode support.
Right now, the application remains to be strictly tied with it's GUI and procedures responsible for updating it. The backup Chrome login available in the latest master is something that won't work on a headless machine, as it opens a browser window for the user to interact with. Other than that, the headless mode has been put on the backburner of things to consider possibly adding in the future, once the core application stops being broken by Twitch introducing their changes.
The backup Chrome login available in the latest master is something that won't work on a headless machine, as it opens a browser window for the user to interact with.
You just need the ID that is printed to the UI console and activate it via the host you're operating the headless machine from. Or use your phone to link the ID. So that option is even better than the normal login or via auth_token for headless/docker.
Just don't open a chrome tab webbrowser.open_new_tab("https://www.twitch.tv/activate")
when in headless mode and everything is fine.
@Pr0mises That's still not the main problem, the main problem still remains:
the application remains to be strictly tied with it's GUI and procedures responsible for updating it.
Because of this, it's impossible to go anywhere with headless mode, before redoing the whole GUI layer of the application, and that's something that exists on the very end of my TODO list - there are more important things to take care of first, like the tree-event-based rewrite of the memory structure, #107 or #110. I'm still debating if headless mode is worth supporting here at all, since this project was never meant to run 24/7 on any servers (the primary reason headless mode is wanted here at all), but be a personal miner that you could setup to run together with your usual day-to-day PC tasks (browsing web, gaming, at work), that'd take care of the drops while you do other things.
That's correct, that's why I only stated that the login is possible with headless. So all good, thanks for your work :)
For anyone interested I got it working by using Xvfb and copying configs and cookies from a TDM install on windows.
tmux new-session -d -s Xvfb tmux send-keys -t Xvfb 'Xvfb :99 -screen 0 1x2x8' Enter tmux new-session -d -s tdm tmux send-keys -t tdm 'cd ./TwitchDropsMiner;source ./env/bin/activate;export DISPLAY=:99;./env/bin/python main.py' Enter
Just in case someone is getting this error:
Traceback (most recent call last):
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/pystray/_appindicator.py", line 24, in <module>
gi.require_version('AppIndicator3', '0.1')
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AppIndicator3 not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/twitch_drops/TwitchDropsMiner/main.py", line 29, in <module>
from twitch import Twitch
File "/home/pi/twitch_drops/TwitchDropsMiner/twitch.py", line 39, in <module>
from gui import GUIManager
File "/home/pi/twitch_drops/TwitchDropsMiner/gui.py", line 21, in <module>
import pystray
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/pystray/__init__.py", line 64, in <module>
Icon = backend().Icon
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/pystray/__init__.py", line 56, in backend
return candidate()
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/pystray/__init__.py", line 28, in appindicator
from . import _appindicator as backend; return backend
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/pystray/_appindicator.py", line 27, in <module>
gi.require_version('AyatanaAppIndicator3', '0.1')
File "/home/pi/twitch_drops/TwitchDropsMiner/venv/lib/python3.9/site-packages/gi/__init__.py", line 126, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AyatanaAppIndicator3 not available
You may need to use gtk in PYSTRAY_BACKEND:
PYSTRAY_BACKEND=gtk python main.py
And install this
sudo apt install gir1.2-appindicator3-0.1
Not really sure about these (I installed too many trying to make it work on my raspberry):
sudo apt install python3-gi gobject-introspection gir1.2-gtk-3.0