def home(urlOrig=None): opcs = _default_opcs # Medida temporal: if request.remote_addr in dosIPs: return '''Hemos detectado un posible abuso del servicio. Para más información ponte en contacto con [email protected]''', 404 # Obtener los últimos vídeos descargados: try: last = RegistroDescargas.gql("order by date DESC LIMIT 4") except: last = None if urlOrig is None: if request.method == "GET": # La URL se pasa por parámetro http://web.pydowntv.com/?url="" try: urlOrig = request.args['url'] except: return render_template('index.html', last=last) else: urlOrig = request.form['urlOrig'] if urlOrig == u'' or urlOrig == u"Introduce AQUÍ la URL del vídeo a descargar...": flash(u"Parece que no has introducido ninguna url") return redirect(url_for('home')) ## CASOS ESPECIALES URL NO ASCCII #RTPA if urlOrig.find("rtpa.es") != -1: try: urlOrig = urlOrig.split("video:")[0] + "video:_" + urlOrig.split("_")[1] except: pass #END - RTPA ## END - CASOS ESPECIALES #if urlOrig.startswith("www"): urlOrig ="http://"+urlOrig if not urlOrig.startswith("http://"): urlOrig ="http://"+urlOrig if compURL(urlOrig): canal = qCanal(urlOrig, opcs) if canal == None: flash(u"Lo que has introducido no corresponde con ningún canal soportado por PyDownTV\n") return redirect(url_for('home')) #return render_template("index.html", msgs=TVnoSoportada) else: #TODO: meter huevos de pascua aquí :P flash(u"URL incorrecta: \'%s\'" % urlOrig) return redirect(url_for('home')) #Primero meter en una lista las posibles variaciones #try: # last = RegistroDescargas.gql("WHERE vidTit IN :title order by date DESC LIMIT 20", title=[urlOrig]) #except: # last = None #return last[0].urlOrig try: info = canal.getInfo() except Error.GeneralPyspainTVsError, e: flash(u"ERROR al recuperar el vídeo: %s" % e.__str__()) return redirect(url_for('home'))
def embed(urlOrig=None): opcs = _default_opcs # Medida temporal: if request.remote_addr in dosIPs: return '''Hemos detectado un posible abuso del servicio. Para más información ponte en contacto con [email protected]''', 404 if urlOrig is None: if request.method == 'POST': urlOrig = request.form['urlOrig'] else: return render_template('embed.html') # Obtener los últimos vídeos descargados: try: last = RegistroDescargas.gql("order by date DESC LIMIT 4") except: last = None if urlOrig is None: if request.method == "GET": # La URL se pasa por parámetro http://web.pydowntv.com/?url="" try: urlOrig = request.args['url'] except: return render_template('index.html', last=last) else: urlOrig = request.form['urlOrig'] if urlOrig == u'' or urlOrig == u"Introduce AQUÍ la URL del vídeo a descargar...": h(u"Parece que no has introducido ninguna url") return redirect(urflasl_for('home')) ## CASOS ESPECIALES URL NO ASCCII #RTPA if urlOrig.find("rtpa.es") != -1: try: urlOrig = urlOrig.split("video:")[0] + "video:_" + urlOrig.split( "_")[1] except: pass #END - RTPA ## END - CASOS ESPECIALES #if urlOrig.startswith("www"): urlOrig ="http://"+urlOrig if not urlOrig.startswith("http://"): urlOrig = "http://" + urlOrig if compURL(urlOrig): canal = qCanal(urlOrig, opcs) if canal == None: flash( u"Lo que has introducido no corresponde con ningún canal soportado por PyDownTV\n" ) return redirect(url_for('home')) #return render_template("index.html", msgs=TVnoSoportada) else: #TODO: meter huevos de pascua aquí :P flash(u"URL incorrecta: \'%s\'" % urlOrig) return redirect(url_for('home')) #Primero meter en una lista las posibles variaciones #try: # last = RegistroDescargas.gql("WHERE vidTit IN :title order by date DESC LIMIT 20", title=[urlOrig]) #except: # last = None #return last[0].urlOrig try: info = canal.getInfo() except Error.GeneralPyspainTVsError, e: flash(u"ERROR al recuperar el vídeo: %s" % e.__str__()) return redirect(url_for('home'))
def agranel(urlOrig=None): #TODO: Hacer HILOS!!! opcs = _default_opcs # Medida temporal: if request.remote_addr in dosIPs: return '''Hemos detectado un posible abuso del servicio. Para más información ponte en contacto con [email protected]''', 404 # Obtener los últimos vídeos descargados: try: last = RegistroDescargas.gql("order by date DESC LIMIT 4") except: last = None if urlOrig is None: if request.method == "GET": # La URL se pasa por parámetro http://web.pydowntv.com/?url="" try: urlOrig = request.args['url'] except: return render_template('agranel.html', last=last) else: urlOrig = request.form['urlOrig'] if urlOrig == u'' or urlOrig == u"Introduce AQUÍ la URL del vídeo a descargar...": flash(u"No has introducido ninguna url.. oO") return redirect(url_for('agranel')) # Ahora hay que cambiar todo urlsOrig = urlOrig.split() vids = [] t**s = [] descs = [] urlsO = [] errors = [] jdownloader = "" for i in range(len(urlsOrig)): ## CASOS ESPECIALES URL NO ASCCII #RTPA if urlsOrig[i].find("rtpa.es") != -1: try: urlsOrig[i] = urlsOrig[i].split( "video:")[0] + "video:_" + urlsOrig[i].split("_")[1] except: pass #END - RTPA ## END - CASOS ESPECIALES if not urlsOrig[i].startswith("http://"): urlsOrig[i] = "http://" + urlOrig[i] #TODO: NO SALIR, quedarme con las ur buenas PARA TODO LO QUE VIENE A CONTINUACIÓN ;) if compURL(urlsOrig[i]): canal = qCanal(urlsOrig[i], opcs) if canal == None: errors.append( u"La URL: %s no corresponde con ningún canal soportado por PyDownTV" % urlsOrig[i]) continue #flash(u"Lo que has introducido no corresponde con ningún canal soportado por PyDownTV\n") #return redirect(url_for('agranel')) else: #TODO: meter huevos de pascua aquí :P errors.append(u"URL incorrecta: \'%s\'" % urlsOrig[i]) continue #flash(u"URL incorrecta: \'%s\'" % urlOrig) #return redirect(url_for('agranel')) try: info = canal.getInfo() except Error.GeneralPyspainTVsError, e: errors.append(u"ERROR al recuperar el vídeo: %s" % e.__str__()) continue #flash(u"ERROR al recuperar el vídeo: %s" % e.__str__()) #return redirect(url_for('agranel')) except Exception, e: errors.append( u"No se ha podido recuperar el vídeo de la URL: %s. ¿Es una URL correcta?" % urlsOrig[i]) continue
def agranel(urlOrig=None): #TODO: Hacer HILOS!!! opcs = _default_opcs # Medida temporal: if request.remote_addr in dosIPs: return '''Hemos detectado un posible abuso del servicio. Para más información ponte en contacto con [email protected]''', 404 # Obtener los últimos vídeos descargados: try: last = RegistroDescargas.gql("order by date DESC LIMIT 4") except: last = None if urlOrig is None: if request.method == "GET": # La URL se pasa por parámetro http://web.pydowntv.com/?url="" try: urlOrig = request.args['url'] except: return render_template('agranel.html', last=last) else: urlOrig = request.form['urlOrig'] if urlOrig == u'' or urlOrig == u"Introduce AQUÍ la URL del vídeo a descargar...": flash(u"No has introducido ninguna url.. oO") return redirect(url_for('agranel')) # Ahora hay que cambiar todo urlsOrig = urlOrig.split() vids=[] t**s=[] descs=[] urlsO = [] errors=[] jdownloader = "" for i in range(len(urlsOrig)): ## CASOS ESPECIALES URL NO ASCCII #RTPA if urlsOrig[i].find("rtpa.es") != -1: try: urlsOrig[i] = urlsOrig[i].split("video:")[0] + "video:_" + urlsOrig[i].split("_")[1] except: pass #END - RTPA ## END - CASOS ESPECIALES if not urlsOrig[i].startswith("http://"): urlsOrig[i] ="http://"+urlOrig[i] #TODO: NO SALIR, quedarme con las ur buenas PARA TODO LO QUE VIENE A CONTINUACIÓN ;) if compURL(urlsOrig[i]): canal = qCanal(urlsOrig[i], opcs) if canal == None: errors.append(u"La URL: %s no corresponde con ningún canal soportado por PyDownTV" % urlsOrig[i]) continue #flash(u"Lo que has introducido no corresponde con ningún canal soportado por PyDownTV\n") #return redirect(url_for('agranel')) else: #TODO: meter huevos de pascua aquí :P errors.append(u"URL incorrecta: \'%s\'" % urlsOrig[i]) continue #flash(u"URL incorrecta: \'%s\'" % urlOrig) #return redirect(url_for('agranel')) try: info = canal.getInfo() except Error.GeneralPyspainTVsError, e: errors.append(u"ERROR al recuperar el vídeo: %s" % e.__str__()) continue #flash(u"ERROR al recuperar el vídeo: %s" % e.__str__()) #return redirect(url_for('agranel')) except Exception, e: errors.append(u"No se ha podido recuperar el vídeo de la URL: %s. ¿Es una URL correcta?" % urlsOrig[i]) continue