def mainlist(item): logger.info() item.category = 'Descargas' itemlist = [] if download_path.startswith('smb://'): fichs = sorted(filetools.listdir(download_path)) ficheros = [ filetools.join(download_path, fit) for fit in fichs if fit.endswith('.json') ] else: path = filetools.join(download_path, '*.json') ficheros = glob.glob(path) ficheros.sort(key=os.path.getmtime, reverse=False) for down_path in ficheros: # ~ it = Item().fromjson(path=down_path) # falla con smb:// it = Item().fromjson(filetools.read(down_path)) it.from_channel = it.channel it.from_action = it.action it.channel = item.channel it.action = 'acciones_enlace' it.jsonfile = down_path it.folder = False if it.downloadStatus == STATUS_CODES.completed: it.title = '[B][COLOR gold][Ok] %s [%s][/COLOR][/B]' % ( it.downloadFilename, config.format_bytes(it.downloadSize)) elif it.downloadStatus == STATUS_CODES.canceled: it.title = '[COLOR red][%s%%] %s [%s de %s][/COLOR]' % ( int(it.downloadProgress), it.downloadFilename, config.format_bytes(it.downloadCompleted), config.format_bytes(it.downloadSize)) elif it.downloadStatus == STATUS_CODES.error: it.title = '[I][COLOR gray][Error] %s[/COLOR][/I]' % it.downloadFilename else: it.title = '[I][COLOR gray][???] %s[/COLOR][/I]' % it.downloadFilename itemlist.append(it) return itemlist