コード例 #1
0
							
Dumfries Hiring Fair		Bothy song in which man is hired to work at a farm near Dumfries, and is critical of the treatment he receives.	Dumfries	Late 19th / Early 20th Century		LV2	LV1; LV3
							
The Boreland of Balmaghie	Parker of the Boreland	Bothy song in which man is hired to work at a farm near Castle Douglas, and is critical of the treatment he receives.	Castle Douglas	Late 19th / Early 20th Century		LV3	LV1; LV2
Andrew Lammie	Mill o Tifty's Annie	Song of tragic love between Andrew Lammie, the Laird o Fyvie's trumpeter and Mill o Tifty's Annie. Annie's parents disapprove, and have Andrew dismissed and sent away, then kill their daughter for shaming them.		Late 17th century		LV4	
							
The Bonnie Hoose o Airlie		Ballad of feuding lords. Airlie Castle is burned to the ground by Archibald Campbell, while his rival, James Ogilvie, is away.	Airlie, Angus	Mid 16th century		LV5	
The Laird o Drum		Ballad of marriage between social classes.	Drum Castle, Drumoak, Aberdeenshire	Mid 16th century		LV6	
The Cauld Water Well		Sentimental pastoral song celebrating a local wishing well.	Dundee	Late 19th century		LV7	
"""

# Falkirk Hiring Fair
song1 = Song()
song1.title = "Falkirk Hiring Fair"
song1.summary = "Bothy song in which man is hired to work at a farm near Falkirk, and is critical of the treatment he receives."
song1.add_location(relation="main", name="Falkirk")
song1.set_time_period("Late 19th Century", "Early 20th Century")
song1.lv_id = "LV1"
song1.id = song1.makeid()
song_ids.append(song1.id)
# we need the ids of the related songs, which we add get later

# Dumfries Hiring Fair
song2 = Song()
song2.title = "Dumfries Hiring Fair"
song2.summary = "Bothy song in which man is hired to work at a farm near Dumfries, and is critical of the treatment he receives."
song2.add_location(relation="main", name="Dumfries")
song2.set_time_period("Late 19th Century", "Early 20th Century")
song2.lv_id = "LV2"
song2.id = song2.makeid()
song_ids.append(song2.id)
コード例 #2
0
 slv_id = _normalise(row[5])
 if slv_id is not None and slv_id not in SONG_LV_ID_MAP.keys():
     song = Song()
     stitle = _normalise(row[0])
     if stitle is not None:
         song.title = stitle
     
     # skip row[1] - alternative title is calculated from versions later
     
     ssummary = _normalise(row[2])
     if ssummary is not None:
         song.summary = ssummary
     
     slocation = _normalise(row[3])
     if slocation is not None:
         song.add_location(relation="main", name=slocation)
     
     scomposer = _normalise(row[4])
     if scomposer is not None:
         song.composer = scomposer
     
     # row[5]
     song.lv_id = slv_id
     
     # record the song-to-song relationships required
     rel = _normalise(row[6])
     if rel is not None:
         SONG_SONG_MAP.append((slv_id, rel))
     
     # save the object via the web API (to test it)
     resp = requests.post(api + "/songs", data=json.dumps({"song" : song.data.get("song")}))