Beispiel #1
0
    def metadata(self):
        """Return extracted metadata."""
        output = dict(self.defaults)
        output.update(self.extra_metadata)

        # Add creators if not specified
        if 'creators' not in output:
            output['creators'] = get_contributors(self.gh.api,
                                                  self.repository['id'])
        if not output['creators']:
            output['creators'] = get_owner(self.gh.api, self.author)
        if not output['creators']:
            output['creators'] = [dict(name='Unknown', affiliation='')]

        return legacyjson_v1_translator({'metadata': output})
Beispiel #2
0
    def metadata(self):
        """Return extracted metadata."""
        output = dict(self.defaults)
        if self.use_extra_metadata:
            extra_metadata = self.extra_metadata
            # If `.zenodo.json` is there use it
            if extra_metadata:
                output.update(extra_metadata)
            # If not check for `CITATION.cff` and use
            else:
                citation_metadata = self.citation_metadata
                if citation_metadata:
                    output.update(citation_metadata)
        # Add creators if not specified
        if 'creators' not in output:
            output['creators'] = get_contributors(self.gh.api,
                                                  self.repository['id'])
        if not output['creators']:
            output['creators'] = get_owner(self.gh.api, self.author)
        if not output['creators']:
            output['creators'] = [dict(name='Unknown', affiliation='')]

        return legacyjson_v1_translator({'metadata': output})