Senth / minecraft-mod-manager

Install and update mods from CurseForge and Modrinth through a CLI
MIT License
75 stars 7 forks source link

installation errors and not skipping #149

Closed theofficialgman closed 2 years ago

theofficialgman commented 2 years ago

Describe the bug

Some mods keep installing even though they are already present. They should be skipped but this does not happen. In this scenario (and a few others), I get error output.

Steps to reproduce

megascript_mods is a variable of these mods:

sodium lithium starlight hydrogen lambdacontrols fabric-api modmenu lazydfu ferrite-core better-beds chunk-pregenerator-fabric
mmm -v 1.18 --alpha --beta install $megascript_mods
sodium has already been installed, skipping...
lithium has already been installed, skipping...
starlight has already been installed, skipping...
lambdacontrols has already been installed, skipping...
modmenu has already been installed, skipping...
lazydfu has already been installed, skipping...
hydrogen
    🔺 Mod not found on any site...
fabric-api
    🟢 Installed version 0.44.0+1.18
ferrite-core
    🟢 Installed version 4.0.0
better-beds
    🟢 Installed version 1.2.0
chunk-pregenerator-fabric
    🟨 All versions were filtered out
        The latest version was filtered out by minecraft version
Run without --minecraft-version, or
            run with --minecraft-version VERSION to download it
            ['1.17.1', '1.17', 'Fabric']
🔺 Mods not found
hydrogen
    Check so that it's slug is correct. You can set the slug by running:
    minecraft-mod-manager configure hydrogen=curse:mod-slug,modrinth:mod-slug

installation goes fine, the mods are there, and the ones that were already present were skipped.

-rw-rw-r-- 1 gman gman   44260 Feb  6 15:33 betterbeds-1.2.0.jar
-rw-rw-r-- 1 gman gman 1143259 Feb  6 15:33 fabric-api-0.44.0+1.18.jar
-rw-rw-r-- 1 gman gman  109825 Feb  6 15:33 ferritecore-4.0.0-fabric.jar
-rw-rw-r-- 1 gman gman 1626819 Dec  1 22:16 iris-mc1.18-1.1.3.jar.disabled
-rw-rw-r-- 1 gman gman  660811 Feb  6 15:29 lambdacontrols-1.7.1+1.17.jar
-rw-rw-r-- 1 gman gman   15517 Feb  6 15:29 lazydfu-0.1.2.jar
-rw-rw-r-- 1 gman gman  385473 Feb  6 15:29 lithium-fabric-mc1.18-0.7.6-rc1.jar
-rw-rw-r-- 1 gman gman  270707 Feb  6 15:29 modmenu-3.0.1.jar
-rw-rw-r-- 1 gman gman   90017 Jan 23 19:44 phosphor-fabric-mc1.18.x-0.8.1.jar.disabled
-rw-rw-r-- 1 gman gman 1312006 Dec  5 18:37 sodium-fabric-mc1.18-0.4.0-alpha5+build.808.jar.disabled
-rw-rw-r-- 1 gman gman 1311910 Feb  6 15:29 sodium-fabric-mc1.18-0.4.0-alpha5+build.9.jar
-rw-rw-r-- 1 gman gman  127301 Feb  6 15:29 starlight-1.0.1+fabric.0583973.jar

now immediately run the same install again, all mods should be skipped BUT they are not and the script errors.

gman@gman-usb:/media/gman/Universal/home/gman/MultiMC/install/instances/1.18/.minecraft/mods$ mmm -v 1.18 --alpha --beta install $megascript_mods
sodium has already been installed, skipping...
lithium has already been installed, skipping...
starlight has already been installed, skipping...
lambdacontrols has already been installed, skipping...
modmenu has already been installed, skipping...
lazydfu has already been installed, skipping...
hydrogen
    🔺 Mod not found on any site...
fabric-api
    🟢 Installed version 0.44.0+1.18
ferrite-core
    🟢 Installed version 4.0.0
better-beds
    🟢 Installed version 1.2.0
chunk-pregenerator-fabric
Traceback (most recent call last):
  File "/home/gman/.local/bin/mmm", line 8, in <module>
    sys.exit(main())
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/__main__.py", line 29, in main
    install.execute(config.arg_mods)
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/app/install/install.py", line 22, in execute
    self.find_download_and_install(mods)
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/app/download/download.py", line 25, in find_download_and_install
    versions = self._repo.get_versions(mod)
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/adapters/repo_impl.py", line 87, in get_versions
    versions.extend(api.get_all_versions(mod))
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/gateways/api/curse_api.py", line 18, in get_all_versions
    files = self.downloader.get(CurseApi._make_files_url(mod))
  File "/home/gman/.local/lib/python3.8/site-packages/minecraft_mod_manager/gateways/downloader.py", line 21, in get
    return response.json(strict=False)
  File "/home/gman/.local/lib/python3.8/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 535, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
  File "/usr/lib/python3/dist-packages/simplejson/scanner.py", line 79, in scan_once
    return _scan_once(string, idx)
  File "/usr/lib/python3/dist-packages/simplejson/scanner.py", line 70, in _scan_once
    raise JSONDecodeError(errmsg, string, idx)

Expected Behavior

already installed mods are skipped and there are no errors

Info

Senth commented 2 years ago

The fix will be released in v1.3 🙂

I only checked against the mod_id and not the slug name 🙂

theofficialgman commented 2 years ago

edit: nevermind, working as intended