예제 #1
0
5	Jack		McCaig		M	Borgue, Dumfries & Galloway			2000	Farmer.		Personal communication Local Voices by James Brown / http://www.footstompin.com/forum/1/21451/1
6	Sheila		Stewart		F	Blairgowrie, Perthshire		1935		Traveller singer, storyteller and author. Member of the famous Stewarts of Blair family.	[YES]	SoSS via Tobar an Dualchais: http://www.tobarandualchais.co.uk/en/person/818
7	Jeannie		Robertson	Christina Regina Higgins	F	Aberdeen		1908	1975	Famed Traveller singer.	[YES]	http://projects.scottishcultureonline.com/hall-of-fame/jeannie-robertson-mbe/
8	Hamish		Robb	James Robb	M	Wellbank, Angus	Forfar, Angus	1937		Ex-farm worker and hauler. Born in Wellbank, worked in East Lothian and the Borders before settling in Forfar.	[YES]	Local Voices, with contributor's permission
"""

# Rab Morrison
singer = Singer()
singer.lv_id = "1"
singer.set_name("Rab", None, "Morrison", "Robert Morrison")
singer.gender = "male"
singer.add_location(relation="native_area", name="Northrigg, West Lothian")
singer.add_location(relation="significant", name="Blackridge, West Lothian")
singer.born = "1908"
singer.died = "1967"
singer.biography = "Miner"
# singer.photo_url = ""
singer.source = "SoSS via Tobar an Dualchais : http://www.tobarandualchais.co.uk/en/person/3473"
singer.save(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB, refresh=True)
singer_ids.append(singer.id)

# Mickey McDaid
singer = Singer()
singer.lv_id = "2"
singer.set_name("Mickey", None, "McDaid", "Michael McDaid")
singer.gender = "male"
singer.add_location(relation="native_area", name="Hillside, Inishowen, Ireland")
singer.biography = "Farmer"
# singer.photo_url = ""
singer.source = "Jimmy McBride, 'My Parents Reared Me Tenderly', pp. 37-38"
singer.save(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB, refresh=True)
예제 #2
0
    lat = _normalise(row[9])
    lon = _normalise(row[10])
    if place is not None or lat is not None or lon is not None:
        singer.add_location(relation="significant", lat=lat, lon=lon, name=place)
    
    birth = _normalise(row[11])
    if birth is not None:
        singer.born = birth
    
    death = _normalise(row[12])
    if death is not None:
        singer.died = death
    
    bio = _normalise(row[13])
    if bio is not None:
        singer.biography = bio
    
    # skipping column 14 (photo)
    
    source = _normalise(row[15])
    if source is not None:
        singer.source = source
    
    # now save the object via the web API (to test it)
    resp = requests.post(api + "/singers", data=json.dumps({"singer" : singer.data.get("singer")}))
    print "saved singer", resp.json().get("id")
    
    # record the id and map it to the lvid for later use
    id = resp.json().get("id")
    SINGER_LV_ID_MAP[row[0]] = id