當前位置: 首頁>>代碼示例>>Python>>正文


Python xbmcvfs.rmdir方法代碼示例

本文整理匯總了Python中xbmcvfs.rmdir方法的典型用法代碼示例。如果您正苦於以下問題:Python xbmcvfs.rmdir方法的具體用法?Python xbmcvfs.rmdir怎麽用?Python xbmcvfs.rmdir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在xbmcvfs的用法示例。


在下文中一共展示了xbmcvfs.rmdir方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: delete_nodes

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete_nodes(self):

        ''' Remove node and children files.
        '''
        path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
        dirs, files = xbmcvfs.listdir(path)

        for file in files:

            if file.startswith('emby'):
                self.delete_node(os.path.join(path, file.decode('utf-8')))

        for directory in dirs:

            if directory.startswith('emby'):
                _, files = xbmcvfs.listdir(os.path.join(path, directory.decode('utf-8')))

                for file in files:
                    self.delete_node(os.path.join(path, directory.decode('utf-8'), file.decode('utf-8')))

                xbmcvfs.rmdir(os.path.join(path, directory.decode('utf-8'))) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:23,代碼來源:views.py

示例2: delete_node_by_id

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete_node_by_id(self, view_id):

        ''' Remove node and children files based on view_id.
        '''
        path = xbmc.translatePath("special://profile/library/video/").decode('utf-8')
        dirs, files = xbmcvfs.listdir(path)

        for directory in dirs:

            if directory.startswith('emby') and directory.endswith(view_id):
                _, files = xbmcvfs.listdir(os.path.join(path, directory.decode('utf-8')))

                for file in files:
                    self.delete_node(os.path.join(path, directory.decode('utf-8'), file.decode('utf-8')))

                xbmcvfs.rmdir(os.path.join(path, directory.decode('utf-8'))) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:18,代碼來源:views.py

示例3: delete_folder_contents

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete_folder_contents(path, delete_subfolders=False):
    """
    Delete all files in a folder
    :param path: Path to perform delete contents
    :param delete_subfolders: If True delete also all subfolders
    """
    directories, files = list_dir(path)
    for filename in files:
        xbmcvfs.delete(os.path.join(path, filename))
    if not delete_subfolders:
        return
    for directory in directories:
        delete_folder_contents(os.path.join(path, directory), True)
        # Give time because the system performs previous op. otherwise it can't delete the folder
        xbmc.sleep(80)
        xbmcvfs.rmdir(os.path.join(path, directory)) 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:18,代碼來源:fileops.py

示例4: delete_recursive

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete_recursive(path, dirs):

    ''' Delete files and dirs recursively.
    '''
    for directory in dirs:
        dirs2, files = xbmcvfs.listdir(os.path.join(path, directory.decode('utf-8')))

        for file in files:
            xbmcvfs.delete(os.path.join(path, directory.decode('utf-8'), file.decode('utf-8')))

        delete_recursive(os.path.join(path, directory.decode('utf-8')), dirs2)
        xbmcvfs.rmdir(os.path.join(path, directory.decode('utf-8'))) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:14,代碼來源:utils.py

示例5: delete_cache_folder

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete_cache_folder():
    # Delete cache folder in the add-on userdata (no more needed with the new cache management)
    cache_path = os.path.join(g.DATA_PATH, 'cache')
    if not os.path.exists(g.py2_decode(xbmc.translatePath(cache_path))):
        return
    debug('Deleting the cache folder from add-on userdata folder')
    try:
        delete_folder_contents(cache_path, True)
        xbmc.sleep(80)
        xbmcvfs.rmdir(cache_path)
    except Exception:  # pylint: disable=broad-except
        import traceback
        error(g.py2_decode(traceback.format_exc(), 'latin-1')) 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:15,代碼來源:upgrade_actions.py

示例6: remove_item

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def remove_item(item_task, library_home=None):
    """Remove an item from the library and delete if from disk"""
    # pylint: disable=unused-argument, broad-except

    common.info('Removing {} from library', item_task['title'])

    exported_filename = g.py2_decode(xbmc.translatePath(item_task['filepath']))
    videoid = item_task['videoid']
    common.debug('VideoId: {}', videoid)
    try:
        parent_folder = g.py2_decode(xbmc.translatePath(os.path.dirname(exported_filename)))
        if xbmcvfs.exists(exported_filename):
            xbmcvfs.delete(exported_filename)
        else:
            common.warn('Cannot delete {}, file does not exist', exported_filename)
        # Remove the NFO files if exists
        nfo_file = os.path.splitext(exported_filename)[0] + '.nfo'
        if xbmcvfs.exists(nfo_file):
            xbmcvfs.delete(nfo_file)
        dirs, files = xbmcvfs.listdir(parent_folder)
        tvshow_nfo_file = g.py2_decode(makeLegalFilename('/'.join([parent_folder, 'tvshow.nfo'])))
        # Remove tvshow_nfo_file only when is the last file
        # (users have the option of removing even single seasons)
        if xbmcvfs.exists(tvshow_nfo_file) and not dirs and len(files) == 1:
            xbmcvfs.delete(tvshow_nfo_file)
            # Delete parent folder
            xbmcvfs.rmdir(parent_folder)
        # Delete parent folder when empty
        if not dirs and not files:
            xbmcvfs.rmdir(parent_folder)

        _remove_videoid_from_db(videoid)
    except ItemNotFound:
        common.warn('The video with id {} not exists in the database', videoid)
    except Exception as exc:
        import traceback
        common.error(g.py2_decode(traceback.format_exc(), 'latin-1'))
        ui.show_addon_error_info(exc) 
開發者ID:CastagnaIT,項目名稱:plugin.video.netflix,代碼行數:40,代碼來源:library_items.py

示例7: recursive_delete_dir

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def recursive_delete_dir(self, fullpath):
        '''helper to recursively delete a directory'''
        success = True
        if not isinstance(fullpath, unicode):
            fullpath = fullpath.decode("utf-8")
        dirs, files = xbmcvfs.listdir(fullpath)
        for file in files:
            file = file.decode("utf-8")
            success = xbmcvfs.delete(os.path.join(fullpath, file))
        for directory in dirs:
            directory = directory.decode("utf-8")
            success = self.recursive_delete_dir(os.path.join(fullpath, directory))
        success = xbmcvfs.rmdir(fullpath)
        return success 
開發者ID:jurialmunkey,項目名稱:plugin.video.themoviedb.helper,代碼行數:16,代碼來源:downloader.py

示例8: rmdirtree

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmdirtree(path, silent=False, vfs=True):
    """
    Elimina un directorio y su contenido
    @param path: ruta a eliminar
    @type path: str
    @rtype: bool
    @return: devuelve False en caso de error
    """
    path = encode(path)
    try:
        if xbmc_vfs and vfs:
            if not exists(path): return True
            if not path.endswith('/') and not path.endswith('\\'):
                path = join(path, ' ').rstrip()
            for raiz, subcarpetas, ficheros in walk(path, topdown=False):
                for f in ficheros:
                    xbmcvfs.delete(join(raiz, f))
                for s in subcarpetas:
                    xbmcvfs.rmdir(join(raiz, s))
            xbmcvfs.rmdir(path)
        elif path.lower().startswith("smb://"):
            for raiz, subcarpetas, ficheros in samba.walk(path, topdown=False):
                for f in ficheros:
                    samba.remove(join(decode(raiz), decode(f)))
                for s in subcarpetas:
                    samba.rmdir(join(decode(raiz), decode(s)))
            samba.rmdir(path)
        else:
            import shutil
            shutil.rmtree(path, ignore_errors=True)
    except:
        logger.error("ERROR al eliminar el directorio: %s" % path)
        if not silent:
            logger.error(traceback.format_exc())
            platformtools.dialog_notification("Error al eliminar el directorio", path)
        return False
    else:
        return not exists(path) 
開發者ID:alfa-addon,項目名稱:addon,代碼行數:40,代碼來源:filetools.py

示例9: rmdir

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmdir(path, silent=False, vfs=True):
    """
    Elimina un directorio
    @param path: ruta a eliminar
    @type path: str
    @rtype: bool
    @return: devuelve False en caso de error
    """
    path = encode(path)
    try:
        if xbmc_vfs and vfs:
            if not path.endswith('/') and not path.endswith('\\'):
                path = join(path, ' ').rstrip()
            return bool(xbmcvfs.rmdir(path))
        elif path.lower().startswith("smb://"):
            samba.rmdir(path)
        else:
            os.rmdir(path)
    except:
        logger.error("ERROR al eliminar el directorio: %s" % path)
        if not silent:
            logger.error(traceback.format_exc())
            platformtools.dialog_notification("Error al eliminar el directorio", path)
        return False
    else:
        return True 
開發者ID:alfa-addon,項目名稱:addon,代碼行數:28,代碼來源:filetools.py

示例10: rmtree

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmtree(path):
    if isinstance(path, unicode):
        path = path.encode('utf-8')
    dirs, files = xbmcvfs.listdir(path)
    for dir in dirs:
        rmtree(os.path.join(path, dir))
    for file in files:
        xbmcvfs.delete(os.path.join(path, file))
    xbmcvfs.rmdir(path) 
開發者ID:taxigps,項目名稱:xbmc-addons-chinese,代碼行數:11,代碼來源:service.py

示例11: delete

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def delete(path):
    dirs, files = xbmcvfs.listdir(path)
    for file in files:
        xbmcvfs.delete(path+file)
    for dir in dirs:
        delete(path + dir + '/')
    xbmcvfs.rmdir(path) 
開發者ID:primaeval,項目名稱:plugin.video.iptv.recorder,代碼行數:9,代碼來源:main.py

示例12: rmdirs

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmdirs(path):
    path = xbmc.translatePath(path)
    dirs, files = xbmcvfs.listdir(path)
    for dir in dirs:
        rmdirs(os.path.join(path,dir))
    xbmcvfs.rmdir(path) 
開發者ID:primaeval,項目名稱:plugin.video.iptv.recorder,代碼行數:8,代碼來源:main.py

示例13: rmdir

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmdir(f, force=False):
        import xbmcvfs
        return xbmcvfs.rmdir(f, force) 
開發者ID:cguZZman,項目名稱:script.module.clouddrive.common,代碼行數:5,代碼來源:utils.py

示例14: library_tv_remove_strm

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def library_tv_remove_strm(show, folder, id, season, episode):
	enc_season = ('Season %s' % season).translate(None, '\/:*?"<>|').strip('.')
	enc_name = '%s - S%02dE%02d.strm' % (text.clean_title(show['seriesname']), season, episode)
	season_folder = os.path.join(folder, enc_season)
	stream_file = os.path.join(season_folder, enc_name)
	if xbmcvfs.exists(stream_file):
		xbmcvfs.delete(stream_file)
		while not xbmc.Monitor().abortRequested() and xbmcvfs.exists(stream_file):
			xbmc.sleep(1000)
		a,b = xbmcvfs.listdir(season_folder)
		if not a and not b:
			xbmcvfs.rmdir(season_folder)
		return True
	return False 
開發者ID:a4k-openproject,項目名稱:plugin.video.openmeta,代碼行數:16,代碼來源:lib_tvshows.py

示例15: rmdir

# 需要導入模塊: import xbmcvfs [as 別名]
# 或者: from xbmcvfs import rmdir [as 別名]
def rmdir(path, quiet=False):
	if not exists(path):
		if debug:
			xbmc.log('******** VFS rmdir notice: %s does not exist' % path)
		return False
	if not quiet:
		msg = 'Remove Directory'
		msg2 = 'Please confirm directory removal!'
		if not confirm(msg, msg2, path): return False
	try:		
		xbmcvfs.rmdir(path)
	except Exception as e:
		xbmc.log('******** VFS error: %s' % e) 
開發者ID:tvaddonsco,項目名稱:plugin.git.browser,代碼行數:15,代碼來源:vfs.py


注:本文中的xbmcvfs.rmdir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。