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


Python xbmcvfs.mkdir方法代码示例

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


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

示例1: unzip

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def unzip(path, dest, folder=None):

    ''' Unzip file. zipfile module seems to fail on android with badziperror.
    '''
    path = urllib.quote_plus(path)
    root = "zip://" + path + '/'
    
    if folder:

        xbmcvfs.mkdir(os.path.join(dest, folder))
        dest = os.path.join(dest, folder)
        root = get_zip_directory(root, folder)

    dirs, files = xbmcvfs.listdir(root)

    if dirs:
        unzip_recursive(root, dirs, dest)

    for file in files:
        unzip_file(os.path.join(root, file.decode('utf-8')), os.path.join(dest, file.decode('utf-8')))

    LOG.warn("Unzipped %s", path) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:24,代码来源:utils.py

示例2: download_external_subs

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def download_external_subs(cls, src, filename):

        ''' Download external subtitles to temp folder
            to be able to have proper names to streams.
        '''
        temp = xbmc.translatePath("special://profile/addon_data/plugin.video.emby/temp/").decode('utf-8')

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

        path = os.path.join(temp, filename)

        try:
            response = requests.get(src, stream=True, verify=False)
            response.raise_for_status()
        except Exception as e:
            raise
        else:
            response.encoding = 'utf-8'
            with open(path, 'wb') as f:
                f.write(response.content)
                del response

        return path 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:26,代码来源:playutils.py

示例3: my_streams_menu

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def my_streams_menu():
	if not os.path.exists(mystrm_folder): xbmcvfs.mkdir(mystrm_folder)
	files = os.listdir(mystrm_folder)
	if files:
		for fic in files:
			content = readfile(os.path.join(mystrm_folder,fic)).split('|')
			if content:
				if 'acestream://' in content[1] or '.acelive' in content[1] or '.torrent' in content[1]:
					addDir(content[0],content[1],1,content[2],1,False) 
				elif 'sop://' in content[1]:
					addDir(content[0],content[1],2,content[2],1,False) 
				else:
					pass
		xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_UNSORTED)
		xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL)
	addDir('[B][COLOR maroon]'+translate(30009)+'[/COLOR][/B]',MainURL,11,os.path.join(addonpath,art,'plus-menu.png'),1,False) 
开发者ID:enen92,项目名称:program.plexus,代码行数:18,代码来源:mystreams.py

示例4: batch_add_tvshows_to_library

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def batch_add_tvshows_to_library(library_folder, show):
	id = show['id']
	showname = text.to_utf8(show['seriesname'])
	show_folder = os.path.join(library_folder, str(id) + '/')
	if not xbmcvfs.exists(show_folder):
		try:
			xbmcvfs.mkdir(show_folder)
		except:
			pass
	nfo_filepath = os.path.join(show_folder, 'tvshow.nfo')
	if not xbmcvfs.exists(nfo_filepath):
		nfo_file = xbmcvfs.File(nfo_filepath, 'w')
		content = 'https://thetvdb.com/?tab=series&id=%s' % str(id)
		nfo_file.write(content)
		nfo_file.close()
	clean_needed = True
	return clean_needed 
开发者ID:a4k-openproject,项目名称:plugin.video.openmeta,代码行数:19,代码来源:lib_tvshows.py

示例5: mkdir

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def mkdir(path, recursive=False):
	if exists(path):
		if debug:
			xbmc.log('******** VFS mkdir notice: %s exists' % path)
		return False
	if recursive:
		try:
			return xbmcvfs.mkdirs(path)
		except Exception as e:
			xbmc.log('******** VFS error: %s' % e)
			return False
	else:
		try:
			return xbmcvfs.mkdir(path)
		except Exception as e:
			xbmc.log('******** VFS error: %s' % e)
			return False 
开发者ID:tvaddonsco,项目名称:plugin.git.browser,代码行数:19,代码来源:vfs.py

示例6: make_dir

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def make_dir(mypath, dirname):
    ''' Creates sub-directories if they are not found. '''
    import xbmcvfs

    if not xbmcvfs.exists(mypath):
        try:
            xbmcvfs.mkdirs(mypath)
        except:
            xbmcvfs.mkdir(mypath)

    subpath = os.path.join(mypath, dirname)

    if not xbmcvfs.exists(subpath):
        try:
            xbmcvfs.mkdirs(subpath)
        except:
            xbmcvfs.mkdir(subpath)

    return subpath


# ----------------------------------------------------------------------------------------------------------------- 
开发者ID:tvaddonsco,项目名称:plugin.program.indigo,代码行数:24,代码来源:speedtest.py

示例7: mkdir

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def mkdir(path):
    """Create a directory (using xbmcvfs)"""
    from xbmcvfs import mkdir as vfsmkdir
    log(2, "Create directory '{path}'.", path=path)
    return vfsmkdir(from_unicode(path)) 
开发者ID:emilsvennesson,项目名称:script.module.inputstreamhelper,代码行数:7,代码来源:kodiutils.py

示例8: unzip_recursive

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def unzip_recursive(path, dirs, dest):

    for directory in dirs:

        dirs_dir = os.path.join(path, directory.decode('utf-8'))
        dest_dir = os.path.join(dest, directory.decode('utf-8'))
        xbmcvfs.mkdir(dest_dir)

        dirs2, files = xbmcvfs.listdir(dirs_dir)

        if dirs2:
            unzip_recursive(dirs_dir, dirs2, dest_dir)

        for file in files:
            unzip_file(os.path.join(dirs_dir, file.decode('utf-8')), os.path.join(dest_dir, file.decode('utf-8'))) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:17,代码来源:utils.py

示例9: copy_recursive

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def copy_recursive(path, dirs, dest):

    for directory in dirs:

        dirs_dir = os.path.join(path, directory.decode('utf-8'))
        dest_dir = os.path.join(dest, directory.decode('utf-8'))
        xbmcvfs.mkdir(dest_dir)

        dirs2, files = xbmcvfs.listdir(dirs_dir)

        if dirs2:
            copy_recursive(dirs_dir, dirs2, dest_dir)

        for file in files:
            copy_file(os.path.join(dirs_dir, file.decode('utf-8')), os.path.join(dest_dir, file.decode('utf-8'))) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:17,代码来源:utils.py

示例10: verify_kodi_defaults

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def verify_kodi_defaults():

    ''' Make sure we have the kodi default folder in place.
    '''
    node_path = xbmc.translatePath("special://profile/library/video").decode('utf-8')

    if not xbmcvfs.exists(node_path):
        try:
            shutil.copytree(
                src=xbmc.translatePath("special://xbmc/system/library/video").decode('utf-8'),
                dst=xbmc.translatePath("special://profile/library/video").decode('utf-8'))
        except Exception as error:
            xbmcvfs.mkdir(node_path)

    for index, node in enumerate(['movies', 'tvshows', 'musicvideos']):
        file = os.path.join(node_path, node, "index.xml")

        if xbmcvfs.exists(file):

            try:
                xml = etree.parse(file).getroot()
            except Exception as error:
                LOG.error(error) 

                continue

            xml.set('order', str(17 + index))
            indent(xml)
            write_xml(etree.tostring(xml, 'UTF-8'), file)

    playlist_path = xbmc.translatePath("special://profile/playlists/video").decode('utf-8')

    if not xbmcvfs.exists(playlist_path):
        xbmcvfs.mkdirs(playlist_path) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:36,代码来源:views.py

示例11: get_device_id

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def get_device_id(reset=False):

    ''' Return the device_id if already loaded.
        It will load from emby_guid file. If it's a fresh
        setup, it will generate a new GUID to uniquely
        identify the setup for all users.

        window prop: emby_deviceId
    '''
    client_id = window('emby_deviceId')

    if client_id:
        return client_id

    directory = xbmc.translatePath('special://profile/addon_data/plugin.video.emby/').decode('utf-8')

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

    emby_guid = os.path.join(directory, "emby_guid")
    file_guid = xbmcvfs.File(emby_guid)
    client_id = file_guid.read()

    if not client_id or reset:
        LOG.info("Generating a new GUID.")

        client_id = str("%012X" % create_id())
        file_guid = xbmcvfs.File(emby_guid, 'w')
        file_guid.write(client_id)

    file_guid.close()

    LOG.info("DeviceId loaded: %s", client_id)
    window('emby_deviceId', value=client_id)

    return client_id 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:38,代码来源:client.py

示例12: timeout

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def timeout(function, *args, **table):
    try:
        response = None

        f = repr(function)
        f = re.sub('.+\smethod\s|.+function\s|\sat\s.+|\sof\s.+', '', f)

        a = hashlib.md5()
        for i in args: a.update(str(i))
        a = str(a.hexdigest())
    except:
        pass

    try:
        table = table['table']
    except:
        table = 'rel_list'

    try:
        xbmcvfs.mkdir(dataPath)
        dbcon = database.connect(os.path.join(dataPath, 'cache.db'))
        dbcur = dbcon.cursor()
        dbcur.execute("SELECT * FROM %s WHERE func = '%s' AND args = '%s'" % (table, f, a))
        match = dbcur.fetchone()
        return int(match[3])
    except:
        return 
开发者ID:bugatsinho,项目名称:bugatsinho.github.io,代码行数:29,代码来源:cache.py

示例13: traverse

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
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:ddurdle,项目名称:ownCloud-for-KODI,代码行数:33,代码来源:cloudservice.py

示例14: my_streams_menu

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def my_streams_menu():
	if not os.path.exists(mystrm_folder): xbmcvfs.mkdir(mystrm_folder)
	files = os.listdir(mystrm_folder)
	if files:
		for fic in files:
			content = readfile(os.path.join(mystrm_folder,fic)).split('|')
			if content:
				if 'acestream://' in content[1] or '.acelive' in content[1] or '.torrent' in content[1]:
					addDir(content[0],content[1],1,content[2],1,False) 
				elif 'sop://' in content[1]:
					addDir(content[0],content[1],2,content[2],1,False) 
				else:
					pass
	addDir('[B][COLOR maroon]'+translate(30009)+'[/COLOR][/B]',MainURL,11,os.path.join(addonpath,art,'plus-menu.png'),1,False) 
开发者ID:tvaddonsco,项目名称:program.plexus,代码行数:16,代码来源:mystreams.py

示例15: __init__

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import mkdir [as 别名]
def __init__(self):
        # Initialize the subreddits db file if doesn't exist
        if not os.path.exists(_subreddits_file):
            xbmcvfs.mkdir(_dataPath)
            self.conn = self.initialize_db()
        else:
            self.conn = database.connect(_subreddits_file) 
开发者ID:iwannabelikemike,项目名称:plugin.video.sparkle,代码行数:9,代码来源:subreddit_lists.py


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