예제 #1
0
 def delete_singer(cls, singer_id):
     singer = Singer().get(singer_id, links=True)
     
     if singer is None:
         raise NotFoundException()
     
     # remove the singer from storage first
     singer.remove()
     
     # then remove the singer and re-index any related objects
     SingerIndex.delete_by_id(singer.id)
예제 #2
0
 def create_singer(cls, singer_json, versions):
     if singer_json is None:
         return None
     
     # create the singer object and save it to the store
     singer = Singer({"singer" : singer_json})
     if versions is not None:
         singer.versions = versions
     singer.save()
     
     # call the indexing process, and index this object and all
     # related ones
     SingerIndex.by_id(singer.id, cascade=True)
     
     return singer
예제 #3
0
 def update_singer(cls, singer_id, singer_json=None, versions=None):
     # retrieve and update the singer object in the desired way
     singer = Singer().get(singer_id, links=True)
     
     if singer is None:
         raise NotFoundException()
     
     if singer_json is not None:
         singer.patch_singer(singer_json, replace_all=True, keep_id=True)
     if versions is not None:
         singer.versions = versions
     singer.save()
     
     # call the indexing process, and index this object and all related ones
     SingerIndex.by_id(singer.id, cascade=True)
     
     return singer
예제 #4
0
# construct singer records and save them
#########################################

"""
1	Rab		Morrison	Robert? Morrison	M	Northrigg, West Lothian	Blackridge, West Lothian	1908	1967	Miner.		SoSS via Tobar an Dualchais : http://www.tobarandualchais.co.uk/en/person/3473
2	Mickey		McDaid	Michael? McDaid	M	Hillside, Inishowen, Ireland				Farmer.		Jimmy McBride, 'My Parents Reared Me Tenderly', pp. 37-38
3			Stravaig (Group)		F	Dumfries & Galloway				Folk song group whose members included Phyllis Martin, Susan Kelly, Jean McMonies, Moira Greenwood		http://www.scottishmusiccentre.com/directory/r737/
4	Peter		Fairbairn		M		Kilmarnock			Began singing in 1975, with a particular interest in songs from the south-west of Scotland.		Sheila Douglas, 'Come Gie's a Sang', p. 147.
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()
예제 #5
0
SINGER_LV_ID_MAP = {}
SONG_LV_ID_MAP = {}
SONG_SONG_MAP = []

def _normalise(cell):
    return cell if cell is not None and cell != "" else None

reader = csv.reader(open(singers))
first = True
for row in reader:
    if first:
        first = False
        continue
    
    singer = Singer()
    singer.lv_id = row[0]
    
    fn = _normalise(row[1])
    ln = _normalise(row[2])
    aka = _normalise(row[3])
    singer.set_name(first=fn, last=ln, aka=aka)
    
    if row[4] is not None and row[4] != "":
        singer.gender = row[4].lower()
    
    place = _normalise(row[5])
    lat = _normalise(row[6])
    lon = _normalise(row[7])
    if place is not None or lat is not None or lon is not None:
        singer.add_location(relation="native_area", lat=lat, lon=lon, name=place)