当前位置: 首页>>代码示例>>Python>>正文


Python xbmcvfs.rmdir函数代码示例

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


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


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