def listdir(path): """ Lista un directorio @param path: Directorio a listar, debe ser un str "UTF-8" @type path: str @rtype: str @return: contenido de un directorio """ path = encode(path) try: if path.lower().startswith("smb://"): return decode(samba.listdir(path)) else: return decode(os.listdir(path)) except: logger.error("ERROR al leer el directorio: %s" % path) logger.error(traceback.format_exc()) return False
def listdir(path): """ Lista un directorio @param path: Directorio a listar, debe ser un str "UTF-8" @type path: str @rtype: str @return: contenido de un directorio """ path = encode(path) try: if path.lower().startswith("smb://"): return decode(samba.listdir(path)) else: return decode(os.listdir(path)) except: logger.error("ERROR al leer el directorio: %s" %(path)) logger.error(traceback.format_exc()) return False
def listdir(path, silent=False, vfs=True, file_inf=False): """ Lista un directorio @param path: Directorio a listar, debe ser un str "UTF-8" @type path: str @rtype: str @return: contenido de un directorio """ path = encode(path) try: if xbmc_vfs and vfs: dirs, files = xbmcvfs.listdir(path) res = sorted(dirs) + sorted(files) if file_inf: path = join(path, ' ').rstrip() ls_la = [] for file in res: file_ext = file_info(join(path, file)) if not isinstance(file_ext, bool): file_ext = file_ext.replace(path, '') else: return file_ext if file_ext: ls_la += [file_ext] else: ls_la += [ '%s%s %s %s %s %s %s %s' % ('#', '#', '#', '#', '#', '#', '#', file) ] res = ls_la return decode(res) elif path.lower().startswith("smb://"): return decode(samba.listdir(path)) else: return decode(os.listdir(path)) except: logger.error("ERROR al leer el directorio: %s" % path) if not silent: logger.error(traceback.format_exc()) return False
def listdir(path, silent=False, vfs=True): """ Lista un directorio @param path: Directorio a listar, debe ser un str "UTF-8" @type path: str @rtype: str @return: contenido de un directorio """ path = encode(path) try: if xbmc_vfs and vfs: dirs, files = xbmcvfs.listdir(path) return dirs + files elif path.lower().startswith("smb://"): return decode(samba.listdir(path)) else: return decode(os.listdir(path)) except: logger.error("ERROR al leer el directorio: %s" % path) if not silent: logger.error(traceback.format_exc()) return False
def listdir(path, silent=False, vfs=True): """ List a directory @param path: Directory to list, must be a str "UTF-8" @type path: str @rtype: str @return: content of a directory """ path = encode(path) try: if xbmc_vfs and vfs: dirs, files = xbmcvfs.listdir(path) return dirs + files elif path.lower().startswith("smb://"): return decode(samba.listdir(path)) else: return decode(os.listdir(path)) except: logger.error("ERROR when reading the directory: %s" % path) if not silent: logger.error(traceback.format_exc()) return False