MaxOhn / rosu-pp

PP and star calculation for all osu! gamemodes
MIT License
79 stars 40 forks source link

It's gonna be soooo good if you can read data from a link instead of hard drive #16

Closed CaoTrongThang closed 1 year ago

CaoTrongThang commented 1 year ago

So my suggestion is to use the link to download .osu file like this https://osu.ppy.sh/osu/3640199, and read data from it on RAM instead of the Hard drive, that's gonna save us alot of pc resources, please do that.

MaxOhn commented 1 year ago

Providing adequate flexibility when it comes to making requests is a rabbit hole that I don't think I'm willing to go down in this crate so I don't like adding download support.

and read data from it on RAM instead of the Hard drive

You don't need the .osu file itself, you just need its content. You can download the bytes yourself and then just pass a &[u8] to Beatmap::parse instead of storing them as a file.

CaoTrongThang commented 1 year ago

So weird to say but I'm using your rosu-pp as like a local website, so my java discord bot can get fetch data from it, but i think you can do it bro, i mean the data is just a bunch of bytes.

cyperdark commented 1 year ago

@CaoTrongThang i think you can do it bro, i mean the data is just a bunch of bytes.

CaoTrongThang commented 1 year ago

@CaoTrongThang i think you can do it bro, i mean the data is just a bunch of bytes.

That wasn't what I meant, he capable to do it more than I, both could give the same result but read data from a buffer is better than saving it to a file and then read it again, i mean it's an extra step

MaxOhn commented 1 year ago

Glad you found a way to use the lib even though downloading files yourself is a little more cumbersome.

In case you're using the rosu-pp-js or rosu-pp-py bindings, I believe they currently do not support passing data as bytes and instead indeed require a file path which is unfortunate; I will be adding a way to pass them as bytes to make this at least a little bit more convenient (https://github.com/MaxOhn/rosu-pp-js/issues/2) :+1:

Downloading files in of itself is not hard but covering all or at least a decent amount of the ways to do so not only requires a lot of work but also shifts the focus of this crate away from what I intend it to be, a pure difficulty and performance calculation tool. This doesn't even account the fact that providing a way to easily download files on the fly would encourage a more careless interaction with the osu!api - that is, unless I put even more work into the whole system to handle file caching.

So as it currently stands, download support won't be added.