예제 #1
0
파일: batch.py 프로젝트: agrover/BandRadar
def _foo():
    """test, do not use"""
    amazon_src = Source.byName("amazon")
    done_artists = Artist.select(Artist.q.recordings_updated != None)
    for artist in done_artists:
        for record in artist.recordings:
            if record.source == amazon_src:
                record.destroySelf()
        for recording in amazon.recordings(artist.name):
            Recording(
                name=recording["name"], by=artist, url=recording["url"], img_url=recording["img_url"], source=amazon_src
            )
예제 #2
0
파일: batch.py 프로젝트: agrover/BandRadar
def recording_artist_update(artist):
    # remove old entries
    for record in Recording.selectBy(by=artist):
        record.destroySelf()

    # add new entries (if any)
    for recording in cdbaby.recordings(artist.name):
        Recording(
            name=recording["name"],
            by=artist,
            url=recording["url"],
            img_url=recording["img_url"],
            source=Source.byName("cdbaby"),
        )
    for recording in amazon.recordings(artist.name):
        Recording(
            name=recording["name"],
            by=artist,
            url=recording["url"],
            img_url=recording["img_url"],
            source=Source.byName("amazon"),
        )