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

Python xbmcvfs.mkdir函数代码示例

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

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



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

示例1: add_to_addon_favourites

def add_to_addon_favourites(name,url,iconimage):
	name = name.replace("[b]","").replace("[/b]","").replace("[color orange]","").replace("[/color]","").replace("[B]","").replace("[/B]","")
	if "runplugin" in url:
		match = re.compile("url=(.+?)&mode=(.+?)&").findall(url.replace(";",""))
		for url,mode in match:
			favourite_text = str(name) + " (" + str(url) + ")|" + str(mode) + "|" + str(url) + '|' + str(iconimage)
			favouritetxt = os.path.join(pastaperfil,"Favourites",url.replace(":","").replace("/","") + ".txt")
			if not xbmcvfs.exists(os.path.join(pastaperfil,"Favourites")): xbmcvfs.mkdir(os.path.join(pastaperfil,"Favourites"))
			save(favouritetxt, favourite_text)
			xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(40148), 1,addonpath+"/icon.png"))
	else:
		if "sop://" in url:
			tipo = "sopcast"
			if not iconimage: iconimage = os.path.join(addonpath,'resources','art','sopcast_logo.jpg')
		elif "acestream://" in url:
			tipo = "acestream"
			if not iconimage: iconimage = os.path.join(addonpath,'resources','art','acelogofull.jpg')
		elif ".torrent" in url:
			tipo = "acestream"
			if not iconimage: iconimage = os.path.join(addonpath,'resources','art','acelogofull.jpg')
		elif ".acelive" in url:
			tipo = "acestream"
			if not iconimage: iconimage = os.path.join(addonpath,'resources','art','acelogofull.jpg')		
		else:
			if len(url) < 30: tipo = "sopcast"
			else: tipo = "acestream"
		if tipo == "sopcast":
			favourite_text = str(name) + " (" + str(url) + ")|" + str(2) + "|" + str(url) + '|' + str(iconimage)
		elif tipo == "acestream":
			favourite_text = str(name) + " (" + str(url) + ")|" + str(1) + "|" + str(url) + '|' + str(iconimage) 
		favouritetxt = os.path.join(pastaperfil,"Favourites",url.replace(":","").replace("/","") + ".txt")
		if not xbmcvfs.exists(os.path.join(pastaperfil,"Favourites")): xbmcvfs.mkdir(os.path.join(pastaperfil,"Favourites"))
		save(favouritetxt, favourite_text)
		xbmc.executebuiltin("Notification(%s,%s,%i,%s)" % (translate(40000), translate(40148), 1,addonpath+"/icon.png"))
		xbmc.executebuiltin("Container.Refresh")
开发者ID:Alsocogi,项目名称:repository.catoal,代码行数:35,代码来源:favourites.py


示例2: addSeriesToLibrary

def addSeriesToLibrary(seriesID, seriesTitle, season, singleUpdate=True):
    seriesFolderName = (''.join(c for c in unicode(seriesTitle, 'utf-8') if c not in '/\\:?"*|<>')).strip(' .')
    seriesDir = os.path.join(libraryFolderTV, seriesFolderName)
    if not os.path.isdir(seriesDir):
        xbmcvfs.mkdir(seriesDir)
    content = getSeriesInfo(seriesID)
    content = json.loads(content)
    for test in content["episodes"]:
        for item in test:
            episodeSeason = str(item["season"])
            seasonCheck = True
            if season:
                seasonCheck = episodeSeason == season
            if seasonCheck:
                seasonDir = os.path.join(seriesDir, "Season "+episodeSeason)
                if not os.path.isdir(seasonDir):
                    xbmcvfs.mkdir(seasonDir)
                episodeID = str(item["episodeId"])
                episodeNr = str(item["episode"])
                episodeTitle = item["title"].encode('utf-8')
                if len(episodeNr) == 1:
                    episodeNr = "0"+episodeNr
                seasonNr = episodeSeason
                if len(seasonNr) == 1:
                    seasonNr = "0"+seasonNr
                filename = "S"+seasonNr+"E"+episodeNr+" - "+episodeTitle+".strm"
                filename = (''.join(c for c in unicode(filename, 'utf-8') if c not in '/\\:?"*|<>')).strip(' .')
                fh = xbmcvfs.File(os.path.join(seasonDir, filename), 'w')
                fh.write("plugin://plugin.video.netflixbmc/?mode=playVideo&url="+episodeID)
                fh.close()
    if updateDB and singleUpdate:
        xbmc.executebuiltin('UpdateLibrary(video)')
开发者ID:DayVeeBoi,项目名称:addonscriptorde-beta-repo,代码行数:32,代码来源:default.py


示例3: traverse

    def traverse(self, path, cacheType, folderID, savePublic, level):
        import os
        import xbmcvfs

        xbmcvfs.mkdir(path)

        folders = self.getFolderList(folderID)
        files = self.getMediaList(folderID,cacheType)

        if files:
            for media in files:
                filename = xbmc.translatePath(os.path.join(path, media.title+'.strm'))
                strmFile = open(filename, "w")

                strmFile.write(self.PLUGIN_URL+'?mode=streamURL&url=' + self.FILE_URL+ media.id +'\n')
                strmFile.close()

        if folders and level == 1:
            count = 1
            progress = xbmcgui.DialogProgress()
            progress.create(self.addon.getLocalizedString(30000),self.addon.getLocalizedString(30036),'\n','\n')

            for folder in folders:
                max = len(folders)
                progress.update(count/max*100,self.addon.getLocalizedString(30036),folder.title,'\n')
                self.traverse( path+'/'+folder.title + '/',cacheType,folder.id,savePublic,0)
                count = count + 1

        if folders and level == 0:
            for folder in folders:
                self.traverse( path+'/'+folder.title + '/',cacheType,folder.id,savePublic,0)
开发者ID:JoKeRzBoX,项目名称:KODI-Hive,代码行数:31,代码来源:cloudservice.py


示例4: blur

def blur(input_img, radius=25):
    if not input_img:
        return {}
    if not xbmcvfs.exists(IMAGE_PATH):
        xbmcvfs.mkdir(IMAGE_PATH)
    input_img = utils.translate_path(urllib.unquote(input_img.encode("utf-8")))
    input_img = input_img.replace("image://", "").rstrip("/")
    cachedthumb = xbmc.getCacheThumbName(input_img)
    filename = "%s-radius_%i.png" % (cachedthumb, radius)
    targetfile = os.path.join(IMAGE_PATH, filename)
    vid_cache_file = os.path.join("special://profile/Thumbnails/Video", cachedthumb[0], cachedthumb)
    cache_file = os.path.join("special://profile/Thumbnails", cachedthumb[0], cachedthumb[:-4] + ".jpg")
    if xbmcvfs.exists(targetfile):
        img = PIL.Image.open(targetfile)
        return {"ImageFilter": targetfile,
                "ImageColor": get_colors(img)}
    try:
        if xbmcvfs.exists(cache_file):
            utils.log("image already in xbmc cache: " + cache_file)
            img = PIL.Image.open(utils.translate_path(cache_file))
        elif xbmcvfs.exists(vid_cache_file):
            utils.log("image already in xbmc video cache: " + vid_cache_file)
            img = PIL.Image.open(utils.translate_path(vid_cache_file))
        else:
            xbmcvfs.copy(input_img, targetfile)
            img = PIL.Image.open(targetfile)
        img.thumbnail((200, 200), PIL.Image.ANTIALIAS)
        imgfilter = MyGaussianBlur(radius=radius)
        img = img.convert('RGB').filter(imgfilter)
        img.save(targetfile)
    except Exception:
        utils.log("Could not get image for %s" % input_img)
        return {}
    return {"ImageFilter": targetfile,
            "ImageColor": get_colors(img)}
开发者ID:phil65,项目名称:script.module.kodi65,代码行数:35,代码来源:imagetools.py


示例5: series

def series(series_id, series_title, season, single_update=True):
    filename = utility.clean_filename(series_title, ' .')
    series_file = xbmc.translatePath(utility.tv_dir() + filename)
    if not xbmcvfs.exists(series_file):
        xbmcvfs.mkdir(series_file)
    content = get.series_info(series_id)
    content = json.loads(content)['video']['seasons']
    for test in content:
        episode_season = unicode(test['seq'])
        if episode_season == season or season == '':
            season_dir = utility.create_pathname(series_file, test['title'])
            if not xbmcvfs.exists(season_dir):
                xbmcvfs.mkdir(season_dir)
            for item in test['episodes']:
                episode_id = unicode(item['episodeId'])
                episode_nr = unicode(item['seq'])
                episode_title = item['title']
                if len(episode_nr) == 1:
                    episode_nr = '0' + episode_nr
                season_nr = episode_season
                if len(season_nr) == 1:
                    season_nr = '0' + season_nr
                filename = 'S' + season_nr + 'E' + episode_nr + ' - ' + episode_title + '.strm'
                filename = utility.clean_filename(filename, ' .')
                file_handler = xbmcvfs.File(utility.create_pathname(season_dir, filename), 'w')
                file_handler.write(
                    utility.encode('plugin://%s/?mode=play_video&url=%s' % (utility.addon_id, episode_id)))
                file_handler.close()
    if utility.get_setting('update_db') and single_update:
        xbmc.executebuiltin('UpdateLibrary(video)')
开发者ID:hennroja,项目名称:plugin.video.netflix,代码行数:30,代码来源:library.py


示例6: download

def download(name, url):
            my_addon = xbmcaddon.Addon()
            desty= my_addon.getSetting('downloads_folder')
            if not xbmcvfs.exists(desty):
                xbmcvfs.mkdir(desty)

            title=name
            name=re.sub('[^-a-zA-Z0-9_.() ]+', '', name)
            name=name.rstrip('.')
            ext = os.path.splitext(urlparse.urlparse(url).path)[1][1:]
            if not ext in ['mp4', 'mkv', 'flv', 'avi', 'mpg', 'mp3']: ext = 'mp4'
            filename = name + '.' + ext
      
            

            dest = os.path.join(desty, filename)
            new=my_addon.getSetting('new_downloader')
            if  new=='false':
                from lib.modules import commondownloader
                commondownloader.download(url, dest, 'Croatia On Demand')
            else:
                content = int(urllib.urlopen(url).info()['Content-Length'])
                size = 1024 * 1024
                mb   = content / (1024 * 1024)
                if xbmcgui.Dialog().yesno('Croatia On Demand - Potvrda preuzimanja', filename, 'Veličina datoteke je %dMB' % mb, 'Nastaviti s preuzimanjem?', 'Nastavi',  'Prekini') == 1:
                  return
                import SimpleDownloader as downloader
                downloader = downloader.SimpleDownloader()
                params = { "url": url, "download_path": desty, "Title": title }
                downloader.download(filename, params)
开发者ID:corpusculus,项目名称:kodi_serije,代码行数:30,代码来源:utils.py


示例7: write_strm

def write_strm(name, fold, videoid, show=None, season=None, episode=None, startpoint = None, endpoint = None, artist='', album='', song='', year='', type=''):
    #dev.log('strm('+name+', '+fold+', '+videoid+')')
    movieLibrary = vars.tv_folder #The path we should save in is the vars.tv_folder setting from the addon settings
    if type=='musicvideo':
        movieLibrary = vars.musicvideo_folder
    sysname = urllib.quote_plus(videoid) #Escape strings in the videoid if needed
    enc_name = dev.legal_filename(name) #Encode the filename to a legal filename
    
    if vars.__settings__.getSetting("strm_link") == "Youtube Library":
        if type == 'musicvideo':
            content = 'plugin://plugin.video.youtubelibrary/?mode=playmusicvideo'
            if startpoint != None:
                content += '&startpoint='+startpoint
            if endpoint != None:
                content += '&endpoint='+endpoint
            content += '&id=%s&artist=%s&song=%s&album=%s&year=%s&filename=%s' % (sysname, artist, song, album, year, enc_name) #Set the content of the strm file with a link back to this addon for playing the video 
        else:
            content = 'plugin://plugin.video.youtubelibrary/?mode=play&id=%s&show=%s&season=%s&episode=%s&filename=%s' % (sysname, show, season, episode, enc_name) #Set the content of the strm file with a link back to this addon for playing the video
    else:
        content = vars.KODI_ADDONLINK+'%s' % ( sysname) #Set the content of the strm file with a link to the official Kodi Youtube Addon

    xbmcvfs.mkdir(movieLibrary) #Create the maindirectory if it does not exists yet
    
    folder = os.path.join(movieLibrary, fold) #Set the folder to the maindir/dir
    xbmcvfs.mkdir(folder) #Create this subfolder if it does not exist yet

    stream = os.path.join(folder, enc_name + '.strm') #Set the file to maindir/name/name.strm
    file = xbmcvfs.File(stream, 'w') #Open / create this file for writing
    file.write(str(content.encode('UTF-8'))) #Write the content in the file
    file.close() #Close the file
    dev.log('write_strm: Written strm file: '+fold+'/'+enc_name+'.strm')
    return enc_name
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:32,代码来源:generators.py


示例8: _readHosts

    def _readHosts(self):
        data_dir = utils.data_dir()

        if(not xbmcvfs.exists(data_dir)):
            xbmcvfs.mkdir(data_dir)

        try:
            doc = xml.dom.minidom.parse(xbmc.translatePath(data_dir + "hosts.xml"))

            for node in doc.getElementsByTagName("host"):
                self.hosts.append(XbmcHost(str(node.getAttribute("name")),str(node.getAttribute("address")),int(node.getAttribute("port"))))

            #sort the lists
            self._sort()
            
        except IOError:
            #the file doesn't exist, create it
            doc = xml.dom.minidom.Document()
            rootNode = doc.createElement("hosts")
            doc.appendChild(rootNode)

            #write the file
            f = open(xbmc.translatePath(data_dir + "hosts.xml"),'w')
            doc.writexml(f,"   ")
            f.close()
开发者ID:bstrdsmkr,项目名称:script.sendto,代码行数:25,代码来源:hostmanager.py


示例9: makeM3U

def makeM3U(links):
    log("makeM3U")
    STRM_CACHE_LOC = xbmc.translatePath(get_setting("write_folder"))
    if not xbmcvfs.exists(STRM_CACHE_LOC):
        xbmcvfs.mkdir(STRM_CACHE_LOC)
    flepath = os.path.join(STRM_CACHE_LOC, "ustvnow.m3u")
    if xbmcvfs.exists(flepath):
        xbmcvfs.delete(flepath)
    playlist = open(flepath, "w")
    # Extended M3U format used here
    playlist.write("#EXTM3U" + "\n")
    if links:
        for l in links:
            # Add name based filename
            if int(get_setting("write_type")) == 3:
                playlist.write(
                    '#EXTINF:-1, tvg-id="'
                    + l["name"]
                    + '" tvg-logo="'
                    + l["name"]
                    + '" tvg-name="'
                    + l["name"]
                    + '"  group-title="USTVnow",'
                    + l["name"]
                    + "\n"
                )
            else:
                playlist.write("#EXTINF:" + l["name"] + "\n")
            # Write relative location of file
            playlist.write(l["url"] + "\n")
    playlist.close()
开发者ID:bialagary,项目名称:mw,代码行数:31,代码来源:Addon.py


示例10: __handleCompressedFile

	def __handleCompressedFile(self, gui, filext, rom, emuParams):

		log.info("__handleCompressedFile")

		# Note: Trying to delete temporary files (from zip or 7z extraction) from last run
		# Do this before launching a new game. Otherwise game could be deleted before launch
		tempDir = os.path.join(util.getTempDir(), 'extracted', self.romCollection.name)
		# check if folder exists
		if not xbmcvfs.exists(tempDir +'\\'):
			log.info("Create temporary folder: " +tempDir)
			xbmcvfs.mkdir(tempDir)

		try:
			if xbmcvfs.exists(tempDir +'\\'):
				log.info("Trying to delete temporary rom files")
				#can't use xbmcvfs.listdir here as it seems to cache the file list and RetroPlayer won't find newly created files anymore
				files = os.listdir(tempDir)
				for f in files:
					#RetroPlayer places savestate files next to the roms. Don't delete these files.
					fname, ext = os.path.splitext(f)
					if(ext not in ('.sav', '.xml', '.png')):
						xbmcvfs.delete(os.path.join(tempDir, f))
		except Exception, (exc):
			log.error("Error deleting files after launch emu: " + str(exc))
			gui.writeMsg(util.localize(32036) + ": " + str(exc))
开发者ID:bruny,项目名称:romcollectionbrowser,代码行数:25,代码来源:launcher.py


示例11: setThumbnail

    def setThumbnail(self, service, url=''):
        if self.cachePath == '':
            cachePath = service.settings.cachePath
        else:
            cachePath = self.cachePath

        if cachePath == '':
            cachePath = xbmcgui.Dialog().browse(0,service.addon.getLocalizedString(30136), 'files','',False,False,'')
            service.addon.setSetting('cache_folder', cachePath)
            self.cachePath = cachePath

        if url == '':
            url = self.package.file.thumbnail

        #simply no thumbnail
        if url == '':
            return ""

        cachePath = str(cachePath) + str(self.package.file.id) + '/'
        if not xbmcvfs.exists(cachePath):
            xbmcvfs.mkdir(cachePath)
        if not xbmcvfs.exists(cachePath + str(self.package.file.id) + '.jpg'):
            service.downloadPicture(url, cachePath + str(self.package.file.id) + '.jpg')
            print url
        return cachePath + str(self.package.file.id) + '.jpg'
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:25,代码来源:cache.py


示例12: __init__

	def __init__(self):
		self.folder = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile')).decode("utf-8")
		if not xbmcvfs.exists(self.folder):
			xbmcvfs.mkdir(self.folder)
		self.file_path = self.folder + "shared_data.json"
		with open(self.file_path, "w") as file:
			file.write("{}")
开发者ID:maxgalbu,项目名称:xbmc.plugin.video.nba,代码行数:7,代码来源:shareddata.py


示例13: addToLibrary

def addToLibrary(url):
    if mysettings.getSetting("cust_Lib_path") == "true":
        newlibraryFolderMovies = custLibFolder
    else:
        newlibraryFolderMovies = libraryFolderMovies
    movieFolderName = ("".join(c for c in unicode(gname, "utf-8") if c not in '/\\:?"*|<>')).strip(" .")
    newMovieFolderName = ""
    finalName = ""
    keyb = xbmc.Keyboard(name, "[COLOR ffffd700]Enter Title[/COLOR]")
    keyb.doModal()
    if keyb.isConfirmed():
        newMovieFolderName = keyb.getText()
    if newMovieFolderName != "":
        dir = os.path.join(newlibraryFolderMovies, newMovieFolderName)
        finalName = newMovieFolderName
    else:
        dir = os.path.join(newlibraryFolderMovies, movieFolderName)
        finalName = movieFolderName

    if not os.path.isdir(dir):
        xbmcvfs.mkdir(dir)
        fh = xbmcvfs.File(os.path.join(dir, finalName + ".strm"), "w")
        fh.write(
            "plugin://" + addonID + "/?mode=3&url=" + urllib.quote_plus(url) + "&name=" + urllib.quote_plus(finalName)
        )
        fh.close()
开发者ID:quyletran,项目名称:traitravinh.repository.xbmc,代码行数:26,代码来源:movihd.py


示例14: _moveToThemeFolder

    def _moveToThemeFolder(self, directory):
        log("moveToThemeFolder: path = %s" % directory)

        # Handle the case where we have a disk image
        if (os_path_split(directory)[1] == 'VIDEO_TS') or (os_path_split(directory)[1] == 'BDMV'):
            directory = os_path_split(directory)[0]

        dirs, files = list_dir(directory)
        for aFile in files:
            m = re.search(Settings.getThemeFileRegEx(directory), aFile, re.IGNORECASE)
            if m:
                srcpath = os_path_join(directory, aFile)
                log("fetchAllMissingThemes: Found match: %s" % srcpath)
                targetpath = os_path_join(directory, Settings.getThemeDirectory())
                # Make sure the theme directory exists
                if not dir_exists(targetpath):
                    try:
                        xbmcvfs.mkdir(targetpath)
                    except:
                        log("fetchAllMissingThemes: Failed to create directory: %s" % targetpath, True, xbmc.LOGERROR)
                        break
                else:
                    log("moveToThemeFolder: directory already exists %s" % targetpath)
                # Add the filename to the path
                targetpath = os_path_join(targetpath, aFile)
                if not xbmcvfs.rename(srcpath, targetpath):
                    log("moveToThemeFolder: Failed to move file from %s to %s" % (srcpath, targetpath))
开发者ID:angelblue05,项目名称:script.tvtunes,代码行数:27,代码来源:plugin.py


示例15: installPy7ForAndroid

def installPy7ForAndroid():
    if not os.path.exists(pastaperfil): xbmcvfs.mkdir(pastaperfil)
    #Hack to get xbmc app id
    xbmcfolder=xbmc.translatePath(addonpath).split("/")
    found = False
    if 1==1:#settings.getSetting('auto_appid') == 'true':
        i = 0
        for folder in xbmcfolder:
            if folder.count('.') >= 2 and folder != addon_id :
                found = True
                break
            else:
                i+=1
        if found == True:
            uid = os.getuid()
            app_id = xbmcfolder[i]
    else:
        if settings.getSetting('custom_appid') != '':
            uid = os.getuid()
            app_id = settings.getSetting('custom_appid')
            found = True

    if found == True:
        settings.setSetting('app_id',app_id)
        if "arm" in os.uname()[4]:
            python7bundle = os.path.join(pastaperfil,python7_apk_arm.split("/")[-1])
            download_tools().Downloader(python7_apk_arm,python7bundle,"downloading python7 for Android Arm","pycrypto")
        else:
            python7bundle = os.path.join(pastaperfil,python7_apk_x86.split("/")[-1])
            download_tools().Downloader(python7_apk_x86,python7bundle,"downloading python7 for Android x86","pycrypto")
        if tarfile.is_tarfile(python7bundle):
            download_tools().extract(python7bundle,pastaperfil)
            download_tools().remove(python7bundle)
        python7folder = os.path.join(pastaperfil,"python7")
        xbmc_data_path = os.path.join("/data", "data", app_id)
        if os.path.exists(xbmc_data_path) and uid == os.stat(xbmc_data_path).st_uid:
            android_binary_dir = os.path.join(xbmc_data_path, "files", app_id)
            if not os.path.exists(android_binary_dir): os.makedirs(android_binary_dir)
                android_exec_folder = os.path.join(android_binary_dir,"python7")
                if not os.path.exists(android_exec_folder): os.makedirs(android_exec_folder)
                else:
                    #clean install for android - delete old folder
                    print android_exec_folder
                    try:
                        os.system("chmod -R 777 "+android_exec_folder+"/*")
                        os.system("rm -r '"+android_exec_folder+"'")
                    except: pass
                    try: os.makedirs(android_exec_folder)
                    except: pass
                xbmc.sleep(200)
        recursive_overwrite(python7folder, android_exec_folder, ignore=None)
        pythonbin = os.path.join(android_exec_folder,"python","bin","python")
        st = os.stat(pythonbin)
        import stat
        os.chmod(pythonbin, st.st_mode | stat.S_IEXEC)
        if os.path.exists(python7folder):
        try:
            os.system("chmod -R 777 "+python7folder+"/*")
            os.system("rm -r '"+python7folder+"'")
        except: pass                
开发者ID:Amoktaube,项目名称:ShaniXBMCWork2,代码行数:60,代码来源:python7Android.py


示例16: download

 def download(self , theme_url , path):
     log( "### download :" + theme_url )
     tmpdestination = xbmc.translatePath( 'special://profile/addon_data/%s/temp/%s' % ( __addonid__ , self.theme_file ) )
     destination = os.path.join( path , self.theme_file )
     try:
         def _report_hook( count, blocksize, totalsize ):
             percent = int( float( count * blocksize * 100 ) / totalsize )
             strProgressBar = str( percent )
             self.DIALOG_PROGRESS.update( percent , str(__language__(32110)) + ' ' + theme_url , str(__language__(32111)) + ' ' + destination )
         if not xbmcvfs.exists(path):
             try:
                 xbmcvfs.mkdir(path)
             except:
                 log( "problem with path: %s" % destination )
         fp , h = urllib.urlretrieve( theme_url , tmpdestination , _report_hook )
         log( h )
         copy = xbmcvfs.copy(tmpdestination, destination)
         if copy:
             log( "### copy successful" )
         else:
             log( "### copy failed" )
         xbmcvfs.delete(tmpdestination)
         return True
     except :
         log( "### Theme download Failed !!!" )
         print_exc()
         return False 
开发者ID:NaturalBornCamper,项目名称:xbmc_backgroundmusic,代码行数:27,代码来源:tvtunes_scraper.py


示例17: list_favourites

def list_favourites():
    if not os.path.exists(datapath):
        xbmcvfs.mkdir(datapath)
    if not os.path.exists(programafav):
        xbmcvfs.mkdir(programafav)
    dirs, files = xbmcvfs.listdir(programafav)
    if files:
        totalit = len(files)
        for fich in files:
            text = readfile(os.path.join(programafav, fich))
            data = text.split("|")
            try:
                information = {"Title": data[0], "plot": data[3]}
                if "arquivo/" not in data[1]:
                    mode = 16
                else:
                    mode = 11
                addprograma(data[0], data[1], mode, data[2], totalit, information)
            except:
                pass
        xbmcplugin.setContent(int(sys.argv[1]), "tvshows")
        setview("show-view")
    else:
        msgok(translate(30001), translate(30024))
        sys.exit(0)
开发者ID:NEOhidra,项目名称:plugin.video.rtpplay,代码行数:25,代码来源:favourites.py


示例18: start

def start():
    # Set a window property that let's other scripts know we are running (window properties are cleared on kodi start)
    xbmcgui.Window(10000).setProperty(__addonid__ + '_running', 'True')

    # Try to get any system arguments
    try:
        if ( sys.argv[1] == 'true' ):
            resume = True
        else: resume = False
    except: resume = None
    try:
        if ( sys.argv[2] == 'true' ):
            monitor = True
        else: monitor = False
    except: monitor = None
    
    
    # If resume argument not supplied and we are not on home window 
    #     - assume we are enabling the addon and therefore don't want it to resume
    if ( resume == None and xbmcgui.getCurrentWindowId() != 10000 ):
        resume = False
            
    # If script data directory doesn't exist - create it and assume the script is starting for the first time
    if ( not xbmcvfs.exists(__profile_dir__) ):
        xbmcvfs.mkdir(__profile_dir__)
        firstRun = True
    else: firstRun = False

    # Create and start the main service - passing it any system arguments and first run status
    m = xr_service.Service()
    m.start(resume, monitor, firstRun)
    del m
    
    # Script finishing so clear the window running property
    xbmcgui.Window(10000).clearProperty(__addonid__ + '_running')
开发者ID:idorel77,项目名称:kodi-resume,代码行数:35,代码来源:service.py


示例19: write_xml

def write_xml(elem, dir='', output='', type=''):
    if output == '':
        output = dev.typeXml(type)
    dev.log('write_xml('+type+','+output+').')
    
    
    xbmcvfs.mkdir(vars.settingsPath) #Create the settings dir if it does not exist already
    if dir is not '': xbmcvfs.mkdir(vars.settingsPath+dir) #Create the settings dir if it does not exist already
    #Write these settings to a .xml file in the addonfolder
    output_file = os.path.join(vars.settingsPath+dir, output) #Set the outputfile to settings.xml
    
    #Creating a backup of the .xml file (in case it gets corrupted)
    backupfile = os.path.join(vars.settingsPath+dir, output+'.backup')
    if xbmcvfs.exists(output_file):
        if xbmcvfs.copy(output_file, backupfile):
            dev.log('Created a backup of the xml file at: '+backupfile)
        else:
            dev.log('Failed to create a backup of the xml file at: '+backupfile)
    else:
        dev.log(output_file+' could not be found, so not able to create a backup')
    
    
    indent( elem ) #Prettify the xml so its not on one line
    tree = ElementTree.ElementTree( elem ) #Convert the xml back to an element
    tree.write(output_file) #Save the XML in the settings file
    
    #For backup purposes, check if the xml got corrupted by writing just now
    if xml_get(type) is False:
        dev.log('corrupt .xml file')
开发者ID:csabakeszegh,项目名称:repo.plugin.video.youtubelibrary,代码行数:29,代码来源:m_xml.py


示例20: restoreColorTheme

def restoreColorTheme():
    import shutil
    import zipfile
    zip_path = None
    userThemesPath = os.path.join(userThemesDir,"themes") + os.sep
    zip_path = get_browse_dialog(dlg_type=1,heading=ADDON.getLocalizedString(32020),mask=".zip")
    if zip_path and zip_path != "protocol://":
        #create temp path
        temp_path = xbmc.translatePath('special://temp/skinbackup/').decode("utf-8")
        if xbmcvfs.exists(temp_path):
            shutil.rmtree(temp_path)
        xbmcvfs.mkdir(temp_path)
        
        #unzip to temp
        if "\\" in zip_path:
            delim = "\\"
        else:
            delim = "/"
        
        zip_temp = xbmc.translatePath('special://temp/' + zip_path.split(delim)[-1]).decode("utf-8")
        xbmcvfs.copy(zip_path,zip_temp)
        zfile = zipfile.ZipFile(zip_temp)
        zfile.extractall(temp_path)
        zfile.close()
        xbmcvfs.delete(zip_temp)
        
        dirs, files = xbmcvfs.listdir(temp_path)
        for file in files:
            if file.endswith(".theme") or file.endswith(".jpg"):
                sourcefile = os.path.join(temp_path,file)
                destfile = os.path.join(userThemesPath,file)
                xbmcvfs.copy(sourcefile,destfile)
        xbmcgui.Dialog().ok(ADDON.getLocalizedString(32022), ADDON.getLocalizedString(32021))
开发者ID:officiallybob,项目名称:script.skin.helper.service,代码行数:33,代码来源:ColorThemes.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python xbmcvfs.mkdirs函数代码示例发布时间:2022-05-26
下一篇:
Python xbmcvfs.listdir函数代码示例发布时间: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