pysmash
pysmash copied to clipboard
Not returning all sets
Some querys for sets don't return all sets. For example the query for the bracket with id 273020 using bracket_show_set only returns 1 set with id 6460971. It instead should be returning 3 as seen here.
It does the same with the bracket with id 269808.
I have no idea what could be causing this and it was fine about two weeks ago and now it just doesn't work anymore. My suspicion is that the smash.gg adding the search feature messed with some parts of the api.
How would I get pysmash to print its stuff so that I can trace it?
I found it:
if bracket_set['winnerId'] is None or bracket_set['loserId'] is None: return None, False
This is my issue. Can you add an arg that disables that part of the code? I only need the sets that haven't been played yet.
Is that tournament currently in progress?
I mean it's a test tournament but in theory the matches are in process. It's just that I need the matches that are going to be played, so that I can get the names of the players and notify them. That's what my Discord bot is trying to do.
The reason that I ask is that SmashGG creates set object for sets that will never complete. For example, if two brackets lead into a finals bracket, and only the top 4 people from each pools bracket moves on. See: https://smash.gg/tournament/hidden-bosses-4-0/events/wii-u-singles/brackets/70445/224997.
A set object is created for Dom and Purin even though those two players never played (because they feed into the finals bracket). Currently I do not think there is a way to distinguish between sets like those (useless/dead sets) and sets that are "in progress".
I will try to look into this however.
Also, I have noticed problems with my own application since SmashGGs recent update. What specifically was working/returning properly and now is not?
So far it's only been those set return methods. Would appreciate it if they got an arg or _all extension or something so that I could still do my thing.
you used the plural form of "method", which functions specifically would you like that filter on? Also by "working" 2 weeks ago you WERE in fact, getting correct results from these functions previously?
If you look at this commit made 24 days ago, https://github.com/PeterCat12/pysmash/commit/7ef17c03a0cf05c5ece20851ce07eb560539fbd2 this looks like it would affect what it is you're trying to do. However, if it were working 2 weeks ago (assuming you were using an updated master branch at the time) the error would more likely be due to some change on SmashGG's end and not pysmash (since they updated their code ~2 weeks ago). This weekend I will fully investigate this issue as it is holding up my project.
tournaments_show_sets and bracket_show_sets
It seems unlikely that I did because if I did that mean that smash.gg must have had something that prevented it from filtering those particular sets. What I think is more likely is that I used some weird way of copying over the files to the bot so that it would work temporarily. This however seems also unlikely since my forked version clearly has that one line...
So I really don't know why it worked, I just know that it did.
sorry to bombard you with messages lol. I get a little frantic sometimes. I appreciate your feedback :)
It's fine I'm just slow with responding because I'm testing atm as well.
no worries. Apologies for the problems. I wish that SmashGG's API wasn't the shit show that it is.
I mean it is still in development but at least a real doc would be nice...
I would settle for migration logs lol.
Any progress?
Can you confirm if your still not seeing the sets? It seems that smashGG has fixed whatever changes they made from their last update. Curious to see if this has had any affect.
Atm I dont get ANY sets
Edit: nevermind I'm stupid I actually just get the same output as before
Okay. that makes some sense.I actually did not have time to look into this over the weekend. But I will for sure find time this weekend. Sorry for the delay.
Any progress on this? I'm actually running into similar problems atm, as my interests are for both tournaments that have ended (for logging reasons) as well as tournaments that are currently underway (for streaming reasons).
I'ma look more into it tonight when I get a chance!
After taking a look at some samples from the API, I think the unreachable parameter can be used to filter out the sets that Smash.GG uses as placeholders for phases that aren't the final bracket phase. In the pools I looked at it was only set to true for WFs, GFs, LFs, and Loser's Semis for a phase where 4 move on, and WFs, GFs, and LFs in a phase where 3 moved on.
@gatesnp It's been awhile since I've looked at this issue. If you're confident that you have a solution would you be willing to open a pull request and cover with a unit test?
@PeterCat12 Can do. Only thing I hesitate about is this will make it so sets that haven't been played are returned (when they haven't been in the past). That could break things for some people if they're assuming only completed sets will be returned as it is right now.
@gatesnp Ah I am actually one of those people :(
Perhaps we could make a second endpoint that doesn't care whether or not sets have been played or not? Does that make sense to do?
@PeterCat12 Different end points could work. The issue is different, both are related to tournaments that have yet to complete though. I'd have to look into more, but #46 I believe is just due to some dynamic stuff Smash.gg does while going from stage to stage and has to do with players. This issue is about being able to retrieve sets that have yet to be played as far as I can tell.
Now that I think of it, it might make sense to have three endpoints. One for completed sets (the current one), one for sets that have yet to be played, but are ready to be played (The one I need for my uses), and one for sets that have yet to be played, but are not ready to be played, as in the bracket hasn't reached that point yet (I don't know what use someone would have for this, but I'm sure that someone could have one in the future, and this way there is a way to actually retrieve those sets).
Does that make sense? Or am I off base?
@gatesnp I think that makes sense. I just want to make sure you've read my above comment regarding "ghost sets". Again, it's been awhile since I've looked into this but I remember that Smashgg makes sets that are never meant to be played (which was the reason the current functionality is the way it is). This occurs when say, pools feed into a top 64 bracket (and when top 64 feeds into top 32, etc).
The reason that I ask is that SmashGG creates set object for sets that will never complete. For example, if >two brackets lead into a finals bracket, and only the top 4 people from each pools bracket moves on. See: >https://smash.gg/tournament/hidden-bosses-4-0/events/wii-u-singles/brackets/70445/224997.
A set object is created for Dom and Purin even though those two players never played (because they feed >into the finals bracket). Currently I do not think there is a way to distinguish between sets like those >(useless/dead sets) and sets that are "in progress".
Smashgg does tend to silently update their API so my understanding could be outdated.
No, Smash.gg still does that, but they include a boolean field named "unreachable" that will tell you if it's one of those ghost sets. This could be a recent addition, I'm not sure. That's what I've been using to filter them out.
@PeterCat12 Also, something to note. I think it was a recent addition, but Smash.gg now has a "Sandbox mode" for tournaments. I was able to make a test tournament that I could set up and put in any state I need, so I should be able to use that for unit tests if I add the endpoints.
@gatesnp Ah! sorry I missed when you said that before. That is DEFINITELY a "recent" addition. Okay, just so I understand this correctly. Current functionality ONLY returns sets that have been played and treats "unreachable" (let's use the smashgg term) the same as sets that haven't been played.
I think your 3 way split makes sense. Regarding that, I can't remember the name of the current endpoint but perhaps it would be best to change the name of the function to reflect which sets are being returned.
I also am not opposed to keeping it to one endpoint and just passing in some sort of flag to specify which sets to grab (with a default to grab completed sets?).
Good to know about that sandbox mode! Definitely wasn't there I originally made these bindings.