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

[SUGGESTION] getNewestFile method #6

Open
Arweix opened this issue Apr 24, 2022 · 4 comments
Open

[SUGGESTION] getNewestFile method #6

Arweix opened this issue Apr 24, 2022 · 4 comments

Comments

@Arweix
Copy link

Arweix commented Apr 24, 2022

I can suggest adding a method that searches for the latest version of the mod for a specific version of the game and returns file id.
getNewestFile(addon_id, game_version)
Usage example:
getNewestFile(518157, "1.12.2") # Output: 3763886

@OwenCochell
Copy link
Owner

As stated earlier, I think this could be a great feature. I think adding in some sorting system to match other attributes for a collection of files could be useful.

I will be looking into this. At the very least, this method will be implemented. At the very most, new functionality will be added that will allow for objects to be sorted based arbitrary attributes. This may take some more time as finals are coming ever closer at my university, but I will look into this whenever I have some free time, or at the latest in a few weeks.

Thanks again for pointing this out!

@RandomGgames
Copy link

Just found this library and have been messing with it. I would love this idea! Would be very useful.

@Arweix
Copy link
Author

Arweix commented May 1, 2022

Just found this library and have been messing with it. I would love this idea! Would be very useful.

I am glad that I am somehow helping in development :)

@RandomGgames
Copy link

RandomGgames commented May 1, 2022

In my bug report #7, I have some code that I believe basically asks what you're looking for.

most_up_to_date_file = None
for file in client.addon_files(addon_id = ADDON_ID:
    if "1.18.2" in file.version:
        if most_up_to_date_file == None:
            most_up_to_date_file = file
        if file.id > most_up_to_date_file.id:
            most_up_to_date_file = file
print(f'{most_up_to_date_file}')

# Running this for the Fabric API mod for Minecraft gives me the output:
CurseFile(id=3759491, addon_id=306612, display_name='[1.18.2] Fabric API 0.51.1+1.18.2', file_name='fabric-api-0.51.1+1.18.2.jar', date='2022-04-19T17:08:52.507Z', download_url='https://edge.forgecdn.net/files/3759/491/fabric-api-0.51.1+1.18.2.jar', length=1346435, version=('Fabric', '1.18.2'), dependencies=())

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

No branches or pull requests

3 participants