i made a CLI auto mod updater
it is not revolutionary, i built it to learn more about the language. it is built with python, scans your mods folder, downloads using multiple threads, and since for now it only uses modrinth API, some mods might be unavaible or their id are a mess, so it manually scrapes the web to get those missing mods, and hands you the link. it downloads to a folder called mods\_\[your\_chosen\_version\]. i will make a github repo (meaning it is open source) and hand you guys the link, i just wanna hear community feedback first: do you like it? would you use it?
Commentaires
* Downvote this comment if this post is poor quality or does not fit the purpose of r/Minecraft
* Downvote this comment *and report the post* if it breaks the [rules](https://www.reddit.com/r/Minecraft/wiki/rules)
----
(*Vote has already ended*)
I made my own mod updater, but stopped developing it as I liked using the updater in the Prism Launcher instead.
the code reads fabric.mod.json from each .jar file in your mods folder:
```
with jar.open("fabric.mod.json") as f:
data = json.load(f)
mods_info.append({
"file": file,
"id": data.get("id", "unknown"), # <-- grabs the mod ID
"name": data.get("name", "unknown"),
"manual_download": False
})
```
then it tries to find the Modrinth project using that id:
```
def query_modrinth(mod_id, mod_name=None):
# first attempt: try using the mod_id directly as a slug
r = requests.get(f"{MODRINTH_API}/project/{mod_id}")
if r.status_code == 200:
return r.json() # <-- got the project (includes the real slug)
```
many mod developers use the same id in their fabric.mod.json as their Modrinth slug. so "id": "sodium" often maps directly to modrinth.com/mod/sodium.
but thinking about it right now, this 'hope for the best' is happening because my normalize function is actually crap. it does
```
def normalize(text):
return re.sub(r'[^a-z0-9]', '', text.lowe())
```
which nukes all non-alphanumeric character, which can be bad if the id uses hyphens. I should use
```
def normalize(text):
return text.lower().strip().replace(' ', '-')
```
that will give more accuracy. that's how it works.