Пример #1
0
def pullShowInfo(show):
    if ShowBusiness.getShow(show["number"]) != None:
        return False  ## already in datastore
    show_url = urllib.basejoin(SHOW_URL, show['href'])

    logging.debug("adding show to queue: %s" % (show_url,))
    taskqueue.add(url='/admin/update/%s/' % (urllib.quote_plus(show_url),))
    return True
Пример #2
0
def getShowTracksAsJson(from_show):
    if from_show in [IntType,LongType]:
        from_show = ShowBusiness.getShow(from_show)
    tracks = map(lambda x: {'artist':x['artist'], 
                            'title':x['title'],
                            'start_mspos':x['start_mspos']
                            }, ShowBusiness.getShowTracks(from_show))
    return json.dumps(tracks)
Пример #3
0
def test_scrapeAndStore():

    show_info = ShowScrape.parseShowPage(open(SHOW_PAGE,"r").read())
    assert len(show_info["tracks"]) > 0

    sh_cnt = ShowBusiness.getShowCount()
    show = ShowBusiness.addShow(**show_info)
    assert ShowBusiness.getShowCount() == sh_cnt+1
    assert ShowBusiness.getShow(show_info["number"]) != None
    assert ShowBusiness.getShowTrackCount(show_info["number"]) > 0