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

Python xbmc.translatePath函数代码示例

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

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



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

示例1: MAININDEX

def MAININDEX():
    hubpath=xbmc.translatePath(os.path.join('special://home','addons','repository.xbmchub'))
    hubnotespath=xbmc.translatePath(os.path.join('special://home','addons','plugin.program.xbmchub.notifications'))
    try:
        if not os.path.exists(hubpath): HUBINSTALL('TVADDONS.AG.Repository','http://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/repository.xbmchub/repository.xbmchub-1.0.6.zip','','addon','none')
        if not os.path.exists(hubnotespath): HUBINSTALL('TVADDONS.AG.Notifications','http://offshoregit.com/xbmchub/xbmc-hub-repo/raw/master/plugin.program.xbmchub.notifications/plugin.program.xbmchub.notifications-1.0.2.zip','','addon','none')
    except: pass
    addDir('Search by: Addon/Author',base_url+'search/?keyword=','searchaddon',getArtworkJ('Search')) #catArtwork('webinterface')) #
    #if settings.getSetting('newest')=='true':  addDir('Newest Addons',base_url,'innertabs',getArtworkJ('NewestAddons'))
    #if settings.getSetting('updated')=='true':  addDir('Recently Updated',base_url,'innertabs',getArtworkJ('RecentlyUpdated'))
    #if settings.getSetting('toprepositories')=='true':  addDir('Top Developers',base_url,'toprepolist',getArtworkJ('TopDevs'))
    if settings.getSetting('featured')=='true':       	addDir('Featured Addons',base_url+'category/featured/','addonlist',getArtworkJ('Featuredaddons')) #catArtwork('featured')) #
    if settings.getSetting('video')=='true':          	addDir('Video Addons',base_url+'category/video/','addonlist',getArtworkJ('VideoAddons')) #catArtwork('video')) #
    if settings.getSetting('audio')=='true':          	addDir('Audio Addons',base_url+'category/audio/','addonlist',getArtworkJ('AudioAddons')) #catArtwork('audio')) #
    #if settings.getSetting('picture')=='true':        	addDir('Picture Addons',base_url+'category/pictures/','addonlist',getArtworkJ('PictureAddons')) #catArtwork('pictures')) #
    if settings.getSetting('program')=='true':        	addDir('Program Addons',base_url+'category/programs/','addonlist',getArtworkJ('ProgramAddons')) #catArtwork('programs')) #
    if settings.getSetting('services')=='true':       	addDir('Service Addons',base_url+'category/services/','addonlist',getArtworkJ('ServiceAddons')) #catArtwork('services')) #
    if settings.getSetting('repositories')=='true':   	addDir('Repositories',base_url+'category/repositories/','addonlist',getArtworkJ('Repositories')) #catArtwork('repositories')) #
    #if settings.getSetting('world')=='true':          	addDir('World Section',tribeca_url+'world.php','worldlist',getArtworkJ('WorldSection')) #catArtwork('metadata')) #
    if settings.getSetting('world')=='true':          	addDir('World Section',base_url+'category/international/repositories','interlist',getArtworkJ('WorldSection')) #catArtwork('video')) #
    if settings.getSetting('adult')=='true':          	addDir('Adult Addons',tribeca_url+'xxx.php','adultlist',getArtworkJ('AdultAddons')) #catArtwork('pictures')) #
    
    ForPrimeWire(); 
    #addDir(TxtAddonUpdater,base_url+'category/featured/','autoupdate',ImgAddonUpdater); 
    ##addDir(TxtAddonUpdater,'...','autoupdate2',ImgAddonUpdater); 
    addDir('Installer Settings','none','settings',getArtworkJ('InstallerSettings')); #catArtwork('programs')) #
    AUTO_VIEW('addons')
开发者ID:bialagary,项目名称:mw,代码行数:27,代码来源:defaultORIG.py


示例2: install

def install(vers,url):
    import xbmc,xbmcgui,os,re,time
    from resources.lib.modules import downloader2
    addon_folder = xbmc.translatePath('special://home/addons/script.module.streamhub/')
    path = xbmc.translatePath(os.path.join('special://home/addons','packages'))
    dp = xbmcgui.DialogProgress()
    dp.create("[COLOR red]StreamHub[/COLOR]","Installing Dependency Update v[COLOR red]%s[/COLOR]"%vers,'', 'Please Wait')
    lib=os.path.join(path, 'content.zip')
    try:
       os.remove(lib)
    except:
       pass
	   
    import shutil

    shutil.rmtree(addon_folder)
    try:
        downloader2.download(url, lib, dp)
        addonfolder = xbmc.translatePath(os.path.join('special://home','addons'))
        time.sleep(3)
    except:
        xbmcgui.Dialog().ok('[COLOR red]StreamHub[/COLOR]','Oops..Something Went Wrong Downloading The Update...Try Again')
    dp = xbmcgui.DialogProgress()
    dp.create("[COLOR red]StreamHub[/COLOR]","Installing Dependency Update Version [COLOR red]%s[/COLOR]"%vers,'', 'Please Wait')
    dp.update(0,"", "Installing... Please Wait")
    print '======================================='
    print addonfolder
    print '======================================='
    try:
        unzip(lib,addonfolder,dp)
    except:
        xbmcgui.Dialog().ok('[COLOR red]StreamHub[/COLOR]','Oops..Something Went Wrong Installing The Update...Try Again')
开发者ID:vphuc81,项目名称:MyRepository,代码行数:32,代码来源:check4update.py


示例3: GetShowBanner

 def GetShowBanner(self, show_id, update=False):
     image = None
     if show_id == '0':
         return ''
     file_path = xbmc.translatePath('special://temp/sb/cache/images/'+show_id+'.banner.jpg')
     if not os.path.exists(file_path) or update:
         # Download image from SB server.
         try:
             image = GetUrlData(url=settings.__url__+'?cmd=show.getbanner&tvdbid='+str(show_id), add_useragent=True, encodeType=None)
             if (image == None) or (len(image) < 1024):
                 # Get generic image instead.
                 with open(xbmc.translatePath('special://home/addons/plugin.video.sickrage/resources/images/missing_banner.jpg'), mode='rb') as f:
                     image = f.read()
         except Exception, e:
             settings.errorWindow(sys._getframe().f_code.co_name, self.CONNECT_ERROR+str(e))
             return ''
         # Write image file to local cache.
         try:
             if not os.path.exists(os.path.dirname(file_path)):
                 os.makedirs(os.path.dirname(file_path))
             f = open(file_path, 'wb+')
             f.write(image)
             f.close()
         except Exception, e:
             settings.errorWindow(sys._getframe().f_code.co_name, str(e))
开发者ID:maikito26,项目名称:plugin.video.sickrage,代码行数:25,代码来源:sickbeard.py


示例4: __init__

 def __init__(self):
     
     #Check if a path has been set in the addon settings
     db_path = common.addon.get_setting('local_db_location')
     if db_path:
         self.path = xbmc.translatePath(db_path)
     else:
         self.path = xbmc.translatePath('special://profile/addon_data/script.icechannel/databases')
     
     self.path = common.make_dir(self.path, '')
     
     self.db = os.path.join(self.path, self.local_db_name)
     
     # connect to db at class init and use it globally
     if DB == 'mysql':
         class MySQLCursorDict(database.cursor.MySQLCursor):
             def _row_to_python(self, rowdata, desc=None):
                 row = super(MySQLCursorDict, self)._row_to_python(rowdata, desc)
                 if row:
                     return dict(zip(self.column_names, row))
                 return None
         self.dbcon = database.connect(database=common.addon.get_setting('db_name'), user=common.addon.get_setting('db_user'), 
             password=common.addon.get_setting('db_pass'), host=common.addon.get_setting('db_address'), buffered=True, charset='utf8')                
         self.dbcur = self.dbcon.cursor(cursor_class=MySQLCursorDict, buffered=True)
     else:
         self.dbcon = database.connect(self.db)
         self.dbcon.row_factory = database.Row # return results indexed by field names and not numbers so we can convert to dict
         self.dbcon.text_factory = str
         self.dbcur = self.dbcon.cursor()
             
     self._create_subscription_tables()
开发者ID:arKtelix,项目名称:script.icechannel,代码行数:31,代码来源:subscriptions.py


示例5: save_strm

def save_strm(settings, nzbname, nzb):
    info = nfo.NfoLabels()
    info_labels = info.info_labels
    m_tvshow = Tvshow(info, settings.getSetting("strm_path_tvshow"),\
               settings.getSetting("lib_save_nfo_type_tvshow").lower(),\
               nzbname, nzb)
    m_movie = Movie(info, settings.getSetting("strm_path_movie"),\
               settings.getSetting("lib_save_nfo_type_movie").lower(),\
               (settings.getSetting("lib_save_nfo_poster").lower() == "true"),\
               (settings.getSetting("lib_save_nfo_fanart").lower() == "true"),\
               nzbname, nzb)
    if 'code' in info_labels and not 'rageid' in info_labels and not 'tvdb-show' in info_labels:
        m_movie.save()
        time.sleep(3)
        xbmc.executebuiltin('UpdateLibrary(video,' + xbmc.translatePath(m_movie.strm_path_movie) + ')')
    elif 'rageid' in info_labels:
        m_tvshow.set_rageid(info_labels['rageid'])
        m_tvshow.save()
        time.sleep(3)
        xbmc.executebuiltin('UpdateLibrary(video,' + xbmc.translatePath(m_tvshow.strm_path) + ')')
    else:
        # Ask what to do and how to save
        type = xbmcgui.Dialog().select('Select library type', ['Movie', 'TV-Show'])
        if type == 1:
            m_tvshow.save()
            time.sleep(3)
            xbmc.executebuiltin('UpdateLibrary(video,' + xbmc.translatePath(m_tvshow.strm_path) + ')')
        else:
            m_movie.save()
            time.sleep(3)
            xbmc.executebuiltin('UpdateLibrary(video,' + xbmc.translatePath(m_movie.strm_path_movie) + ')')
    return
开发者ID:TsUPeR,项目名称:xbmc-pneumatic,代码行数:32,代码来源:strm2lib.py


示例6: Addon_Install

def Addon_Install(name,zip_link,repo_link,repo_id,addon_id,provider_name,forum,data_path):
    print "############# ADDON INSTALL #################"
    print "repo_url: "+str(repo_link)
    print "zip_url: "+str(zip_link)
    print "repo_id: "+str(repo_id)
    forum=str(forum)
    repo_id=str(repo_id)
    status=1
    repostatus=1
    modulestatus=1
    addondownload=xbmc.translatePath(os.path.join(packages,name+'.zip'))
    addonlocation=xbmc.translatePath(os.path.join(ADDONS,addon_id))
    dp.create("Installing Addon","Please wait whilst your addon is installed",'', '')
    try:
        downloader.download(repo_link, addondownload, dp)
        extract.all(addondownload, addonfolder, dp)
    except:
        try:
            downloader.download(zip_link, addondownload, dp)
            extract.all(addondownload, addonfolder, dp)
        except:
            try:
                if not os.path.exists(addonlocation):
                    os.makedirs(addonlocation)
                link = extras.Open_URL(data_path).replace('\n','').replace('\r','')
                match=re.compile('href="(.+?)"', re.DOTALL).findall(link)
                for href in match:
                    filepath=xbmc.translatePath(os.path.join(addonlocation,href))
                    if addon_id not in href and '/' not in href:
                        try:
                            dp.update(0,"Downloading [COLOR=yellow]"+href+'[/COLOR]','','Please wait...')
                            print"downloading: "+data_path+href
                            downloader.download(data_path+href, filepath, dp)
                        except: print"failed to install"+href
                    if '/' in href and '..' not in href and 'http' not in href:
                        remote_path = data_path+href
                        Recursive_Loop(filepath,remote_path)
            except:
                dialog.ok("Error downloading add-on", 'There was an error downloading [COLOR=yellow]'+name,'[/COLOR]Please consider updating the add-on portal with details','or report the error on the forum at [COLOR=lime][B]www.totalxbmc.tv[/COLOR][/B]')             
                status=0
    if status==1:
        time.sleep(1)
        dp.update(0,"[COLOR=yellow]"+name+'[/COLOR]  [COLOR=lime]Successfully Installed[/COLOR]','','Now installing repository')
        time.sleep(1)
        repopath = xbmc.translatePath(os.path.join(ADDONS, repo_id))
        if (repo_id != 'repository.xbmc.org') and not (os.path.exists(repopath)) and (repo_id != '') and ('superrepo' not in repo_id):
            Install_Repo(repo_id)
        incremental = 'http://totalxbmc.com/totalrevolution/AddonPortal/downloadcount.php?id=%s' % (addon_id)
        extras.Open_URL(incremental)
        Dependency_Install(name,addon_id)
        xbmc.executebuiltin( 'UpdateLocalAddons' )
        xbmc.executebuiltin( 'UpdateAddonRepos' )
        if repostatus == 0:
            dialog.ok(name+" Install Complete",'The add-on has been successfully installed but','there was an error installing the repository.','This will mean the add-on fails to update')
        if modulestatus == 0:
            dialog.ok(name+" Install Complete",'The add-on has been successfully installed but','there was an error installing modules.','This could result in errors with the add-on.')
        if modulestatus != 0 and repostatus != 0 and forum != '':
            dialog.ok(name+" Install Complete",'Please support the developer(s) [COLOR=dodgerblue]'+provider_name,'[/COLOR]Support for this add-on can be found at [COLOR=yellow]'+forum,'[/COLOR][CR]Remember to visit [COLOR=lime][B]www.totalxbmc.tv[/COLOR][/B] for all your Kodi needs.')
        if modulestatus != 0 and repostatus != 0 and forum == '':
            dialog.ok(name+" Install Complete",'Please support the developer(s) [COLOR=dodgerblue]'+provider_name,'[/COLOR]No details of forum support have been given but','we\'ll be happy to help at [COLOR=lime][B]www.totalxbmc.tv[/COLOR][/B]')
开发者ID:bobafet,项目名称:kodistuff,代码行数:60,代码来源:addons.py


示例7: LogoDownloader

def LogoDownloader():
    xbmc.log('script.pseudotv.live-donordownload: LogoDownloader')
    
    LogoPath = xbmc.translatePath(os.path.join(SETTINGS_LOC))
    
    if dlg.yesno("PseudoTV Live", "Download Color Logos or No, Download Mono Logos", ""):
        LogoDEST = LogoPath + '/PTVL_Color.zip'
        i = 1
    else:
        LogoDEST = LogoPath + '/PTVL_Mono.zip'
        i = 2

    if not DEFAULT_LOGO_LOC:
        os.makedirs(DEFAULT_LOGO_LOC)
        
    try:
        os.remove(xbmc.translatePath(LinkPath))
    except:
        pass
         
    try:
        urllib.urlretrieve(LinkURLPath, (xbmc.translatePath(LinkPath)))
        f = FileAccess.open((xbmc.translatePath(LinkPath)), "r")
        linesLST = f.readlines()
        LogoURLPath = linesLST[i] 
        download(LogoURLPath, LogoDEST)
        all(LogoDEST, LogoPath)
        REAL_SETTINGS.setSetting("ChannelLogoFolder", DEFAULT_LOGO_LOC)
        os.remove(LogoDEST)
    except:
        pass
        
    REAL_SETTINGS.openSettings()
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:33,代码来源:donordownload.py


示例8: CEDownloader

def CEDownloader():
    xbmc.log('script.pseudotv.live-donordownload: CEDownloader')

    CEURL = (BaseURL + 'CEURL.txt')
    CEDEST = xbmc.translatePath(os.path.join(SETTINGS_LOC, 'PTVL_Cinema_Experience_Pack.zip'))
    CEPath = xbmc.translatePath(os.path.join(SETTINGS_LOC))

    if dlg.yesno("PseudoTV Live", "Download Cinema Experience Pack", ""):
        
        try:
            os.remove(xbmc.translatePath(LinkPath))
        except:
            pass
            
        try:
            urllib.urlretrieve(LinkURLPath, (xbmc.translatePath(LinkPath)))
            f = FileAccess.open((xbmc.translatePath(LinkPath)), "r")
            linesLST = f.readlines()
            CEURLPath = linesLST[3]
            
            download(CEURLPath, CEDEST)
            all(CEDEST, CEPath)
            
            if xbmcvfs.exists(CE_LOC):
                REAL_SETTINGS.setSetting("CinemaPack", "true")
            else:
                REAL_SETTINGS.setSetting("CinemaPack", "false")

            os.remove(CEDEST)
        except:
            pass  
            
            REAL_SETTINGS.openSettings()
    else:
        REAL_SETTINGS.openSettings()
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:35,代码来源:donordownload.py


示例9: ADDONINSTALL

def ADDONINSTALL(name,url,description,filetype):
  path=xbmc.translatePath(os.path.join('special://home/addons','packages'))
  confirm=xbmcgui.Dialog().yesno("ATTENTION!!","                By Clicking 'YES' you agree to allow this Addon","                 Access to add repositories and other addons              ","                    ")
  
  if confirm: 
        dp=xbmcgui.DialogProgress()
        dp.create("ATTENTION:","Downloading ",'','Please Wait')
        lib=os.path.join(path,name+'.zip')
        try: os.remove(lib)
        except: pass
        downloader.download(url, lib, dp)
        if filetype == 'addon':
            addonfolder = xbmc.translatePath(os.path.join('special://','home/addons'))
        elif filetype == 'media':
             addonfolder = xbmc.translatePath(os.path.join('special://','home'))    
  ##attempt Shortcuts
        elif filetype == 'main':
             addonfolder = xbmc.translatePath(os.path.join('special://','home'))
        time.sleep(2)
        dp.update(0,"","Extracting Zip Please Wait")
        print '======================================='
        print addonfolder
        print '======================================='
        extract.all(lib,addonfolder,dp)
        dialog=xbmcgui.Dialog()
        dialog.ok("Success!","Please Reboot To Take Effect","    Brought To You By BLAZETAMER ")
  else:
      return
开发者ID:ArchUser,项目名称:Kasiks-Repo,代码行数:28,代码来源:status.py


示例10: setup

    def setup(self):
        #create authorization helper and load default settings
        gauth = GoogleAuth(xbmc.validatePath(xbmc.translatePath(utils.addon_dir() + '/resources/lib/pydrive/settings.yaml')))
        gauth.LoadClientConfigSettings()
        
        #check if this user is already authorized
        if(not xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "google_drive.dat"))):
            settings = {"client_id":self.CLIENT_ID,'client_secret':self.CLIENT_SECRET}
    
            drive_url = gauth.GetAuthUrl(settings)
    
            utils.log("Google Drive Authorize URL: " + drive_url)

            code = xbmcgui.Dialog().input('Google Drive Validation Code','Input the Validation code after authorizing this app')

            gauth.Auth(code)
            gauth.SaveCredentialsFile(xbmc.validatePath(xbmc.translatePath(utils.data_dir() + 'google_drive.dat')))
        else:
            gauth.LoadCredentialsFile(xbmc.validatePath(xbmc.translatePath(utils.data_dir() + 'google_drive.dat')))
    
        #create the drive object
        self.drive = GoogleDrive(gauth)
        
        #make sure we have the folder we need
        xbmc_folder = self._getGoogleFile(self.root_path)
        print xbmc_folder
        if(xbmc_folder == None):
            self.mkdir(self.root_path)
开发者ID:elephunk84,项目名称:Kodi-Addons,代码行数:28,代码来源:vfs.py


示例11: doFunction

 def doFunction(self, url):
     func = url[0:2]
     url = url[2:]
     if func == 'DP':
         isrc, pid = url.split('pid',1)
         self.updateList(pid = pid, token = None, cmd = 'DELITEM', isrc = isrc)
     elif func == 'AP':
         token, uid = self.getAutho(getMe = True)
         html = self.getRequest(VEVOAPI + ('/user/%s/playlists?token=%s' % (uid,token)))
         a = json.loads(html)
         ilist=[]
         nlist=[]
         for b in a:
             nlist.append(b['name'])
             ilist.append(b['playlistId'])
         dialog = xbmcgui.Dialog()
         choice = dialog.select('Choose a playlist', nlist)
         pid = ilist[choice]
         self.updateList(pid = pid, token = token, cmd = 'ADDITEM', isrc = url)
     elif func == 'AL':
         artist = xbmc.getInfoLabel('ListItem.Artist').split('/',1)[0]
         artist = artist.replace(':','').replace('-','').replace('?','%3F')
         title = xbmc.getInfoLabel('ListItem.Title').split('(',1)[0]
         title = title.replace(':','').replace('-','').replace('?','%3F')
         name = artist.strip() + ' - ' + title.strip()
         profile = self.addon.getAddonInfo('profile').decode(UTF8)
         videosDir  = xbmc.translatePath(os.path.join(profile,'Videos'))
         videoDir  = xbmc.translatePath(os.path.join(videosDir, name))
         if not os.path.isdir(videoDir):
             os.makedirs(videoDir)
         strmFile = xbmc.translatePath(os.path.join(videoDir, name+'.strm'))
         with open(strmFile, 'w') as outfile:
             outfile.write('%s?mode=GV&url=%s' %(sys.argv[0], url))
         json_cmd = '{"jsonrpc":"2.0","method":"VideoLibrary.Scan", "params": {"directory":"%s/"},"id":1}' % videoDir.replace('\\','/')
         jsonRespond = xbmc.executeJSONRPC(json_cmd)
开发者ID:gedisony,项目名称:repo-plugins,代码行数:35,代码来源:scraper.py


示例12: get_delete_list

 def get_delete_list(self):
     results = []
     try:
         folder = os.listdir(xbmc.translatePath('special://database/'))
         for database in folder:
             if database.startswith('MyVideos') and database.endswith('.db'):                    
                 con = sqlite3.connect(xbmc.translatePath('special://database/' + database))
                 cur = con.cursor()
                 
                 query = "attach database '" + addon_db + "' as addon"
                 cur.execute(query)
          
                 query = "select tvshow.idShow,tvshow.c00 as showname , autoDelete from tvshow "
                 query += " left outer join addon.tvshowsettings on addon.tvshowsettings.idShow = tvshow.idShow"
                 
                 if self.tv_default == 'delete':
                     query += " where tvshow.idShow not in (select idShow from addon.tvshowsettings  where autoDelete = 0)"
                 else:
                     query += " where tvshow.idShow in (select idShow from addon.tvshowsettings  where autoDelete = 1)"
                 
                 
                 self.debug("Executing query on %s: %s" % (addon_db, query))
                 cur.execute(query)
                         
                 self.debug("Executing " + str(query))
                 cur.execute(query)
                 #ex = cur.fetchone()[0]
                 results = cur.fetchall()
                 return results
     
     except OSError, e:
         self.debug("Something went wrong while opening the database folder (errno: %d)" % e.errno)
         raise
开发者ID:vikjon0,项目名称:xbmcfilecleaner,代码行数:33,代码来源:gui.py


示例13: DEPENDINSTALL

def DEPENDINSTALL(name,url,description,filetype,repourl):
        #Split Script Depends============================
        files=url.split('/'); dependname=files[-1:]; dependname=str(dependname); 
        dependname=dependname.replace('[','').replace(']','').replace('"','').replace('[','').replace("'",'').replace(".zip",''); 
        #StoprSplit======================================
        path=xbmc.translatePath(os.path.join('special://home','addons','packages')); dp=xbmcgui.DialogProgress(); 
        dp.create("Configuring Requirments:","Downloading and ",'','Installing '+name); 
        lib=os.path.join(path,name+'.zip'); 
        try: os.remove(lib)
        except: pass
        downloader.download(url,lib,dp)
        if filetype=='addon': addonfolder=xbmc.translatePath(os.path.join('special://','home','addons'))
        time.sleep(2)
        #dp.update(0,"","Installing selections.....")
        print '======================================='; print addonfolder; print '======================================='
        extract.all(lib,addonfolder,'')
        #Start Script Depend Search==================================================================
        depends=xbmc.translatePath(os.path.join('special://home','addons',dependname,'addon.xml')); 
        source=open(depends,mode='r'); link=source.read(); source.close(); 
        dmatch=re.compile('import addon="(.+?)"').findall(link)
        for requires in dmatch:
            if not 'xbmc.python' in requires:
                print 'Script Requires --- '+requires; 
                dependspath=xbmc.translatePath(os.path.join('special://home','addons',requires))
                #if not os.path.exists(dependspath): DEPENDINSTALL(requires,'http://addonrepo.com/xbmchub/depends/'+requires+'.zip','','addon','none')
                if not os.path.exists(dependspath): DEPENDINSTALL(requires,tribeca_url2+'maintenance/modules/'+requires+'.zip','','addon','none')
开发者ID:bialagary,项目名称:mw,代码行数:26,代码来源:defaultORIG.py


示例14: RefreshIPTVlinks

def RefreshIPTVlinks():
	iptvAddon = GetIptvAddon()
	if iptvAddon == None:
		return None

	#xbmc.executebuiltin("XBMC.Notification(ISRALIVE, Updating links..., {1}, {2})".format('', 10000 ,icon))

	markedLists = GetMarkedLists()
	markedListsFilename = os.path.join(xbmc.translatePath("special://userdata/addon_data"), AddonID, "lists", "markedLists.txt") 
	
	with open(markedListsFilename, 'w') as outfile:
		json.dump(markedLists, outfile) 
	outfile.close()
	
	isIptvAddonGotham = iptvAddon.getAddonInfo('version')  >= "1.9.3"
	finalList = MakeFinalList(markedLists)
	finalM3Ulist = MakeM3U(finalList, isIptvAddonGotham)
	finalM3Ufilename = os.path.join(addon_data_dir, 'iptv.m3u') # The final m3u file. (static + filmon links)
	f = open(finalM3Ufilename, 'w') # make the finnal m3u list (this file will used in IPTVSimple)
	f.write(finalM3Ulist)
	f.close()

	dlg = xbmcgui.Dialog()
	dlg.ok('ISRAELIVE', 'Links updated.', "Please restart XBMC or PVR db.")
	
	if os.path.exists(xbmc.translatePath( "special://userdata/addon_data/pvr.iptvsimple")):
		DeleteCache()
		
	UpdateIPTVSimpleSettings(iptvAddon)
开发者ID:albet,项目名称:xbmc-israel,代码行数:29,代码来源:myIPTVSimple.py


示例15: autopatch

def autopatch():
    xbmc.log('script.pseudotv.live-donordownload: autopatch')
    MSG = 'Donor Autoupdate Complete'
    
    try:
        os.remove(xbmc.translatePath(DL_DonorPath))
    except:
        pass
        
    try:
        os.remove(xbmc.translatePath(DonorPath))  
    except:
        pass
        
    try:
        urllib.urlretrieve(DonorURLPath, (xbmc.translatePath(DL_DonorPath)))
        xbmc.log('script.pseudotv.live-donordownload: autopatch, Downloading DL_DonorPath')   
        if xbmcvfs.exists(DL_DonorPath):
            REAL_SETTINGS.setSetting("AT_Donor", "true")
            REAL_SETTINGS.setSetting("COM_Donor", "true")
            REAL_SETTINGS.setSetting("TRL_Donor", "true")
            REAL_SETTINGS.setSetting("CAT_Donor", "true")
            if REAL_SETTINGS.getSetting('AT_Donor') and REAL_SETTINGS.getSetting('COM_Donor') and REAL_SETTINGS.getSetting('TRL_Donor') and REAL_SETTINGS.getSetting('CAT_Donor'):
                xbmc.log('script.pseudotv.live-donordownload: autopatch, Settings.xml Patched')
                xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ("PseudoTV Live", MSG, 1000, THUMB) ) 
    except:
        pass
开发者ID:TulsaTV,项目名称:script.pseudotv.live,代码行数:27,代码来源:donordownload.py


示例16: buildChannel

    def buildChannel(self):
        self.log("buildChannel, chantype = " + str(self.chantype))
        self.chnlst = ChannelList()
        self.addonDirectoryPath = []
        
        if self.chantype == 0:
            self.setting1 = xbmc.translatePath(self.Path)
            self.channame = self.chnlst.getSmartPlaylistName(self.Path)
        
        elif self.chantype == 6:
            self.setting1 = self.Label
            self.setting2 = '4'
            self.channame = self.Label
            
        elif self.chantype == 7:
            self.setting1 = xbmc.translatePath(self.Path)
            self.setting3 = str(MEDIA_LIMIT)
            self.setting4 = '0'
            self.channame = self.Label
            
        elif self.chantype == 8: 
            xmltvFle = xmltvflePath(listXMLTV())
            if self.Path.startswith('plugin://plugin.video.ustvnow'):
                self.Label = self.Label.split(' - ')[0]
                dname = "USTVnow - "+self.Label
            else:
                dname = self.Label
                
            self.channame, self.setting1 = self.chnlst.findZap2itID(dname, xmltvFle)
            self.channame = self.Label+" USTV"
            self.setting2 = self.Path
                
        elif self.chantype == 9:
            self.setting1 = '5400'
            self.setting2 = self.Path
            self.setting3 = self.Label
            self.setting4 = self.Description
            self.channame = self.Label +' - '+ self.AddonName
            
        elif self.chantype == 10:
            if self.YTtype == 1:
                self.setting1 = ((self.Path).replace('plugin://plugin.video.youtube/channel/','')).replace('/','')
            elif self.YTtype == 2:
                self.setting1 = ((self.Path).replace('plugin://plugin.video.','').replace('youtube/playlist/','').replace('spotitube/?limit&mode=listyoutubeplaylist&type=browse&url=','')).replace('/','')

            self.setting2 = str(self.YTtype)
            self.setting3 = str(MEDIA_LIMIT)
            self.setting4 = '0'
            self.channame = self.Label
            
        elif self.chantype == 15:
            self.setting1 = self.Path
            self.setting2 = ''
            self.setting3 = str(MEDIA_LIMIT)
            self.setting4 = '0'
            self.channame = self.Label +' - '+ self.AddonName
            
        self.saveSettings()
        if dlg.yesno("PseudoTV Live", 'Channel Successfully Added', 'Open Channel Manager?'):
            xbmc.executebuiltin("RunScript("+ADDON_PATH+"/config.py, %s)" %str(self.channel))
开发者ID:mrioan,项目名称:XBMC_Addons,代码行数:60,代码来源:capture.py


示例17: _init_vars

 def _init_vars( self ):
     self.WINDOW = xbmcgui.Window( int(self.WINDOWID) )
     self.WINDOW.clearProperty( "ArtistSlideshow.CleanupComplete" )
     if( self.ARTISTFIELD == '' ):
         self.SKINARTIST = ''
     else:
         self.SKINARTIST = "Window(%s).Property(%s)" % ( self.WINDOWID, self.ARTISTFIELD )
     if( self.TITLEFIELD == '' ):
         self.SKINTITLE = ''
     else:
         self.SKINTITLE = "Window(%s).Property(%s)" % ( self.WINDOWID, self.TITLEFIELD )
     self.ARTISTSLIDESHOW = "Window(%s).Property(%s)" % ( self.WINDOWID, "ArtistSlideshow" )
     self.ARTISTSLIDESHOWRUNNING = "Window(%s).Property(%s)" % ( self.WINDOWID, "ArtistSlideshowRunning" )
     self.EXTERNALCALL = "Window(%s).Property(%s)" % ( self.WINDOWID, "ArtistSlideshow.ExternalCall" )
     self.EXTERNALCALLSTATUS = xbmc.getInfoLabel( self.EXTERNALCALL )
     log( 'external call is set to ' + xbmc.getInfoLabel( self.EXTERNALCALL ) )
     self.NAME = ''
     self.ALLARTISTS = []
     self.LocalImagesFound = False
     self.CachedImagesFound = False
     self.ImageDownloaded = False
     self.DownloadedAllImages = False
     self.UsingFallback = False
     self.BlankDir = xbmc.translatePath('special://profile/addon_data/%s/transition' % __addonname__ )
     self.MergeDir = xbmc.translatePath('special://profile/addon_data/%s/merge' % __addonname__ )    
     self.InitDir = xbmc.translatePath('%s/resources/black' % __addonpath__ )
     LastfmApiKey = 'fbd57a1baddb983d1848a939665310f6'
     HtbackdropsApiKey = '96d681ea0dcb07ad9d27a347e64b652a'
     self.LastfmURL = 'http://ws.audioscrobbler.com/2.0/?autocorrect=1&api_key=' + LastfmApiKey
     self.HtbackdropsQueryURL = 'http://htbackdrops.com/api/' + HtbackdropsApiKey + '/searchXML?default_operator=and&fields=title&aid=1'
     self.HtbackdropsDownloadURL = 'http://htbackdrops.com/api/' + HtbackdropsApiKey + '/download/'
开发者ID:uratrtl,项目名称:script.artistslideshow,代码行数:31,代码来源:default.py


示例18: getData

def getData(url, timeout=__cachePeriod__, name=''):
        if __DEBUG__:
            print 'url --> ' + url
            print 'name --> ' + name
        if timeout > 0:
            if name == '':
                cachePath = xbmc.translatePath(os.path.join(__PLUGIN_PATH__, 'cache', 'pages', urllib.quote(url,"")))
            else:
                cachePath = xbmc.translatePath(os.path.join(__PLUGIN_PATH__, 'cache', 'pages', name))
            if (os.path.exists(cachePath) and (time.time()-os.path.getmtime(cachePath))/60/60 <= float(timeout)):
                f = open(cachePath, 'r')
                ret = f.read()
                f.close()
                if __DEBUG__:
                    print 'returned data from cache'
                return ret
        try:     
            req = urllib2.Request(url)
            req.add_header('User-Agent', __USERAGENT__)        
            response = urllib2.urlopen(req)
            data = response.read().replace("\n","").replace("\t","").replace("\r","")
            response.close()
            if timeout > 0:
                f = open(cachePath, 'wb')
                f.write(data)
                f.close()
            if __DEBUG__:
                print data
            return data
        except:
            if __DEBUG__:
                errno, errstr = sys.exc_info()[:2]
                print 'Error in getData: ' + str(errno) + ": " + str(errstr)
            xbmc.log('Error in getData: Unable to save cache', xbmc.LOGERROR)
            return 'unavailable'
开发者ID:roeiba,项目名称:xbmc,代码行数:35,代码来源:common.py


示例19: getImagePath

	def getImagePath(self, path):
		# special infolabel distrologo present
		if path.lower() == '$info[distrologo]':
			logo = self.distro.lower() + '.png'
			imagepath = os.path.join(__media__, logo)
			if not os.path.isfile(imagepath):
				imagepath = os.path.join(__media__, 'kodi.png')
		# special infolabel from kodi present
		elif path.lower().find('$info') >= 0:
			imagepath = path
		# full path to the image given
		elif os.path.isfile(path):
			imagepath = path
		# look for the image in addons __media__ dir
		elif os.path.isfile(os.path.join(__media__, path)):
			imagepath = os.path.join(__media__, path)
		# look for the image in libreelec's storage dir
		elif os.path.isfile(os.path.join('/storage/', path)):
			imagepath = os.path.join('/storage/', path)
		# look for the image in kodi's configuration dir
		elif os.path.isfile(os.path.join(xbmc.translatePath('special://home'), path)):
			imagepath = os.path.join(xbmc.translatePath('special://home'), path)
		# if image could not be found, set path to error.png
		else:
			imagepath = os.path.join(__media__, 'error.png')

		return imagepath
开发者ID:vitalogy,项目名称:script.xbmc.kodisp,代码行数:27,代码来源:layout.py


示例20: walkTree

    def walkTree(self,directory):
       
        if(self.vfs.exists(directory + "/")):
            dirs,files = self.vfs.listdir(directory)
        
            #create all the subdirs first
            for aDir in dirs:
                dirPath = xbmc.translatePath(directory + "/" + aDir)
                file_ext = aDir.split('.')[-1]
              
                self.addFile("-" + dirPath)

                #catch for "non directory" type files
                shouldWalk = True

                for s in file_ext:
                    if(s in self.not_dir):
                        shouldWalk = False
                
                if(shouldWalk):
                    self.walkTree(dirPath)  
            
            #copy all the files
            for aFile in files:
                filePath = xbmc.translatePath(directory + "/" + aFile)
                self.addFile(filePath)
开发者ID:Mendim,项目名称:tdbaddon,代码行数:26,代码来源:backup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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