Ejemplo n.º 1
0
# Falkirk Fair (LV1.1)

version = Version()
version.lv_id = "LV1.1"
version.title = "Falkirk Fair"
version.language = "Scots"
version.singer = singer_ids[0] # Rab Morrison
version.collector = "Hamish Henderson"
version.collected_date = "1962-05"
version.source = "School of Scottish Studies Sound Archive, SA1962.016.A9"
version.add_location(name="Falkirk")
version.add_reference("ROUD", "10368")
version.comments = "Fragments only"
version.tags = ["bothy", "farm", "bawdy"]
version.media_url = "http://www.tobarandualchais.co.uk/fullrecord/23006/1"
# version.lyrics = ""
# version.photo_url = ""
version.song = song_ids[0]
version.save(host=settings.ELASTIC_SEARCH_HOST, index=settings.ELASTIC_SEARCH_DB, refresh=True)
version_ids.append(version.id)

# Falkirk Fair (LV1.2)

version = Version()
version.lv_id = "LV1.2"
version.title = "Falkirk Fair"
version.language = "Scots"
version.singer = singer_ids[1] # Mickey McDaid
version.collector = "Jimmy McBride"
version.collected_date = "1985-02"
Ejemplo n.º 2
0
    
    child = _normalise(row[39])
    if child is not None:
        version.add_reference("child", child)
    
    laws = _normalise(row[40])
    if laws is not None:
        version.add_reference("laws", laws)
    
    note = _normalise(row[41])
    if note is not None:
        version.comments = note
    
    url = _normalise(row[42])
    if url is not None:
        version.media_url = url
    
    # skip 43 - tags, 44 - lyrics and 45 - photo as no example content available
    
    # save the object via the web API (to test it)
    vobj = {
        "version" : version.data.get("version"),
        "song" : version.data.get("song"),
        "singer" : version.data.get("singer")
    }
    resp = requests.post(api + "/versions", json.dumps(vobj))
    print "saved version", resp.json().get("id")

# get the pure pair-wise relationships between songs with no duplicates
lv_rels = list(set([tuple(y) for y in [sorted(list(x)) for x in SONG_SONG_MAP]]))
rels = [(SONG_LV_ID_MAP.get(s), SONG_LV_ID_MAP.get(t)) for s, t in lv_rels]