def reiniciar_paquete(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item(title="Login incorrecto", channel=CHANNELNAME, action="mainlist")) return itemlist client.restartPackage(int(item.url)) time.sleep(15) lista = client.statusDownloads() # hallado = 0 # for p in lista: # if p.pid == int(item.url): hallado = 1 # if hallado == 1: itemlist.append( Item(title="Paquete reiniciado", channel=CHANNELNAME, action="ver_cola")) # else: # itemlist.append( Item( title="Error al reiniciar el paquete", channel=CHANNELNAME, action="ver_cola" ) ) return itemlist
def reiniciar_paquete(item): itemlist = [] try: client = ThriftClient(host=SERVER, port=PORT) except: itemlist.append( Item( title="Login incorrecto", channel=CHANNELNAME, action="mainlist" ) ) return itemlist client.restartPackage(int(item.url)) time.sleep(15) lista = client.statusDownloads() # hallado = 0 # for p in lista: # if p.pid == int(item.url): hallado = 1 # if hallado == 1: itemlist.append( Item( title="Paquete reiniciado", channel=CHANNELNAME, action="ver_cola" ) ) # else: # itemlist.append( Item( title="Error al reiniciar el paquete", channel=CHANNELNAME, action="ver_cola" ) ) return itemlist