def formAgregarResultado():
    if request.method=='POST':
        show=ShowAPI.ShowAPI()
        if (request.form['tipo']=="0"):
            showEncontrado = show.buscarPeliculaPorId(request.form['idShow'])
            abmshow = ABMShow.ABMShow()
            agregado1 = abmshow.altaShow(showEncontrado)
            if (agregado1):
                return render_template('formAgregarShow.html',show=showEncontrado)
        elif(request.form['tipo']=="1"):
            showEncontrado = show.buscarSeriePorId(request.form['idShow'])
            abmshow = ABMShow.ABMShow()
            agregado1 = abmshow.altaShow(showEncontrado)
            if (agregado1):
                return render_template('formAgregarShow.html',show=showEncontrado)
    return render_template('loguin.html', var1=True)
Esempio n. 2
0
def shows():
    listarShows()
    abm = ABMPersonaShow.ABMPersonaShow()
    showPer = abm.buscarPerShowPorIdPersona(1)
    for i in showPer:
        print(i.idshow)
    abms = ABMShow.ABMShow()
    shows = abms.listarShowsPorID(showPer)
    for i in shows:
        print(i.nombre)
Esempio n. 3
0
def pershow():
    abmshow = ABMShow.ABMShow()
    showEncontrado = Tablas.Show
    showEncontrado.idShow = 71446
    showEncontrado = abmshow.buscarShow(showEncontrado)
    abmPer = ABMPersona.ABMPersona()
    pershow = Tablas.PersonaShow()
    pershow.idshow = showEncontrado.idShow
    pershow.idpersona = 1
    pershow.estado = 1
    pershow.puntuado = 0
    abmshoper = ABMPersonaShow.ABMPersonaShow()
    agregado2 = abmshoper.altaPersonaShow(pershow)
    print(agregado2)
def misSeries():
    if("idpersona" in session):
        abm=ABMPersonaShow.ABMPersonaShow()
        showPer=abm.buscarPerShowPorIdPersona(session['idpersona'])
        if(len(showPer)>0):
            abms=ABMShow.ABMShow()
            shows=abms.listarShowsPorID(showPer)
            series=[]
            for i in shows:
                if (i.tipo==1):
                    series.append(i)
            return render_template('misShows.html',cantidad=len(series),shows=series,tipo=1)
        return render_template('misShows.html',cantidad=0)
    return render_template('loguin.html',var1=True)
def misPeliculas():
    if("idpersona" in session):
        abm=ABMPersonaShow.ABMPersonaShow()
        showPer=abm.buscarPerShowPorIdPersona(session['idpersona'])
        if(len(showPer)>0):
            abms=ABMShow.ABMShow()
            shows=abms.listarShowsPorID(showPer)
            peliculas=[]
            for i in shows:
                if (i.tipo==0):
                    peliculas.append(i)
            return render_template('misShows.html',cantidad=len(peliculas),shows=peliculas,tipo=0)
        return render_template('misShows.html',cantidad=0)
    return render_template('loguin.html')
def modificarPerShow():
    if request.method=='POST':
        pershow=Tablas.PersonaShow()
        abm=ABMPersonaShow.ABMPersonaShow()
        pershow.idpersona=session["idpersona"]
        pershow.idshow=request.form["idShow"]
        pershow.tipo=request.form["tipo"]
        pershow=abm.buscarPerShow(pershow)
        abms=ABMShow.ABMShow()
        show=Tablas.Show()
        show.idShow=request.form["idShow"]
        show.tipo=request.form['tipo']
        show=abms.buscarShowporIDyTipo(show)
        if(pershow!=None):
            return render_template('modificarShow.html',pershow=pershow,show=show)
    return render_template('loguin.html',var1=True)
Esempio n. 7
0
 def test_validarShow(self):
     #Lord, All Men Can't Be Dogs id pelicula=71466
     #La casa de papel id serie=71466 (ya se encuentra en la BD)
     abm = ABMShow.ABMShow()
     pelicula = Tablas.Show()
     pelicula.tipo = 0  #(pelicula)
     pelicula.idShow = 71446
     self.assertTrue(abm.validarShow(pelicula))
     se = Tablas.Show()
     se.idShow = 71446
     se.tipo = 1
     self.assertFalse(abm.validarShow(se))
     #tiene que dar False, porque ya existe en la base de datos
     inexistente = Tablas.Show()
     inexistente.idShow = 14586
     self.assertTrue(abm.validarShow(inexistente))
Esempio n. 8
0
def filtrar():
    load_logged_in_user()
    if request.method == 'POST':
        abm = ABMPersonaShow.ABMPersonaShow()
        showPer = abm.buscarPerShowPorIdPersona(session['idpersona'])
        showsid = []
        filtro = int(request.form['show'])
        if filtro == 0:
            for i in showPer:
                if i.estado == 0:
                    showsid.append(i)
        elif filtro == 1:
            for i in showPer:
                if i.estado == 1:
                    showsid.append(i)
        elif filtro == 2:
            for i in showPer:
                if i.estado == 2:
                    showsid.append(i)
        if (len(showsid) > 0):
            abms = ABMShow.ABMShow()
            shows = abms.listarShowsPorID(showsid)
            if request.form['tipo'] == "0":
                peliculas = []
                for i in shows:
                    if (i.tipo == 0):
                        peliculas.append(i)
                return render_template('misShows.html',
                                       cantidad=len(peliculas),
                                       shows=peliculas,
                                       tipo=0)
            elif request.form['tipo'] == "1":
                series = []
                for i in shows:
                    if (i.tipo == 1):
                        series.append(i)
                return render_template('misShows.html',
                                       cantidad=len(series),
                                       shows=series,
                                       tipo=1)
        tipo = request.form['tipo']
        return render_template('misShows.html', cantidad=0, tipo=tipo)
    return render_template('loguin.html', var1=True)
def modiShow():
    if request.method=='POST':
        pershow=Tablas.PersonaShow()
        abm=ABMPersonaShow.ABMPersonaShow()
        pershow.idpersona=int(session["idpersona"])
        pershow.idshow=int(request.form['idShow'])
        pershow.estado=int(request.form['estado'])
        pershow.tipo=int(request.form['tipo'])
        pershow.puntuado=1
        abm.modificarPerShow(pershow)
        show=Tablas.Show()
        show.idShow=int(request.form['idShow'])
        show.tipo=int(request.form['tipo'])
        if("puntuacion" in request.form):
            show.puntuacionUsuariosAcumulada=int(request.form['puntuacion'])
            abms=ABMShow.ABMShow()
            abms.puntuarShow(show)
        return render_template('bienvenido.html')
    return render_template('loguin.html',var1=True)
Esempio n. 10
0
def listarShows():
    ambs = ABMShow.ABMShow()
    resul = ambs.listarShows()
    for i in resul:
        print(i.idShow)
        print(i.tipo)