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

Added mintingTool metadata #33

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/hicdex/hooks/on_restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ async def on_restart(
ctx: HookContext,
) -> None:
await ctx.execute_sql('on_restart')
await fix_holder_metadata(ctx)
await fix_other_metadata(ctx)
5 changes: 5 additions & 0 deletions src/hicdex/metadata_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async def fix_token_metadata(ctx: DipDupContext, token: models.Token) -> bool:
token.mime = get_mime(metadata)
token.extra = metadata.get('extra', {})
token.rights = get_rights(metadata)
token.minting_tool = get_minting_tool(metadata)
token.right_uri = get_right_uri(metadata)
token.formats = metadata.get('formats', {})
token.language = get_language(metadata)
Expand Down Expand Up @@ -219,3 +220,7 @@ def get_thumbnail_uri(metadata: Dict[str, Any]) -> str:

def get_right_uri(metadata: Dict[str, Any]) -> str:
return clean_null_bytes(metadata.get('right_uri', '') or metadata.get('rightUri', ''))


def get_minting_tool(metadata: Dict[str, Any]) -> str:
return clean_null_bytes(metadata.get('minting_tool', '') or metadata.get('mintingTool', ''))
1 change: 1 addition & 0 deletions src/hicdex/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Token(Model):

accessibility = fields.JSONField(default={})
content_rating = fields.TextField(default='')
minting_tool = fields.TextField(default='')


class TokenOperator(Model):
Expand Down
1 change: 1 addition & 0 deletions src/hicdex/sql/on_restart/add-mintingtool.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE token ADD COLUMN IF NOT EXISTS minting_tool TEXT;