valknight / Splatnet2-Rich-Presence

Discord rich presence for Splatoon 2
MIT License
16 stars 6 forks source link

splatnet2statink has updated breaking the script #3

Closed Zhomb closed 6 years ago

Zhomb commented 6 years ago

splatnet2statink has updated (probably due to 4.0 update) and now the script throws an exception at line 23 [matches = load_results()] the only way to get around this is to install an older version of splatnet2statink

frozenpandaman commented 6 years ago

@Zhomb Sorry about that. I changed up that function definition (wasn't even ver.4-related)… should have made the parameter optional. I've updated splatnet2statink to fix this now.

valknight commented 6 years ago

Tested working - now it's sorted, remove all files related to splatnet2statink (currently dbs.py, iksm.py, splatnet2statink.py, and the splatnet2statink folder), then rerun the install script, to get everything set back up again using the new fixed version. I'm leaving this issue open while I sort out a better way to solve this.

frozenpandaman commented 6 years ago

Actually, it shouldn't be working yet… you should be getting an error…

Due to the fact I changed around some stuff a few days ago, the load_results() method you use now expects a parameter named filename. So that should be throwing a NameError, since it's not getting set (since you're not running splatnet2statink's main method):

NameError: name 'filename' is not defined

But I can just wrap this part in a try/except block, which should fix it for you. So I'll do that now.

frozenpandaman commented 6 years ago

@Valerokai Ideally, I think the plan should be to log in + grab battle results using your own methods – in this script itself – instead of relying on/appropriating splatnet2statink to do it. The process is all documented here and here and should be pretty readily doable. This will also prevent you from having to constantly watch for & react to potentially breaking changes made s2s.

You can then set your own user agent too for the s2s API request… which is something I definitely want happening as I mentioned in our convo before, if that makes sense :P (Thanks!)

In the end, you shouldn't be using splatnet2statink as a requirement – you should be using the s2s API just for login. It's that – the API – which solves the "f" issue, not the splatnet2statink repo/script itself like the readme here says. 😉

valknight commented 6 years ago

Yeah, of course, I'm going to spend some time later today moving everything across into my own implementation later to remove the requirement for S2S - however though, I did just update myself and it seems to be working without modifications, and without the filename param?

frozenpandaman commented 6 years ago

No worries! Just wanted to make sure we're on the same page. :D And let me know if there's anything I can do to help.

It should be working now, yeah – I put the if statement which references the (non-existent, when you call s2s's load_results() before the main method) filename variable in a try/except block. So when your script calls it, it'll just pass over it since naturally it doesn't exist. The method now taking a param was another issue but I fixed that as well.

Zhomb commented 6 years ago

Thank you both for explaining the problem! I'm trying to get into the Splatoon API too and this should help. Besides that thanks for the fix to the script, I really appreciate it.

frozenpandaman commented 6 years ago

No problem! Unless you need specific user data like battle records, the splatoon2.ink API will be useful too.

P.S. Nice Pyukumuku avatar.