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

Add --overwrite flag to rewrite every metadata json files #28

Merged
merged 3 commits into from
Mar 24, 2022

Conversation

Montspy
Copy link
Owner

@Montspy Montspy commented Mar 22, 2022

New --preserve flag for metadata.py.
It will only update CIDs in the metadata.json files that exist.
If the json is not valid, it will print out an error, save a backup of the file (add .bak suffix) and regenerate a new metadata json file

@Montspy
Copy link
Owner Author

Montspy commented Mar 22, 2022

This implements #19

@Montspy
Copy link
Owner Author

Montspy commented Mar 22, 2022

@sk33z3r Should we make the default behavior to preserve metadata and have an --overwrite flag instead?

@sk33z3r
Copy link
Collaborator

sk33z3r commented Mar 22, 2022

Should we make the default behavior to preserve metadata and have an --overwrite flag instead?

Seems to feel more "user friendly" if you automatically overwrite so nothing is ever stale. I can't come up with an argument where you would want to keep the CID list stale like that, but I'm sure there is a use case I'm not thinking of.

At the end of the day, I make a change to a file and try to mint, I don't expect to have to regen CID because it's sort of a hidden feature to the user right now. Might not be completely obvious that the CID calc was a step in the process.

@Montspy
Copy link
Owner Author

Montspy commented Mar 22, 2022

Agreed, in all cases, running metadata should always "refresh" at least the CIDs.
a) Current behavior is to overwrite the whole metadata file. Including any manual edits.
b) My old proposal (--preserve) was to keep this as default behavior. The --preserve flag would only update the CIDs nad keep any metadata edits.
c) My new proposal (--overwrite) is to change the default behavior to refresh only the CIDs and --overwrite would overwrite the whole metadata file.

I believe behavior c) to be less prone to data loss for users who manually edit their metadata after generation, while preventing stale CIDs for all users

@Montspy Montspy changed the title Add --preserve flag to preserve all existing fields when metadata json file exists Add --overwrite flag to rewrite every metadata json files Mar 23, 2022
@Montspy
Copy link
Owner Author

Montspy commented Mar 23, 2022

Changed the default behavior to only update CIDs
Added --overwrite flag to force rewriting new metadata json files

@Montspy Montspy marked this pull request as ready for review March 23, 2022 22:57
@sk33z3r
Copy link
Collaborator

sk33z3r commented Mar 24, 2022

I believe behavior c) to be less prone to data loss for users who manually edit their metadata after generation, while preventing stale CIDs for all users

Yea, I agree with that and a good move to make it default with this option.

@sk33z3r sk33z3r merged commit a3190d0 into main Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants