Brod8362/d4m

[dma] update on API

Closed this issue · 4 comments

DMA changes of API breaks mod updating and maybe other functionalities

i also changed the behaviour of /posts/posts, /posts/latest, and /posts/popular to return 404 + [] instead of 404 + a 404 http page when not found

❯ python -m d4m
d4m v0.3.2
Using the diva directory located at /mnt/games/SteamLibrary/steamapps/common/Hatsune Miku Project DIVA Mega Mix Plus
53 mods installed
Checking for mod updates...
Update check completed in 9.5s
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/__main__.py", line 8, in <module>
    d4m.tui.main()
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/tui.py", line 217, in main
    available_updates = sum(1 for _ in filter(lambda x: not x.is_simple() and x.is_out_of_date(), mod_manager.mods))
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/tui.py", line 217, in <genexpr>
    available_updates = sum(1 for _ in filter(lambda x: not x.is_simple() and x.is_out_of_date(), mod_manager.mods))
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/tui.py", line 217, in <lambda>
    available_updates = sum(1 for _ in filter(lambda x: not x.is_simple() and x.is_out_of_date(), mod_manager.mods))
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/divamod.py", line 112, in is_out_of_date
    return self.modinfo != None and self.hash != self.modinfo["hash"]
  File "/usr/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/divamod.py", line 125, in modinfo
    return api.fetch_mod_data(self.id, origin=self.origin)
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/api.py", line 38, in fetch_mod_data
    return SUPPORTED_APIS[origin].fetch_mod_data(mod_id)
  File "/home/demuriel/.local/lib/python3.10/site-packages/d4m/dma.py", line 51, in fetch_mod_data
    raise RuntimeError(f"DMA info returned {resp.status_code}")
RuntimeError: DMA info returned 404```

DivaModArchive made changes that appear to be breaking. Need to catch up on what's new and fix accordingly.

The issue was not from a DMA change - well, not directly.
A mod was removed from DMA meaning the ID was now returning 404. This was causing things to break, both for the GUI and TUI.
Poor foresight on my part.
It should be fixed now, to not entirely break when a mod update check fails (should also allow offline usage which definitely did not work before, but I'll need to verify that myself)

offline mode does not work, but everything else does, looks like you fixed the issue, i also tested mod updating