Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look into Github Actions that can automatically create the .db files after a merge #81

Open
AnthonyVadala opened this issue Jun 29, 2020 · 8 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@AnthonyVadala
Copy link
Member

Originally posted by @shawndibble in #16 (comment)

@AnthonyVadala
Copy link
Member Author

may want to look into github actions that can automatically create the .db files after a merge.

It is something on my radar and would make management of the packs WAY easier, but as of right now directly entering data into a .db file causes a bunch of data corruption errors in the debug log of Foundry.

So once a better method of editing .db files becomes available I'll be all over it!

Originally posted by @AnthonyVadala in #16 (comment)

@AnthonyVadala AnthonyVadala self-assigned this Jun 29, 2020
@AnthonyVadala AnthonyVadala added enhancement New feature or request help wanted Extra attention is needed labels Jun 29, 2020
@AnthonyVadala
Copy link
Member Author

I created a strawpoll for the community to vote on a temporary sorting solution for this module while folder organization within Compendium Packs is being added to Foundry VTT : https://www.strawpoll.me/20468759

@shawndibble
Copy link
Contributor

What is your current method of manually creating the .db files? Knowing each step you take to create the .db files may help with the automation.

@AnthonyVadala
Copy link
Member Author

AnthonyVadala commented Jul 7, 2020

Right now I load up the community macros modules on a test Foundry instance and pretty just copy and paste any changes into the specific module in the compendium. If it is a new macro I create it from the macro bar and drag it to the compendium pack.

When I last tried to automate the process, after my bash script failed, I tried to manually create a macro entry in a blank .db file then when I placed it in my test instance I would get database corruption errors from the console. Even copying and pasting an entry from a working .db file to my test file would cause the .db corruption errors when I attempted to load it.

I am probably just doing something wrong creating the .db files from outside of Foundry.

@shawndibble
Copy link
Contributor

shawndibble commented Jul 7, 2020

From my understanding, the .db files is using the following library https://github.com/louischatriot/nedb

So you may need to utilize nedb to create the .db files from the js files in this git library

@Forien
Copy link
Contributor

Forien commented Jul 7, 2020

You could keep all macros in one big JSON file, or even have separate JSON files for every macro.
then, when Foundry initializes, you could fetch the JSON file and import macro into compendium using API.

Could also utilize hidden settings to fire this import once per version.

I absolutely advise against any attempts to modify db files. Only sorrow comes from that ;)

@shawndibble
Copy link
Contributor

That maybe the best option. Have a github action that creates a few json files for you. Then utilize the api to import macros from json with the importFromJSON. After that is done, you can utilize toCompendium.

If you have a dedicated foundry installation, you could use the http api module so that github actions can make those remote api calls and imports to foundry for you.

@damccull
Copy link

The db file is not a json file. It is a newline separated file that uses json chunks on each line.

@AnthonyVadala when you save the file out, please ensure you're using the correct encoding. Opening the ones I use in vscode shows the encoding to be UTF-8. If you're not saving into the correct encoding that FoundryVTT expects, it may cause corruption like you're experiencing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants