Example #1
0
def search_band(band_name):
    current_user = None  # TODO: Adicionar em minhas bandas: get_current_user()
    current_city = "Rio de Janeiro"  # get_current_city(ip=get_client_ip())

    band = get_or_create_band({
        'slug': get_slug(band_name),
        'name': band_name,
        'user': current_user
    })

    shows = get_shows_from_bands([band],
                                 limit_per_artist=1,
                                 city=current_city,
                                 call_lastfm_if_dont_have_shows=True,
                                 call_lastfm_without_subprocess=True)

    show = None

    if shows:
        show = shows[0][1][0]  # Pegando apenas o objeto show da banda

    return render_template("resultado_uma_banda.html",
                           band=band,
                           show=show,
                           notas=range(11),
                           BANDAS_CAMISAS=BANDAS_CAMISAS,
                           formulario_pag_seguro=formulario_pag_seguro)
Example #2
0
def novo():
    if has_cookie_login(request) and not user_logged():
        make_login(oauth_token=get_cookie_login(request))

    current_user = get_current_user()
    current_city = current_user.city if current_user and current_user.city else "Rio de Janeiro"

    minhas_bandas_shows = []
    if current_user:
        minhas_bandas = get_user_bands(user=current_user)

        if request.args.get('band'):
            minhas_bandas.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows.extend(
            get_shows_from_bands(minhas_bandas, 1, city=current_city))
    else:
        top_bands = [
            get_band("legiao-urbana"),
            get_band("the-beatles"),
            get_band("linkin-park"),
            get_band("queen"),
            get_band("guns-n-roses")
        ]

        if request.args.get('band'):
            top_bands.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows = get_shows_from_bands(top_bands,
                                                   1,
                                                   city=current_city,
                                                   force_to_include_band=True)
        los_bife_band = get_band(slug="los-bife")
        minhas_bandas_shows.append((los_bife_band, los_bife_band.shows[:1]))

    return render_template("novo.html",
                           current_user=current_user,
                           minhas_bandas_shows=minhas_bandas_shows,
                           notas=range(11),
                           BANDAS_CAMISAS=BANDAS_CAMISAS,
                           formulario_pag_seguro=formulario_pag_seguro,
                           range_tamanhos=range_tamanhos)
Example #3
0
def show_from_band(band_name):
    current_user = None # TODO: Adicionar em minhas bandas: get_current_user()
    current_city = "Rio de Janeiro" # get_current_city(ip=get_client_ip())
    band = get_or_create_band({'slug': get_slug(band_name), 'name': band_name, 'user': current_user})
    shows = get_shows_from_bands([band], limit_per_artist=1, city=current_city, call_lastfm_if_dont_have_shows=True, call_lastfm_without_subprocess=True)
    show = None
    if shows:
        show = shows[0][1][0] # Pegando apenas o objeto show da banda
    elif len(band.users) == 0:
        band.delete()
    return render_template("show_de_uma_banda.html", band=band, show=show)
Example #4
0
def novo():
    if has_cookie_login(request) and not user_logged():
        make_login(oauth_token=get_cookie_login(request))

    current_user = get_current_user()
    current_city = current_user.city if current_user and current_user.city else "Rio de Janeiro"

    minhas_bandas_shows = []
    if current_user:
        minhas_bandas = get_user_bands(user=current_user)

        if request.args.get('band'):
            minhas_bandas.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows.extend(get_shows_from_bands(minhas_bandas, 1, city=current_city))
    else:
        top_bands = [
                        get_band("legiao-urbana"),
                        get_band("the-beatles"),
                        get_band("linkin-park"),
                        get_band("queen"),
                        get_band("guns-n-roses")
        ]

        if request.args.get('band'):
            top_bands.insert(0, get_band(slug=request.args.get('band')))

        minhas_bandas_shows = get_shows_from_bands(top_bands, 1, city=current_city, force_to_include_band=True)
        los_bife_band = get_band(slug="los-bife")
        minhas_bandas_shows.append((los_bife_band, los_bife_band.shows[:1]))



    return render_template("novo.html", current_user=current_user,
        minhas_bandas_shows=minhas_bandas_shows, notas=range(11), BANDAS_CAMISAS=BANDAS_CAMISAS,
        formulario_pag_seguro=formulario_pag_seguro, range_tamanhos=range_tamanhos)
Example #5
0
def search_band(band_name):
    current_user = None # TODO: Adicionar em minhas bandas: get_current_user()
    current_city = "Rio de Janeiro" # get_current_city(ip=get_client_ip())

    band = get_or_create_band({'slug': get_slug(band_name), 'name': band_name, 'user': current_user})

    shows = get_shows_from_bands([band], limit_per_artist=1, city=current_city, call_lastfm_if_dont_have_shows=True, call_lastfm_without_subprocess=True)

    show = None

    if shows:
        show = shows[0][1][0] # Pegando apenas o objeto show da banda

    return render_template("resultado_uma_banda.html", band=band, show=show, notas=range(11), BANDAS_CAMISAS=BANDAS_CAMISAS,
        formulario_pag_seguro=formulario_pag_seguro)
Example #6
0
def show_from_band(band_name):
    current_user = None  # TODO: Adicionar em minhas bandas: get_current_user()
    current_city = "Rio de Janeiro"  # get_current_city(ip=get_client_ip())
    band = get_or_create_band({
        'slug': get_slug(band_name),
        'name': band_name,
        'user': current_user
    })
    shows = get_shows_from_bands([band],
                                 limit_per_artist=1,
                                 city=current_city,
                                 call_lastfm_if_dont_have_shows=True,
                                 call_lastfm_without_subprocess=True)
    show = None
    if shows:
        show = shows[0][1][0]  # Pegando apenas o objeto show da banda
    elif len(band.users) == 0:
        band.delete()
    return render_template("show_de_uma_banda.html", band=band, show=show)