Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exporting local scores for CLI #17

Merged
merged 10 commits into from
Apr 19, 2024
Merged

Conversation

YuumiPie
Copy link
Contributor

No gui implementation but added to core and CLI.
Requires Newtonsoft library to get username from scores and beatmap score backlink.
Has Lazer's naming but no handling (trimming too long file/blacklisted filename characters).

downloading:
image

result:
image

@kabiiQ
Copy link
Owner

kabiiQ commented Apr 19, 2024

I made some changes that are just preferences or decision consistency with other functions, but I do want to note a few things that were unneeded:

  • Filtering of beatmap files by hash is something only needed for beatmap set export. I don't believe this code was actually doing anything here
  • Similarly, I don't understand the need for the JSON library/APIUser file, unless I missed some special case this can just be removed
  • The "Files" collection as contained within a Score turns out to be just a list with the first and only file being the entire .osr file. This means that exporting a replay is much simpler and is just exporting that single file rather than building an archive.

@kabiiQ kabiiQ merged commit 8fc2b78 into kabiiQ:main Apr 19, 2024
@YuumiPie
Copy link
Contributor Author

Thanks for fixing my errors!

I mistakenly assumed that the "backlink" attribute for the beatmap class required Newtonsoft, and wanted to add the parameter to be ignored just in case there was a parameter in the database that had the same name. So part of it was more of a safety than necessity.

I also thought that the score files were similar to beatmap, unzipped, so I wrote the code to zip the files, but it seemed that if you attempt to zip an already zipped file (.osr) it doesn't do anything so I didn't catch that.

My thinking in having the hash filter is that it would get all the filtered beatmaps (ie. in my case all the 10*+ beatmaps) from the selected beatmapsets (similar to the beatmap exporter) from then export all the replays associated with those beatmaps(with the backlink property). However, after testing the changes to my pull request, it seems that the score filtering is removed in addition to the hash filter. For example, in the new branch when I set the beatmap filter to "stars 10" (I assume should export only replays from 10*+ beatmaps) it instead exports all the replays in the beatmapset instead of the expected (nonexistent) 10*+ replays.

Screenshots of results (with "star 10" filtering):
With newest branch:
image
(Note: same result with GUI)
With my branch:
image
(I'm not mrekk)

@kabiiQ
Copy link
Owner

kabiiQ commented Apr 19, 2024

Good call, I was indeed accidentally getting replays from all beatmaps in the set. b47c3ec

I believe in the original you were iterating over SelectedBeatmaps already (which I somehow accidentally changed to just Beatmaps at some point, oops) and then also doing the hash filter, which is why I said it was doing nothing as it was already filtered.

There's something strange going on with the scores, it seems like the number I have to export has changed multiple times after I go to export after clicking around in game or playing a replay lol. Not sure the exact trigger. I don't think this is on our end at all though, the actual scores collection is indeed changing. Just weird.

Going to put up a new version with this fix as well as manual score viewing/exporting from the GUI's beatmap list.

@YuumiPie
Copy link
Contributor Author

YuumiPie commented Apr 19, 2024

Good call, I was indeed accidentally getting replays from all beatmaps in the set. b47c3ec

I believe in the original you were iterating over SelectedBeatmaps already (which I somehow accidentally changed to just Beatmaps at some point, oops) and then also doing the hash filter, which is why I said it was doing nothing as it was already filtered.

There's something strange going on with the scores, it seems like the number I have to export has changed multiple times after I go to export after clicking around in game or playing a replay lol. Not sure the exact trigger. I don't think this is on our end at all though, the actual scores collection is indeed changing. Just weird.

Going to put up a new version with this fix as well as manual score viewing/exporting from the GUI's beatmap list.

Looking back at it... yep you are correct XD

I think my original intention was to use mapset.Beatmaps and then filter them with the hash filter but accidently used mapset.SelectedBeatmaps... but it turns out that I could have just used mapset.SelectedBeatmaps without the hash filter anyways lmao.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants