def eliminar_paquete(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item( title="Login incorrecto", channel=CHANNELNAME, action="mainlist" ) ) return itemlist client.deletePackages((int(item.url))) time.sleep(10) q = client.getQueue() # hallado = 0 --> El tiempo de respuesta de pyLoad es poco previsible # for p in q: # if p.pid == int(item.url): hallado = 1 # if hallado == 1: itemlist.append( Item( title="Paquete eliminado", channel=CHANNELNAME, action="ver_cola" ) ) # else: # itemlist.append( Item( title="Error al eliminar el paquete", channel=CHANNELNAME, action="ver_cola" ) ) return itemlist
def ver_cola(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item( title="Login incorrecto", channel=CHANNELNAME, action="mainlist" ) ) return itemlist q = client.getQueue() for p in q: enlaces = len(p.links) if enlaces == 1: titulo = "%s (1 enlace)" % (p.name) else: titulo = "%s (%s enlaces)" % (p.name,enlaces) itemlist.append( Item( title=titulo, channel=CHANNELNAME, action="ver_paquete",url="%s" % p.pid ) ) if len(itemlist) == 0: itemlist.append( Item( title="Ningún paquete en cola", channel=CHANNELNAME, action="mainlist" ) ) itemlist.append( Item( title="Borrar terminados", channel=CHANNELNAME, action="borrar_terminados" ) ) itemlist.append( Item( title="Reiniciar fallidos", channel=CHANNELNAME, action="reiniciar_fallidos" ) ) return itemlist
def eliminar_paquete(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item(title="Login incorrecto", channel=CHANNELNAME, action="mainlist")) return itemlist client.deletePackages((int(item.url))) time.sleep(10) q = client.getQueue() # hallado = 0 --> El tiempo de respuesta de pyLoad es poco previsible # for p in q: # if p.pid == int(item.url): hallado = 1 # if hallado == 1: itemlist.append( Item(title="Paquete eliminado", channel=CHANNELNAME, action="ver_cola")) # else: # itemlist.append( Item( title="Error al eliminar el paquete", channel=CHANNELNAME, action="ver_cola" ) ) return itemlist
def ver_cola(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item(title="Login incorrecto", channel=CHANNELNAME, action="mainlist")) return itemlist q = client.getQueue() for p in q: enlaces = len(p.links) if enlaces == 1: titulo = "%s (1 enlace)" % (p.name) else: titulo = "%s (%s enlaces)" % (p.name, enlaces) itemlist.append( Item(title=titulo, channel=CHANNELNAME, action="ver_paquete", url="%s" % p.pid)) if len(itemlist) == 0: itemlist.append( Item(title="Ningún paquete en cola", channel=CHANNELNAME, action="mainlist")) itemlist.append( Item(title="Borrar terminados", channel=CHANNELNAME, action="borrar_terminados")) itemlist.append( Item(title="Reiniciar fallidos", channel=CHANNELNAME, action="reiniciar_fallidos")) return itemlist