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


Python xbmcvfs.copy方法代码示例

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


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

示例1: __copyLauncherScriptsToUserdata

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def __copyLauncherScriptsToUserdata(self):
        log.info('__copyLauncherScriptsToUserdata')

        oldBasePath = os.path.join(util.getAddonInstallPath(), 'resources', 'scriptfiles')
        newBasePath = os.path.join(util.getAddonDataPath(), 'scriptfiles')

        files = []
        # Copy applaunch shell script/batch file
        if self.env == 'win32':
            files.append('applaunch.bat')
        else:
            files.append('applaunch.sh')

        # Copy VBS files
        if self.env == 'win32' and __addon__.getSetting(util.SETTING_RCB_USEVBINSOLOMODE).lower() == 'true':
            files += ['applaunch-vbs.bat', 'LaunchKodi.vbs', 'Sleep.vbs']

        for f in files:
            if not xbmcvfs.exists(os.path.join(newBasePath, f)):
                log.debug("Copying file {0} from {1} to {2}".format(f, oldBasePath, newBasePath))
                if not xbmcvfs.copy(os.path.join(oldBasePath, f), os.path.join(newBasePath, f)):
                    log.warn("Error copying file") 
开发者ID:maloep,项目名称:romcollectionbrowser,代码行数:24,代码来源:launcher.py

示例2: download_thumb

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def download_thumb(self, thumburl, destfilename):
        log.info("begin download_thumb using requests module: thumburl = %s" % thumburl)

        # Download file to tmp folder
        tmp = util.joinPath(util.getTempDir(), os.path.basename(destfilename))

        log.info("download_thumb: start downloading to temp file: %s" % tmp)
        response = requests.get(thumburl, headers=WebScraper._headers, stream=True)
        log.info("download_thumb: status code = %s" % response.status_code)
        if response.status_code != 200:
            log.info("download_thumb: invalid response status code. Can't download image.")
            return

        with open(tmp, 'wb') as f:
            response.raw.decode_content = True
            shutil.copyfileobj(response.raw, f)

        log.info("download_thumb: copy from temp file to final destination: %s" % destfilename)

        # Copy from the tmp folder to the target location
        xbmcvfs.copy(tmp, destfilename)
        xbmcvfs.delete(tmp)
        log.info("end download_thumb") 
开发者ID:maloep,项目名称:romcollectionbrowser,代码行数:25,代码来源:dbupdate.py

示例3: copySystemdFiles

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def copySystemdFiles():
    # Delete any existing openvpn.service and copy openvpn service file to config directory
    service_source = getAddonPath(True, "openvpn.service")
    service_dest = getSystemdPath("system.d/openvpn.service")
    debugTrace("Copying openvpn.service " + service_source + " to " + service_dest)
    if not fakeSystemd():
        if xbmcvfs.exists(service_dest): xbmcvfs.delete(service_dest)
        xbmcvfs.copy(service_source, service_dest)
        if not xbmcvfs.exists(service_dest): raise IOError('Failed to copy service ' + service_source + " to " + service_dest)
    
    # Delete any existing openvpn.config and copy first VPN to openvpn.config
    config_source = sudo_setting = xbmcaddon.Addon(getID()).getSetting("1_vpn_validated")
    if service_source == "": errorTrace("vpnplatform.py", "Nothing has been validated")
    config_dest = getSystemdPath("openvpn.config")
    debugTrace("Copying openvpn.config " + config_source + " to " + config_dest)
    if not fakeSystemd():
        if xbmcvfs.exists(config_dest): xbmcvfs.delete(config_dest)
        xbmcvfs.copy(config_source, config_dest)
        if not xbmcvfs.exists(config_dest): raise IOError('Failed to copy service ovpn ' + config_source + " to " + config_dest) 
开发者ID:Zomboided,项目名称:service.vpn.manager,代码行数:21,代码来源:vpnplatform.py

示例4: copyUserDefinedFiles

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def copyUserDefinedFiles():    
    # Copy everything in the user directory to the addon directory
    infoTrace("vpnproviders.py", "Copying user defined files from userdata directory")
    source_path = getUserDataPath((user_def_str)+"/")
    dest_path = getAddonPath(True, user_def_str + "/")
    # Get the list of connection profiles and another list of strings to abuse for the selection screen    
    try:
        files = getUserDataList(user_def_str, "*")
        if len(files) == 0:
            errorTrace("vpnproviders.py", "No User Defined files available to copy from " + source_path)
            return False
        for file in files:
            name = file[file.rfind(getSeparator())+1:]
            dest_file = dest_path + getSeparator() + name
            xbmcvfs.copy(file, dest_file)
            if not xbmcvfs.exists(dest_file): raise IOError('Failed to copy user def file ' + file + " to " + dest_file)
        return True
    except Exception as e:
        errorTrace("vpnproviders.py", "Error copying files from " + source_path + " to " + dest_path)
        errorTrace("vpnproviders.py", str(e))
        return False 
开发者ID:Zomboided,项目名称:service.vpn.manager,代码行数:23,代码来源:vpnproviders.py

示例5: populateSupportingFromGit

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def populateSupportingFromGit(vpn_provider):
    # Copy all files from download to the directory that are not .ovpn, ignoring the metadata
    try:
        filelist = getDownloadList(vpn_provider, "*")
        debugTrace("Copying supporting files into addon directory for " + vpn_provider)
        for file in filelist:
            if not file.endswith(".ovpn") and not file.endswith("METADATA.txt"):
                name = os.path.basename(file)
                fullname = getAddonPath(True, vpn_provider + "/" + name)
                xbmcvfs.copy(file, fullname)
                if not xbmcvfs.exists(fullname): raise IOError('Failed to copy supporting file ' + file + " to " + fullname)
        return True
    except Exception as e:
        errorTrace("vpnproviders.py", "Can't copy " + file + " for VPN " + vpn_provider)
        errorTrace("vpnproviders.py", str(e))
        return False 
开发者ID:Zomboided,项目名称:service.vpn.manager,代码行数:18,代码来源:vpnproviders.py

示例6: fix_update

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def fix_update():
    if os.path.exists(os.path.join(CONFIG.USERDATA, 'autoexec.py')):
        temp = os.path.join(CONFIG.USERDATA, 'autoexec_temp.py')
        if os.path.exists(temp):
            xbmcvfs.delete(temp)
        xbmcvfs.rename(os.path.join(CONFIG.USERDATA, 'autoexec.py'), temp)
    xbmcvfs.copy(os.path.join(CONFIG.PLUGIN, 'resources', 'libs', 'autoexec.py'),
                 os.path.join(CONFIG.USERDATA, 'autoexec.py'))
    dbfile = os.path.join(CONFIG.DATABASE, latest_db('Addons'))
    try:
        os.remove(dbfile)
    except:
        logging.log("Unable to remove {0}, Purging DB".format(dbfile))
        purge_db_file(dbfile)

    from resources.libs.common import tools
    tools.kill_kodi(over=True) 
开发者ID:a4k-openproject,项目名称:plugin.program.openwizard,代码行数:19,代码来源:db.py

示例7: set_indx_properties

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def set_indx_properties(self, dictionary):
        if not isinstance(dictionary, dict):
            return

        indxprops = set()
        for k, v in dictionary.items():
            if k in self.properties or k in _setprop_ratings or k in _setmain_artwork:
                continue
            try:
                v = v or ''
                self.set_property(k, v)
                indxprops.add(k)
            except Exception as exc:
                utils.kodi_log(u'k: {0} v: {1} e: {2}'.format(k, v, exc), 1)

        for k in (self.indxproperties - indxprops):
            self.clear_property(k)
        self.indxproperties = indxprops.copy() 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:20,代码来源:service.py

示例8: _rotate_file

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def _rotate_file():
    newdate = ndate = pykodi.get_infolabel('System.Date(yyyy-mm-dd)')
    count = 0
    while _exists(newdate):
        count += 1
        newdate = ndate + '.' + str(count)
    if not xbmcvfs.copy(_get_filepath(), _get_filepath(newdate)):
        log("Could not copy latest report to new filename", xbmc.LOGWARNING, 'reporting')
        return False
    if not xbmcvfs.delete(_get_filepath()):
        log("Could not delete old copy of latest report", xbmc.LOGWARNING, 'reporting')
        return False

    # delete old reports
    _, files = xbmcvfs.listdir(settings.datapath)
    reportfiles = sorted(f[:-4] for f in files if f.startswith(REPORT_NAME))
    while len(reportfiles) > REPORT_COUNT:
        filename = reportfiles[0] + '.txt'
        if not xbmcvfs.delete(settings.datapath + filename):
            log("Could not delete old report '{0}'".format(filename), xbmc.LOGWARNING, 'reporting')
            return False
        del reportfiles[0]
    report_startup()
    return True 
开发者ID:rmrector,项目名称:script.artwork.beef,代码行数:26,代码来源:reporting.py

示例9: youtubeDLDownload

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def youtubeDLDownload(self,vid,path,target=None):
        import YDStreamExtractor as StreamExtractor 
        import YDStreamUtils as StreamUtils    
        if not target: target = self.chooseDirectory()
        if not target: return
        
        with StreamUtils.DownloadProgress() as prog:
            try:
                StreamExtractor.disableDASHVideo(True)
                StreamExtractor.setOutputCallback(prog)
                result = StreamExtractor.downloadVideo(vid,path)
            finally:
                StreamExtractor.setOutputCallback(None)
        if not result and result.status != 'canceled':
                xbmcgui.Dialog().ok(T(32103),'[CR]',result.message)
        elif result:
            xbmcgui.Dialog().ok(T(32062),T(32104),'[CR]',result.filepath)
        if target:
            xbmcvfs.copy(result.filepath,os.path.join(target,os.path.basename(result.filepath)))
            xbmcvfs.delete(result.filepath) 
开发者ID:elbowz,项目名称:xbmc.service.pushbullet,代码行数:22,代码来源:util.py

示例10: convert

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def convert(path):
    input = xbmcvfs.File(path,'rb')
    output = xbmcvfs.File(path.replace('.ts','.mp4'),'wb')
    error = open(xbmc.translatePath("special://profile/addon_data/plugin.video.iptv.recorder/errors.txt"),"w")

    cmd = [ffmpeg_location(),"-fflags","+genpts","-y","-i","-","-vcodec","copy","-acodec","copy","-f", "mpegts", "-"]
    p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=error, shell=windows())
    t = threading.Thread(target=read_thread,args=[p,output])
    t.start()

    while True:
        data = input.read(100000)
        log(("read",len(data)))
        if not data:
            break
        p.stdin.write(data)
    p.stdin.close()
    error.close() 
开发者ID:primaeval,项目名称:plugin.video.iptv.recorder,代码行数:20,代码来源:main.py

示例11: copy

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

示例12: unzip_file

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

    ''' Unzip specific file. Path should start with zip://
    '''
    xbmcvfs.copy(path, dest)
    LOG.debug("unzip: %s to %s", path, dest) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:8,代码来源:utils.py

示例13: copy_file

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

    ''' Copy specific file.
    '''
    if path.endswith('.pyo'):
        return

    xbmcvfs.copy(path, dest)
    LOG.debug("copy: %s to %s", path, dest) 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:11,代码来源:utils.py

示例14: get_video_extras

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def get_video_extras(item_id, path, server_id=None):

    ''' Returns the video files for the item as plugin listing, can be used
        to browse actual files or video extras, etc.
    '''
    if not item_id and 'plugin.video.emby' in path:
        item_id = path.split('/')[-2]

    if not item_id:
        return

    get_server(server_id)
    item = EMBY['api'].get_item(item_id)
    # TODO

    """
    def getVideoFiles(embyId,embyPath):
        #returns the video files for the item as plugin listing, can be used for browsing the actual files or videoextras etc.
        emby = embyserver.Read_EmbyServer()
        if not embyId:
            if "plugin.video.emby" in embyPath:
                embyId = embyPath.split("/")[-2]
        if embyId:
            item = emby.getItem(embyId)
            putils = playutils.PlayUtils(item)
            if putils.isDirectPlay():
                #only proceed if we can access the files directly. TODO: copy local on the fly if accessed outside
                filelocation = putils.directPlay()
                if not filelocation.endswith("/"):
                    filelocation = filelocation.rpartition("/")[0]
                dirs, files = xbmcvfs.listdir(filelocation)
                for file in files:
                    file = filelocation + file
                    li = xbmcgui.ListItem(file, path=file)
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=file, listitem=li)
                for dir in dirs:
                    dir = filelocation + dir
                    li = xbmcgui.ListItem(dir, path=dir)
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=dir, listitem=li, isFolder=True)
        #xbmcplugin.endOfDirectory(int(sys.argv[1]))
    """ 
开发者ID:MediaBrowser,项目名称:plugin.video.emby,代码行数:43,代码来源:default.py

示例15: ffmpeg_location

# 需要导入模块: import xbmcvfs [as 别名]
# 或者: from xbmcvfs import copy [as 别名]
def ffmpeg_location():
    ffmpeg_src = xbmc.translatePath(ADDON.getSetting('autoplaywiths.ffmpeg'))

    if xbmc.getCondVisibility('system.platform.android'):
        ffmpeg_dst = '/data/data/%s/ffmpeg' % android_get_current_appid()

        if (ADDON.getSetting('autoplaywiths.ffmpeg') != ADDON.getSetting('ffmpeg.last')) or (not xbmcvfs.exists(ffmpeg_dst) and ffmpeg_src != ffmpeg_dst):
            xbmcvfs.copy(ffmpeg_src, ffmpeg_dst)
            ADDON.setSetting('ffmpeg.last',ADDON.getSetting('autoplaywiths.ffmpeg'))

        ffmpeg = ffmpeg_dst
    else:
        ffmpeg = ffmpeg_src

    if ffmpeg:
        try:
            st = os.stat(ffmpeg)
            if not (st.st_mode & stat.S_IXUSR):
                try:
                    os.chmod(ffmpeg, st.st_mode | stat.S_IXUSR)
                except:
                    pass
        except:
            pass
    if xbmcvfs.exists(ffmpeg):
        return ffmpeg
    else:
        xbmcgui.Dialog().notification("TVGF", "ffmpeg exe not found!") 
开发者ID:primaeval,项目名称:script.tvguide.fullscreen,代码行数:30,代码来源:playwithchannel.py


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