Ejemplo n.º 1
0
 def create_version(cls, version_json, singer, song):
     if version_json is None:
         return None
     
     # create the version object and save it to the store
     version = Version({"version" : version_json})
     if singer is not None:
         version.singer = singer
     if song is not None:
         version.song = song
     version.save()
     
     # call the indexing process, and index this object and all
     # related ones
     VersionIndex.by_id(version.id, cascade=True)
     
     return version
Ejemplo n.º 2
0
 def update_version(cls, version_id, version_json=None, singer=None, song=None):
     # retrieve and update the version object in the desired way
     version = Version().get(version_id, links=True)
     
     if version is None:
         raise NotFoundException()
     
     if version_json is not None:
         version.patch_version(version_json, replace_all=True, keep_id=True)
     if singer is not None:
         version.singer = singer
     if song is not None:
         version.song = song
     version.save()
     
     # call the indexing process, and index this object and all related ones
     VersionIndex.by_id(version.id, cascade=True)
     
     return version
Ejemplo n.º 3
0
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"
version.source = "Jimmy McBride, 'My Parents Reared Me Tenderly', 1985, pp. 37-38"
version.add_location(name="Falkirk")
version.add_reference("ROUD", "10368")
Ejemplo n.º 4
0
     # save the object via the web API (to test it)
     resp = requests.post(api + "/songs", data=json.dumps({"song" : song.data.get("song")}))
     print "saved song", resp.json().get("id")
     
     # record the id and map it to the lvid for later use
     id = resp.json().get("id")
     SONG_LV_ID_MAP[slv_id] = id
 
 # now lift the version out of this row
 version = Version()
 
 vlv_id = _normalise(row[8])
 version.lv_id = vlv_id
 
 sid = SONG_LV_ID_MAP.get(vlv_id.split(".")[0])
 version.song = sid
 
 vtitle = _normalise(row[9])
 if vtitle is not None:
     version.title = vtitle
 
 valt = _normalise(row[10])
 if valt is not None:
     version.alternative_title = valt
 
 vsummary = _normalise(row[11])
 if vsummary is not None:
     version.summary = vsummary
 
 eng = _normalise(row[12])
 if eng == "TRUE":