rdavydov / Twitch-Channel-Points-Miner-v2

A simple script that will watch a stream for you and earn the channel points.
GNU General Public License v3.0
1.13k stars 334 forks source link

Add streamers to mining without having to restart the script #277

Open rorosin opened 1 year ago

rorosin commented 1 year ago

Is your feature request related to a problem?

It's inconvenient for me to restart the script every time I want to add a new streamer to the mining script so I think that this feature would be useful.

Proposed solution

Maybe it would be possible to add a live streamer buffer that can be updated from the console, as well as scanned by a mining script.

Alternatives you've considered

No response

Additional context

No response

whyphyrl commented 1 year ago

would be a great idea already have a script that gives me twitch channels who have drops enabled in combination this could be usefull (sry my englisch suckss xd)

rdavydov commented 1 year ago

That would require rewriting the whole app I think. This app was designed to be run from a runner Python file, it is not possible to reconfigure it "on the fly".

samdebanenman commented 1 year ago

maybe the script can check if the list of streamers is the same and restart automatically. I'm running this script on a headless rpi and it would be nice if I could follow a new streamer without having to putty in to the pi every time

NoxRare commented 1 year ago

maybe the script can check if the list of streamers is the same and restart automatically. I'm running this script on a headless rpi and it would be nice if I could follow a new streamer without having to putty in to the pi every time

If you're using a RPi4 you can install docker and run Portainer, this is the way I manage my bots and other services. There may be a way to have a background task that checks regularly for modifications in the run.py file, but honestly restarting isnt that difficult..

qs-arno commented 3 months ago

There may be a way to have a background task that checks regularly for modifications in the run.py file

I think I can help with this one; these instructions will be for people already familiar with doing system tasks, but if the maintainers think it's worth including in the project docs then I can take the time to make a more newbie-friendly version. Also, it would help a lot with reliability if the script would write a PID file so we don't have to rely on grepping the command line out of the process list (especially if the script is named something generic like run.py).

Add to crontab -e:

## Restart the Twitch Channel Points Miner script if its configuration has updated
##
## The "5" is the number of minutes between checks; you can change it if you like,
## but if you do then make sure you also change "update_check_interval" in the
## script itself.
*/5 * * * * ${HOME}/.local/bin/tcpm-restart-on-config-update

Then create a script ${HOME}/.local/bin/tcpm-restart-on-config-update:

#!/bin/sh

## Set this to the full path to your "run.py" script
script_path="${HOME}/.local/opt/twitch-channel-points-miner-v2/run.py"

## This number needs to match the interval in the cron job definition
update_check_interval=5

###############################################################################
###############################################################################

root_directory=$(dirname "${script_path}")
script_file_name=$(basename "${script_path}")

if find "${root_directory}" -name "${script_file_name}" -mmin -${update_check_interval} >/dev/null; then
    pkill --signal SIGINT --full --exact --oldest "python3 ${script_file_name}"
    cd "${root_directory}"
    python3 "${script_file_name}"
fi

## EOF
########