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 attribution info to metadata, if available #2

Merged

Conversation

johanhelsing
Copy link
Contributor

No description provided.

@johanhelsing
Copy link
Contributor Author

I needed this for my use case. Take or leave it :)

@johanhelsing
Copy link
Contributor Author

Example:

~/dev/oga oga describe --verbose 12-medieval-signs
{
    "attribution": "J. W. Bjerk (eleazzaar) -- www.jwbjerk.com/art",
    "author": "eleazzaar",
    "favorites": 33,
    "files": [
        {
            "etag": "7fd3cc-4c181f2113ac0",
            "id": "12-medieval-signs_0.zip",
            "size": 8377292
        }
    ],
    "id": "12-medieval-signs",
    "licenses": [
        "CC-BY 3.0",
        "CC-BY-SA 3.0",
        "GPL 3.0",
        "GPL 2.0"
    ],
    "tags": [
        "sign",
        "RPG",
        "Fantasy",
        "medieval",
        "Fish",
        "blacksmith",
        "magic",
        "weapon",
        "Inn",
        "shop",
        "unicorn"
    ],
    "type": "Texture"
}

Comment on lines 94 to +99
"files": files}

if attribution != None:
ret["attribution"] = attribution

return ret
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a slight preference for the parser including every field, even if it's None. It's a signal that the parser looked but didn't find it, whereas a new field would be omitted entirely by an older parser.

Suggested change
"files": files}
if attribution != None:
ret["attribution"] = attribution
return ret
"files": files,
"attribution": attribution}
return ret

Comment on lines +74 to +75
if self.attribution != None:
ret["attribution"] = self.attribution
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment as above, I'd prefer "attribution" be included even when None. stripping empty values at the CLI could be an option but the model shouldn't omit them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind either way is fine by me.

@numberoverzero
Copy link
Owner

Looks great, thanks for the pull request! I'm happy to add this functionality.

If you'd prefer I can merge this as-is and make those changes, just let me know.

@johanhelsing
Copy link
Contributor Author

Just merge and make the edits you want to :)

@numberoverzero numberoverzero merged commit 5aafbd1 into numberoverzero:master May 6, 2020
@numberoverzero
Copy link
Owner

Thanks again for the contribution!

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.

2 participants