def convert_artist(obj): """ :type obj: :class:`sir.schema.modelext.CustomArtist` """ artist = models.artist() if obj.comment is not None: artist.set_disambiguation(obj.comment) artist.set_id(obj.gid) artist.set_name(obj.name) artist.set_sort_name(obj.sort_name) if artist.gender is not None: artist.set_gender(artist.gender.name) if obj.type is not None: artist.set_type(obj.type.name) if obj.begin_area is not None: artist.set_begin_area(convert_area_inner(obj.begin_area)) if obj.area is not None: artist.set_area(convert_area_inner(obj.area)) if len(obj.area.iso_3166_1_codes) > 0: artist.set_country(obj.area.iso_3166_1_codes[0].code) if obj.end_area is not None: artist.set_end_area(convert_area_inner(obj.end_area)) lifespan = models.life_span() if obj.begin_date is not None: lifespan.set_begin(partialdate_to_string(obj.begin_date)) if obj.end_date is not None: lifespan.set_end(partialdate_to_string(obj.end_date)) if obj.ended: lifespan.set_ended("true") else: lifespan.set_ended("false") artist.set_life_span(lifespan) if len(obj.aliases) > 0: artist.set_alias_list(convert_alias_list(obj.aliases)) if len(obj.ipis) > 0: artist.set_ipi_list(convert_ipi_list(obj.ipis)) if len(obj.tags) > 0: artist.set_tag_list(convert_tag_list(obj.tags)) return artist
def convert_artist_simple(obj, include_aliases=True): """ :type obj: :class:`sir.schema.modelext.CustomArtist` """ artist = models.artist(id=obj.gid, name=obj.name) if obj.comment: artist.set_disambiguation(obj.comment) if obj.sort_name is not None: artist.set_sort_name(obj.sort_name) if include_aliases and len(obj.aliases) > 0: artist.set_alias_list(convert_alias_list(obj.aliases)) return artist
def convert_artist_simple(obj, include_aliases=True): """ :type obj: :class:`sir.schema.modelext.CustomArtist` """ artist = models.artist(id=obj.gid, name=obj.name) if obj.comment is not None and obj.comment != "": artist.set_disambiguation(obj.comment) if obj.sort_name is not None: artist.set_sort_name(obj.sort_name) if include_aliases and len(obj.aliases) > 0: artist.set_alias_list(convert_alias_list(obj.aliases)) return artist
def convert_artist(obj): """ :type obj: :class:`sir.schema.modelext.CustomArtist` """ artist = models.artist(id=obj.gid, name=obj.name, sort_name=obj.sort_name) if obj.comment: artist.set_disambiguation(obj.comment) if obj.gender is not None: artist.set_gender(convert_gender(obj.gender)) if obj.type is not None: artist.set_type(obj.type.name) artist.set_type_id(obj.type.gid) if obj.begin_area is not None: artist.set_begin_area(convert_area_inner(obj.begin_area)) if obj.area is not None: artist.set_area(convert_area_inner(obj.area)) if len(obj.area.iso_3166_1_codes) > 0: artist.set_country(obj.area.iso_3166_1_codes[0].code) if obj.end_area is not None: artist.set_end_area(convert_area_inner(obj.end_area)) lifespan = convert_life_span(obj.begin_date, obj.end_date, obj.ended) artist.set_life_span(lifespan) if len(obj.aliases) > 0: artist.set_alias_list(convert_alias_list(obj.aliases)) if len(obj.ipis) > 0: artist.set_ipi_list(convert_ipi_list(obj.ipis)) if len(obj.isnis) > 0: artist.set_isni_list(convert_isni_list(obj.isnis)) if len(obj.tags) > 0: artist.set_tag_list(convert_tag_list(obj.tags)) return artist
def convert_artist(obj): """ :type obj: :class:`sir.schema.modelext.CustomArtist` """ artist = models.artist(id=obj.gid, name=obj.name, sort_name=obj.sort_name) if obj.comment: artist.set_disambiguation(obj.comment) if obj.gender is not None: artist.set_gender(convert_gender(obj.gender)) if obj.type is not None: artist.set_type(obj.type.name) artist.set_type_id(obj.type.gid) if obj.begin_area is not None: artist.set_begin_area(convert_area_inner(obj.begin_area)) if obj.area is not None: artist.set_area(convert_area_inner(obj.area)) if len(obj.area.iso_3166_1_codes) > 0: artist.set_country(obj.area.iso_3166_1_codes[0].code) if obj.end_area is not None: artist.set_end_area(convert_area_inner(obj.end_area)) lifespan = convert_life_span(obj.begin_date, obj.end_date, obj.ended) artist.set_life_span(lifespan) if len(obj.aliases) > 0: artist.set_alias_list(convert_alias_list(obj.aliases)) if len(obj.ipis) > 0: artist.set_ipi_list(convert_ipi_list(obj.ipis)) if len(obj.tags) > 0: artist.set_tag_list(convert_tag_list(obj.tags)) return artist