• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python xbmcvfs.rmdir函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中xbmcvfs.rmdir函数的典型用法代码示例。如果您正苦于以下问题:Python rmdir函数的具体用法?Python rmdir怎么用?Python rmdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rmdir函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: extract_and_copy

 def extract_and_copy(extraction=0):
     for root, dirs, files in os.walk(extractPath, topdown=False):
         for file in files:
             dirfile = os.path.join(root, file)
             
             # Sanitize filenames - converting them to ASCII - and remove them from folders
             f = xbmcvfs.File(dirfile)
             temp = f.read()
             f.close()
             xbmcvfs.delete(dirfile)
             dirfile_with_path_name = normalizeString(os.path.relpath(dirfile, extractPath))
             dirname, basename = os.path.split(dirfile_with_path_name)
             dirname = re.sub(r"[/\\]{1,10}","-", dirname)
             dirfile_with_path_name = "(%s)%s" % (dirname, basename) if len(dirname) else basename
             new_dirfile = os.path.join(extractPath, dirfile_with_path_name)
             with open(new_dirfile, "w") as f:
                 f.write(temp)
             
             # Get the file extension
             ext = os.path.splitext(new_dirfile)[1][1:].lower()
             if ext in sub_ext and xbmcvfs.exists(new_dirfile):
                 if not new_dirfile in subtitles:
                     #Append the matching file
                     subtitles.append(new_dirfile)
             elif ext in "rar zip" and not extraction:
                 # Extract compressed files, extracted priorly
                 xbmc.executebuiltin("XBMC.Extract(%s, %s)" % (new_dirfile, extractPath))
                 xbmc.sleep(1000)
                 extract_and_copy(1)
             elif ext not in "idx": 
                 xbmcvfs.delete(new_dirfile)
         for dir in dirs:
             dirfolder = os.path.join(root, dir)
             xbmcvfs.rmdir(dirfolder)
开发者ID:jaysonsantos,项目名称:service.subtitles.legendastv,代码行数:34,代码来源:service.py


示例2: remove_movie

def remove_movie(title):
    movie_dir = get_movie_dir(title)[0]
    xbmcvfs.rmdir(movie_dir+os.sep, force=True)
    if generic_utility.get_setting('update_db') == 'true':
        xbmc.executebuiltin('CleanLibrary(video)')
    else:
        xbmc.executebuiltin("Container.Refresh")
开发者ID:badcrc,项目名称:plugin.video.flix2kodi,代码行数:7,代码来源:library.py


示例3: remove_series

def remove_series(series_title):
    series_file = get_series_dir(series_title)
    xbmcvfs.rmdir(series_file+os.sep, force=True)
    if generic_utility.get_setting('update_db') == 'true':
        xbmc.executebuiltin('CleanLibrary(video)')
    else:
        xbmc.executebuiltin("Container.Refresh")
开发者ID:badcrc,项目名称:plugin.video.flix2kodi,代码行数:7,代码来源:library.py


示例4: delete

 def delete(self, path, inner=False):
     dirlist, filelist = self.listdir(path, full=True)
     [xbmcvfs.delete(self._path(x)) for x in filelist]
     [self.delete(self._path(x)) for x in dirlist]
     if not inner:
         if not xbmcvfs.delete(self._path(path)):
             xbmcvfs.rmdir(self._path(path))
开发者ID:chimkentec,项目名称:KodiMODo_rep,代码行数:7,代码来源:system.py


示例5: __init__

    def __init__(self):

        #Check if a path has been set in the addon settings
        settings_path = common.addon.get_setting('meta_folder_location')
        
        if settings_path:
            self.path = xbmc.translatePath(settings_path)
        else:
            self.path = xbmc.translatePath('special://profile/addon_data/script.module.metahandler')

        self.work_path = os.path.join(self.path, 'work')
        self.cache_path = os.path.join(self.path,  'meta_cache')
        self.videocache = os.path.join(self.cache_path, 'video_cache.db')
        self.work_videocache = os.path.join(self.work_path, 'video_cache.db')
        self.movie_images = os.path.join(self.cache_path, 'movie')
        self.tv_images = os.path.join(self.cache_path, 'tvshow')        
        
        self.table_list = ['movie_meta', 'tvshow_meta', 'season_meta', 'episode_meta']
     
        common.addon.log('---------------------------------------------------------------------------------------', 2)
        #delete and re-create work_path to ensure no previous files are left over
        if xbmcvfs.exists(self.work_path):
            import shutil
            try:
                common.addon.log('Removing previous work folder: %s' % self.work_path, 2)
                # shutil.rmtree(self.work_path)
                xbmcvfs.rmdir(self.work_path)
            except Exception, e:
                common.addon.log('Failed to delete work folder: %s' % e, 4)
                pass
开发者ID:rdasberry,项目名称:Core-Module-Beta-Repo,代码行数:30,代码来源:metacontainers.py


示例6: cache

def cache():
    try:
        xbmcvfs.rmdir(generic_utility.cache_dir(), force=True)
        generic_utility.log('Cache folder deleted.')
        generic_utility.notification(generic_utility.get_string(30309))
    except Exception:
        pass
开发者ID:badcrc,项目名称:plugin.video.flix2kodi,代码行数:7,代码来源:delete.py


示例7: autostart

def autostart():
        xbmcaddon.Addon().setSetting(id="files_overwrite", value='false')
        settings = _settings()
        settings._get_general()
        addondir = xbmc.translatePath( utils.__addon__.getAddonInfo('profile') )
        tempdir = os.path.join(addondir, 'temp')
        service_runtime  = str(settings.service_runtime + ':00')
        log('Service - Run at startup: %s'%settings.service_startup, xbmc.LOGNOTICE)        
        log('Service - Delayed startup: %s minutes'%settings.service_startupdelay, xbmc.LOGNOTICE)   
        log('Service - Run as service: %s'%settings.service_enable, xbmc.LOGNOTICE)
        log('Service - Time: %s'%service_runtime, xbmc.LOGNOTICE)
        if xbmcvfs.exists(tempdir):
            xbmcvfs.rmdir(tempdir)
            log('Removing temp folder from previous run.')
        if settings.service_startup:
            if settings.service_startupdelay != '--':
                xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:%s:00,silent)' %settings.service_startupdelay) 
            else:
                xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:00:20,silent)') 
        if settings.service_enable:
            while (not xbmc.abortRequested):
                xbmc.sleep(5000)
                if not(time.strftime('%H:%M') == service_runtime):
                    pass
                else:
                    if not xbmcvfs.exists(tempdir):
                        log('Time is %s:%s, Scheduled run starting' % (time.strftime('%H'), time.strftime('%M')))
                        xbmc.executebuiltin('XBMC.RunScript(script.artwork.downloader,silent=true)')
                    else:
                        log('Addon already running, scheduled run aborted', xbmc.LOGNOTICE)
开发者ID:cienislaw,项目名称:script.artwork.downloader,代码行数:30,代码来源:service.py


示例8: autostart

def autostart():
        xbmcaddon.Addon().setSetting(id="files_overwrite", value='false')
        tempdir = os.path.join(__addonprofile__, 'temp')
        service_runtime  = str(setting.get('service_runtime') + ':00')
        log('## Service - Run at startup: %s'% setting.get('service_startup'), xbmc.LOGNOTICE)        
        log('## Service - Delayed startup: %s minutes'% setting.get('service_startupdelay'), xbmc.LOGNOTICE)   
        log('## Service - Run as service: %s'% setting.get('service_enable'), xbmc.LOGNOTICE)
        log('## Service - Time: %s'% service_runtime, xbmc.LOGNOTICE)
        log("##########........................")
        # Check if tempdir exists and remove it
        if xbmcvfs.exists(tempdir):
            xbmcvfs.rmdir(tempdir)
            log('Removing temp folder from previous aborted run.')
            xbmc.sleep(5000)
        # Run script when enabled and check on existence of tempdir.
        # This because it is possible that script was running even when we previously deleted it.
        # Could happen when switching profiles and service gets triggered again
        if setting.get('service_startup') and not xbmcvfs.exists(tempdir):
            xbmc.executebuiltin('XBMC.AlarmClock(ArtworkDownloader,XBMC.RunScript(script.artwork.downloader,silent=true),00:%s:15,silent)' % setting.get('setting.service_startupdelay')) 
        if setting.get('service_enable'):
            while (not xbmc.abortRequested):
                xbmc.sleep(5000)
                if not(time.strftime('%H:%M') == service_runtime):
                    pass
                else:
                    if not xbmcvfs.exists(tempdir):
                        log('Time is %s:%s, Scheduled run starting' % (time.strftime('%H'), time.strftime('%M')))
                        xbmc.executebuiltin('XBMC.RunScript(script.artwork.downloader,silent=true)')
                        # Because we now use the commoncache module the script is run so fast it is possible it is started twice
                        # within the one minute window. So keep looping until it goes out of that window
                        while (not xbmc.abortRequested and time.strftime('%H:%M') == service_runtime):
                            xbmc.sleep(5000)
                    else:
                        log('Addon already running, scheduled run aborted', xbmc.LOGNOTICE)
开发者ID:BiTeMeNoW,项目名称:script.artwork.downloader,代码行数:34,代码来源:service.py


示例9: extract_and_copy

	def extract_and_copy(extraction=0):
		i = 0
		for root, dirs, files in os.walk(extract_path, topdown=False):
			for file in files:
				dirfile = os.path.join(root, file)
				
				# Sanitize filenames - converting them to ASCII - and remove them from folders
				f = xbmcvfs.File(dirfile)
				temp = f.read()
				f.close()
				xbmcvfs.delete(dirfile)
				dirfile_with_path_name = os.path.relpath(dirfile, extract_path)
				dirfile_with_path_name = re.sub(r"[/\\]{1,2}","-", dirfile_with_path_name)
				dirfile_with_path_name = _UNICODE(dirfile_with_path_name).encode('ascii', 'ignore')
				new_dirfile = os.path.join(extract_path, dirfile_with_path_name)
				os.write(os.open(new_dirfile, os.O_RDWR | os.O_CREAT), temp)
				
				# Get the file extention
				ext = os.path.splitext(new_dirfile)[1][1:].lower()
				if ext in sub_ext and xbmcvfs.exists(new_dirfile):
					if not new_dirfile in legendas_tmp:
						#Append the matching file
						legendas_tmp.append(new_dirfile)
				elif ext in "rar zip" and not extraction:
					# Extract compressed files, extracted priorly
					xbmc.executebuiltin("XBMC.Extract(%s, %s)" % (new_dirfile, extract_path))
					xbmc.sleep(1000)
					extract_and_copy(1)
				elif ext not in "idx": 
					xbmcvfs.delete(new_dirfile)
			for dir in dirs:
				dirfolder = os.path.join(root, dir)
				xbmcvfs.rmdir(dirfolder)
开发者ID:SMALLplayer,项目名称:smallplayer-image-creator,代码行数:33,代码来源:service.py


示例10: __delete_directory_alt

def __delete_directory_alt(source):
	dirs, files = xbmcvfs.listdir(source)
	for d in dirs:
		d = os.path.join(source, d)
		__delete_directory(d)
	for f in files:
		f = os.path.join(source, f)
		xbmcvfs.delete(f)
	xbmcvfs.rmdir(source)
开发者ID:bellreplace,项目名称:hautopc,代码行数:9,代码来源:utilfile.py


示例11: addon

def addon():
    dialog = xbmcgui.Dialog()
    if dialog.yesno(generic_utility.addon_name + ':', generic_utility.get_string(30307)):
        try:
            xbmcvfs.rmdir(generic_utility.data_dir(), force=True)
            generic_utility.log('Addon userdata folder deleted.')
            generic_utility.notification(generic_utility.get_string(30308))
        except Exception:
            pass
开发者ID:badcrc,项目名称:plugin.video.flix2kodi,代码行数:9,代码来源:delete.py


示例12: removeDirectory

def removeDirectory(path):
    if xbmcvfs.exists(path):
        allDirs, allFiles = xbmcvfs.listdir(path)
        for dir in allDirs:
            xbmcvfs.rmdir(os.path.join(path,dir))
        for file in allFiles:
            xbmcvfs.delete(os.path.join(path,file))
        
        xbmcvfs.rmdir(path)
开发者ID:070499,项目名称:Emby.Kodi,代码行数:9,代码来源:Utils.py


示例13: rmtree

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:andyhill1979,项目名称:xbmc,代码行数:9,代码来源:service.py


示例14: __delete_files_alt

def __delete_files_alt(source, match, del_empty):
	# delete files from source if match
	dirs, files = xbmcvfs.listdir(source)
	for f in files:
		if match == os.path.splitext(f)[0]:
			f = os.path.join(source, f)
			xbmcvfs.delete(f)
	# delete source directory if empty
	if del_empty and len(xbmcvfs.listdir(source)) == 0:
		xbmcvfs.rmdir(source)
开发者ID:bellreplace,项目名称:hautopc,代码行数:10,代码来源:utilfile.py


示例15: delete_files

def delete_files(source, match, del_empty=False):
	# delete files from source if match
	dirs, files = xbmcvfs.listdir(source)
	for f in files:
		if match in f:
			f = os.path.join(source, f)
			xbmcvfs.delete(f)
	# delete source directory if empty
	if del_empty and len(xbmcvfs.listdir(source)) == 0:
		xbmcvfs.rmdir(source)
开发者ID:jerimiah797,项目名称:script.audio.rhapsody,代码行数:10,代码来源:skincheck.py


示例16: rmtree

def rmtree(folder):
    import os
    current, dirs, files = walk(folder)

    for file in files:
        remove(os.path.join(current, file))

    for dir in dirs:
        rmtree(os.path.join(current, dir))

    xbmcvfs.rmdir(folder)
开发者ID:freeworldxbmc,项目名称:plugin.program.my-favourites-channels,代码行数:11,代码来源:sfile.py


示例17: __delete_directory_alt

def __delete_directory_alt(source):
	dirs, files = xbmcvfs.listdir(source)
	for d in dirs:
		d = os.path.join(source, d)
		if not xbmcvfs.rmdir(d):
			raise ValueError('xbmcvfs.rmdir', d)
	for f in files:
		f = os.path.join(source, f)
		xbmcvfs.delete(f)
	if not xbmcvfs.rmdir(source):
		raise ValueError('xbmcvfs.rmdir', source)
开发者ID:jvandenbroek,项目名称:script.service.afterwatch,代码行数:11,代码来源:utilfile.py


示例18: rmdir

	def rmdir(self, path, quiet=False):
		if not self.exists(path):
			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 self.confirm(msg, msg2, path): return False
		try:		
			xbmcvfs.rmdir(path)
		except Exception, e:
			xbmc.log('******** VFS error: %s' % e)
开发者ID:kelseye,项目名称:script.module.donnie,代码行数:12,代码来源:vfs.py


示例19: _rmtree

    def _rmtree(self, directory, removeSelf=False):
        self.log("Processing folder %s" % directory, level=xbmc.LOGDEBUG)

        dirs, files = xbmcvfs.listdir(directory)
        for f in files:
            fileName = os.path.join(directory, f)
            self.log(" -- delete %s" % fileName, level=xbmc.LOGDEBUG)
            xbmcvfs.delete(fileName)
        for d in dirs:
            self._rmtree(os.path.join(directory, d), removeSelf=True)
        if removeSelf:
            self.log(" -- delete %s" % directory, level=xbmc.LOGDEBUG)
            xbmcvfs.rmdir(directory)
开发者ID:afedchin,项目名称:xbmctorrent,代码行数:13,代码来源:installer.py


示例20: cleanup

def cleanup():
    if xbmcvfs.exists(tempdir):
        dialog_msg('update', percentage = 100, line1 = __localize__(32005), background =  __addon__.getSetting('background'))
        log('Cleaning up temp files')
        for x in os.listdir(tempdir):
            tempfile = os.path.join(tempdir, x)
            xbmcvfs.delete(tempfile)
            if xbmcvfs.exists(tempfile):
                log('Error deleting temp file: %s' % tempfile, xbmc.LOGERROR)
        xbmcvfs.rmdir(tempdir)
        if xbmcvfs.exists(tempdir):
            log('Error deleting temp directory: %s' % tempdir, xbmc.LOGERROR)
        else:
            log('Deleted temp directory: %s' % tempdir)
开发者ID:BiTeMeNoW,项目名称:script.artwork.downloader,代码行数:14,代码来源:fileops.py



注:本文中的xbmcvfs.rmdir函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python xbrl.XBRLParser类代码示例发布时间:2022-05-26
下一篇:
Python xbmcvfs.rename函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap