nathan-sain / foundry-world-tools

A Python CLI for managing Foundry VTT assets on the file system
MIT License
10 stars 5 forks source link

foundry-world-tools seems not to support Foundry VTT v11 #15

Open Bernie-McGee opened 1 year ago

Bernie-McGee commented 1 year ago

I recently tried to use FWT's dedup function with no success.

sudo fwt dedup --ext=".png" --ext=".webp" --byname --preferred=".*webp" /home/foundry/foundrydata/Data/worlds/vamp-hunters
Traceback (most recent call last):
  File "/srv/fabric/.local/bin/fwt", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/foundryWorldTools/fwtCli.py", line 116, in dedup
    dir = lib.FWTPath(dir)
          ^^^^^^^^^^^^^^^^
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/foundryWorldTools/lib.py", line 542, in __init__
    resolve_fvtt_path(self,path)
  File "/srv/fabric/.local/pipx/venvs/foundryworldtools/lib/python3.11/site-packages/foundryWorldTools/lib.py", line 125, in resolve_fvtt_path
    fwtpath.project_name = json.loads(manafest.read_text())["name"]
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'name'

I don't know Python, so I could be completely wrong, but I believe line 125 in lib.py is trying to pull the "name" field from world.json? It looks like at some point Foundry updated to change this field to "id" instead. Here is my world.json:

  "title": "Vamp Hunters?",
  "description": "<p><strong>An unlikely band of adventurers are drawn into the mysterious land of Barovia.  Is it their fate to defeat the land's dark master, the vampire Strahd von Zarovich?  Or is it their fate to become Strahd's thralls and be trapped in Barovia for eternity?</strong></p><p></p><p>On the way to>
  "version": "1.0.0",
  "system": "dnd5e",
  "coreVersion": "11.307",
  "systemVersion": "2.3.0",
  "scripts": [
    "templates/roll20-templates.js"
  ],
  "styles": [
    "templates/roll20-templates.css"
  ],
  "resetKeys": false,
  "safeMode": false,
  "id": "vamp-hunters",
  "compatibility": {
    "minimum": "11",
    "verified": "11.307"
  },
  "lastPlayed": "Sat Aug 19 2023 20:37:42 GMT-0400 (Eastern Daylight Time)",
  "playtime": 4464,
  "background": "CurseofStrahd_Throne_2560x1600_Wallpaper.jpeg",
  "joinTheme": "default",
  "nextSession": "2023-09-01T01:00:00.000Z"
}
nathan-sain commented 1 year ago

@Bernie-McGee, thanks for the bug report. I'm sorry I've not been more proactively updating my utility to keep up with the changes to Foundry in versions 10 and 11. I've updated the README to explicitly say that this utility is only intended to be compatible with Foundry versions 7-9. I have done some research on the changes required to support newer versions of Foundry, and while it looks to be possible, I'm not sure when I'll finish working on it.

Bernie-McGee commented 1 year ago

@nathan-sain No problem. Thanks for your work! I've been working on converting PNGs in a world created with R20Converter, which creates a world for Foundry 9, so I've just used foundry-world-tools before I update the world to Foundry 11.