DevilXD / TwitchDropsMiner

An app that allows you to AFK mine timed Twitch drops, with automatic drop claiming and channel switching.
MIT License
1.64k stars 158 forks source link

Issues with auto start and campaigns showing up #574

Open zac6969 opened 1 week ago

zac6969 commented 1 week ago

Hi i just want to start with that this sort of stuff isnt something i am very confident on so i may misunderstand terms or get confused at certain points because i know very little to nothing about code:)

i downloaded the master and think i have set it up correctly using what i already knew. I load the application from main.py.. when i go to select the auto start feature this happens:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ZAC\AppData\Local\Programs\Python\Python313\Lib\tkinter__init.py", line 2068, in call__ return self.func(*args)


  File "C:\Users\ZAC\Desktop\TwitchDropsMiner-master\TwitchDropsMiner-master\gui.py", line 1790, in update_autostart
    key.set(
    ~~~~~~~^
        self.AUTOSTART_NAME,
        ^^^^^^^^^^^^^^^^^^^^
        ValueType.REG_SZ,
        ^^^^^^^^^^^^^^^^^
        self._get_autostart_path(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\ZAC\Desktop\TwitchDropsMiner-master\TwitchDropsMiner-master\registry.py", line 85, in set
    reg.SetValueEx(self._handle, name, 0, value_type.value, value)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied

when i unselect the feature the same happens. the autostart in tray doesnt do this however.

my second issue is the inventory tab doesnt show the game im after. Warframe is the only game i want drops for but they do not appear in the inventory list, does it only show drops happening within the next 24hrs or something? (accounts are linked and all that)

if anymore info is needed just let me know:)

thankyou:)))
zac6969 commented 1 week ago

note: when toggling the autostart in tray i do get an error but the button stays toggled. Also the drops im looking to claim are actually happening today so i really dont understand why they are not showing up.

when toggling autostart in try:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\ZAC\AppData\Local\Programs\Python\Python313\Lib\tkinter__init.py", line 2068, in call__ return self.func(*args)


  File "C:\Users\ZAC\Desktop\TwitchDropsMiner-master\TwitchDropsMiner-master\gui.py", line 1790, in update_autostart
    key.set(
    ~~~~~~~^
        self.AUTOSTART_NAME,
        ^^^^^^^^^^^^^^^^^^^^
        ValueType.REG_SZ,
        ^^^^^^^^^^^^^^^^^
        self._get_autostart_path(),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "C:\Users\ZAC\Desktop\TwitchDropsMiner-master\TwitchDropsMiner-master\registry.py", line 85, in set
    reg.SetValueEx(self._handle, name, 0, value_type.value, value)
    ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [WinError 5] Access is denied
DevilXD commented 1 week ago

Hello,

Thank you for the traceback. According to it, your computer has refused the miner to set a registry key, that'd be responsible for the autostart feature: PermissionError: [WinError 5] Access is denied. Usually it's some kind of an antivirus program that denies registry modifications, but it can be anything really, even your user account setup could interfere with it. If you'd like to use the autostart feature, you'll have to either not allow your antivirus program to interfere with the miner, or possibly, try running it as Administrator. Anything that'll let it setup the autostart entry will do. The autostart feature, without being able to set this value, will simply not work at all. Everything else should function as expected.

The tray option only updates the autostart entry, if the autostart option is enabled. If it's disabled, the entry doesn't exist, so toggling it won't do anything (there's nothing to update).

the inventory tab doesnt show the game im after. Warframe is the only game i want drops for but they do not appear in the inventory list

A campaign for the chosen game has to exist, in order to become visible in the miner and selectable from the game selection drop-downs. The inventory view lets you see almost the exact copy of the Twitch campaigns page: https://www.twitch.tv/drops/campaigns You may need to play around with the inventory filtering options for it to show up - the filters have been designed so that checking all of them will show every possible campaign the miner knows about. Usually the "Excluded" option hides the majority of the campaigns.

Please note that Excluded games are not considered to be a valid mining target, and thus cannot/won't be mined. A game and it's campaign is considered to be Excluded when:

As far as Warframe specifically goes, I can see it on the campaigns page, but indeed not in the miner. A quick look at the miner code reveals that the "Closed Drop Campaigns" section of the campaigns page is not processed by the miner - only currently active and upcoming campaigns are processed and added: https://github.com/DevilXD/TwitchDropsMiner/blob/66c361103fc2d8c0a93ef875976c7fb4244968d5/twitch.py#L1454

If you'd still like to add Warframe to either Priority or Exclude lists, the drop-downs also function as simple text inputs. You can just type in Warframe (or copy-paste it from here), and press the + sign to add it like usual. I can also make a small modification that'll processed the expired campaigns anyway, and then the game will become selectable via the drop-down, even if it's only appearance is in the closed campaigns section, like it currently is.

Luckz commented 1 week ago

I can also make a small modification that'll processed the expired campaigns anyway, and then the game will become selectable via the drop-down, even if it's only appearance is in the closed campaigns section, like it currently is.

The dropdowns are a pretty good tool to troubleshoot campaigns that cause issues. Polluting them with campaigns that aren't even active anymore conceptually makes this harder.


P.S:: As this user doesn't seem to use a compiled exe, how would autostart even work? Without a kiloton of middleware, how'd you know to add an autostart entry that loads the right virtual environment with the right python toolchain in the desired terminal and ...?

@zac6969 IMO, the sanest way is to write your particular toolchain commands to have a bat file that navigates into the TDM folder, loads the python virtual environment, [git-pulls], and runs python main.py – and have Task Scheduler launch that on Windows user login, or something like that. Since I doubt you modify the code, I'd add a "git pull" before the launch (either before or after the python env is loaded) so that you're always starting the newest commit. (Best practices would improve on this in various ways, like updating the env based on requirements.txt.)

DevilXD commented 1 week ago

The dropdowns are a pretty good tool to troubleshoot campaigns that cause issues. Polluting them with campaigns that aren't even active anymore conceptually makes this harder.

I don't really see how would that be helpful to troubleshoot anything. All the change would do, is expand the selection list with the games from the "Closed Drop Campaigns" section of the Twitch campaigns page. If a particular game would have both, an active and an expired campaign, then this change would make no difference - the game would show up on the dropdown list anyway.

As this user doesn't seem to use a compiled exe, how would autostart even work?

The autostart feature uses SELF_PATH as the target path. When not packaged, it points to the main.py file directly. The resulting path (with autostart to tray toggled) becomes:

"C:\(...)\TwitchDropsMiner\main.py" --tray

I've actually never considered using the autostart feature with source-only runtime. Or at least haven't realized that it'd need to be ran through the virtual environment. No one reported having issues with that to me either. All paths are known to the miner though, including the venv path, so adding support for redirecting the python executable to the venv should be quite easy to do.

It's worth noting here that all the "activation" of a venv does, is redirect a relative python commands to the venv-included executable. So when you call python main.py, it uses the venv executable instead of the main installation one. Knowing this for script usage, it's perfectly fine to just point to the venv executable directly, and it'll work just like you'd activate the venv beforehand: ./env/Scripts/python.exe main.py. pythonw.exe can also be used to start with the console hidden, better mimicking the built executable.