open5e / open5e-api

The api for open5e.com
Other
157 stars 97 forks source link

Export/Conversion to Other Formats and Systems #397

Closed Sturlen closed 3 months ago

Sturlen commented 11 months ago

Being able to export Open5e data to other formats and into VTT's would be a great feature. The issue here is: how should it be implemented? Should this be a a part of the API or a separate application?

My current idea is to have an endpoint that will fetch the Open5e content and then convert it using a conversion function. e.g. /monsters/bear/foundry or /monsters/bear?format=json/foundry

As for target formats, I've seen interest for in following:

Let me know what you think.

augustjohnson commented 10 months ago

This is a GREAT idea, and definitely needs some design/attention. What are the use cases here?

I would anticipate that a large 1 time export is more likely than a smaller single-item on-demand export. This pushes me towards desigining a bulk export feature rather than a new resource. And if we're doing a bulk export, why not do that at build-time?

That being said, there are some simple use cases that would be one-time exports. The one I have in mind is a button on a monster that's basically "send to Homebrewery" that converts the current item into homebrewery-friendly markdown and pushes it over there. I already have that here though: https://github.com/open5e/open5e/issues/395

Sturlen commented 10 months ago

And if we're doing a bulk export, why not do that at build-time?

I've been experimenting with this. I create separate json files for each creature during build and host them from the web server as static files. Test is live on https://5e.spetland.no/monsters/a-mi-kuk . Clicking on JSON format at the bottom navigates to the correct json file. Supporting more export formats could be done by converting and storing that format as another option. image

This does require you to host over a thousand static assets just for the monsters, but so far I've not run into any issues with it. Might need a CDN in the future

augustjohnson commented 5 months ago

Here's my preferred approach for this:

I'm not sure I know enough about github and releases to automatically do this, but the commands to export should be pretty simple.

augustjohnson commented 3 months ago

I'm reducing the scope on this to only outputting CSV, but doing so for the v2 data. While this isn't exactly the vision of what we need, it offers a solid next step on this path.

augustjohnson commented 3 months ago

I'm going to consider this closed for now with the CSV export.