python类executebuiltin()的实例源码

bityouth.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def onAction(self, action):
             if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
                import os
                import xbmc
                APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
                NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
                REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
                APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
                TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
                try:
                    os.remove(NOBACKDESTFILE)
                    os.remove(REMOTENOBACKDESTFILE)
                    os.remove(APPNOBACKDESTFILE)
                    if os.path.exists ( TESTPYDESTFILE ):
                        urllib.urlretrieve ("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/customapp.xml", APPCOMMANDDESTFILE )
                    xbmc.executebuiltin('Action(reloadkeymaps)')
                except:
                    xbmc.executebuiltin('Action(reloadkeymaps)')
                self.close()
bityouth.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def onAction(self, action):
            if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
               import os
               import xbmc
               APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
               NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
               REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
               APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
               TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
               try:
                  os.remove(NOBACKDESTFILE)
                  os.remove(REMOTENOBACKDESTFILE)
                  os.remove(APPNOBACKDESTFILE)
                  if os.path.exists ( TESTPYDESTFILE ):
                     urllib.urlretrieve ("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bityouth/customapp.xml", APPCOMMANDDESTFILE )
                  xbmc.executebuiltin('Action(reloadkeymaps)')
               except:
                  xbmc.executebuiltin('Action(reloadkeymaps)')
               self.close()
tvmoviedb.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def callback_voto(item, values):
    item.voto = item.valores["voto"][values["voto"]]
    item.action = "acciones_fa"
    movieid = item.url.rsplit("=", 1)[1]
    post = "id=%s&rating=%s&itk=%s&action=rate" % (movieid, item.voto, item.itk)
    data = jsontools.load_json(httptools.downloadpage("http://filmaffinity.com/%s/ratingajax.php" % langf, post).data)

    if not item.folder:
        import xbmc
        return xbmc.executebuiltin("Container.Refresh")
    else:
        if data["result"] == 0:
            title = "Voto contabilizado con éxito"
        else:
            title = "Error, algo ha fallado durante el proceso"
        itemlist.append(item.clone(action="", title=title))
        return itemlist
tvmoviedb.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def addlist_mal(item):
    data = httptools.downloadpage(item.url).data

    anime_id = scrapertools.find_single_match(data, 'id="myinfo_anime_id" value="([^"]+)"')
    if item.value == "2":
        vistos = scrapertools.find_single_match(data, 'id="myinfo_watchedeps".*?<span id="curEps">(\d+)')
    else:
        vistos = scrapertools.find_single_match(data, 'id="myinfo_watchedeps".*?value="(\d+)"')
    if not item.score:
        item.score = scrapertools.find_single_match(data, 'id="myinfo_score".*?selected" value="(\d+)"')
    token = scrapertools.find_single_match(data, "name='csrf_token' content='([^']+)'")

    post = {'anime_id': int(anime_id), 'status': int(item.value), 'score': int(item.score), 'num_watched_episodes': int(vistos), 'csrf_token': token}
    headers_mal = {'User-Agent': 'Mozilla/5.0', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Referer': item.url, 'X-Requested-With': 'XMLHttpRequest'}
    url = "https://myanimelist.net/ownlist/anime/add.json"
    if item.lista:
        url = "https://myanimelist.net/ownlist/anime/edit.json"
    data = httptools.downloadpage(url, post=jsontools.dump_json(post), headers=headers_mal, replace_headers=True).data
    item.title = "En tu lista"
    if config.is_xbmc():
        import xbmc
        xbmc.executebuiltin("Container.Refresh")
bricocine.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def onAction(self, action):
            if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
               ###Se vuelven a cargar Customkey al salir de info
               import os, sys
               import xbmc
               APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
               NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
               REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
               APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
               TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
               try:
                   os.remove(NOBACKDESTFILE)
                   os.remove(REMOTENOBACKDESTFILE)
                   os.remove(APPNOBACKDESTFILE)
                   if os.path.exists ( TESTPYDESTFILE ):
                      urllib.urlretrieve ("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customapp.xml", APPCOMMANDDESTFILE )
                   xbmc.executebuiltin('Action(reloadkeymaps)')
               except:
                  pass
               self.close()
bricocine.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def onAction(self, action):
            if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT:
               import os, sys
               import xbmc
               APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml")
               NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml")
               REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml")
               APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml")
               TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py")
               try:
                   os.remove(NOBACKDESTFILE)
                   os.remove(REMOTENOBACKDESTFILE)
                   os.remove(APPNOBACKDESTFILE)
                   xbmc.executebuiltin('Action(reloadkeymaps)')
                   if os.path.exists ( TESTPYDESTFILE ):
                      urllib.urlretrieve ("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customapp.xml", APPCOMMANDDESTFILE )
                   xbmc.executebuiltin('Action(reloadkeymaps)')
               except:
                   xbmc.executebuiltin('Action(reloadkeymaps)')
               self.close()
xbmc_library.py 文件源码 项目:pelisalacarta-ce 作者: pelisalacarta-ce 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def sync_trakt_kodi(silent=True):

    # Para que la sincronizacion no sea silenciosa vale con silent=False
    if xbmc.getCondVisibility('System.HasAddon("script.trakt")'):
        notificacion = True
        if (not config.get_setting("sync_trakt_notification", "biblioteca") and
                platformtools.is_playing()):
            notificacion = False

        xbmc.executebuiltin('RunScript(script.trakt,action=sync,silent=%s)' % silent)
        logger.info("Sincronizacion con Trakt iniciada")

        if notificacion:
            platformtools.dialog_notification("pelisalacarta",
                                              "Sincronizacion con Trakt iniciada",
                                              icon=0,
                                              time=2000)
musicartwork.py 文件源码 项目:script.module.metadatautils 作者: marcelveldt 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def music_artwork_options(self, artist, album, track, disc):
        '''show options for music artwork'''
        options = []
        options.append(self._mutils.addon.getLocalizedString(32028))  # Refresh item (auto lookup)
        options.append(self._mutils.addon.getLocalizedString(32036))  # Choose art
        options.append(self._mutils.addon.getLocalizedString(32034))  # Open addon settings
        header = self._mutils.addon.getLocalizedString(32015)
        dialog = xbmcgui.Dialog()
        ret = dialog.select(header, options)
        del dialog
        if ret == 0:
            # Refresh item (auto lookup)
            self.get_music_artwork(artist, album, track, disc, ignore_cache=True)
        elif ret == 1:
            # Choose art
            self.get_music_artwork(artist, album, track, disc, ignore_cache=True, manual=True)
        elif ret == 2:
            # Open addon settings
            xbmc.executebuiltin("Addon.OpenSettings(%s)" % ADDON_ID)
changelog.py 文件源码 项目:plugin.video.exodus 作者: lastship 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def get(version):
    try:
        import xbmc,xbmcgui,xbmcaddon,xbmcvfs

        f = xbmcvfs.File(xbmcaddon.Addon().getAddonInfo('changelog'))
        text = f.read() ; f.close()

        label = '%s - %s' % (xbmc.getLocalizedString(24054), xbmcaddon.Addon().getAddonInfo('name'))

        id = 10147

        xbmc.executebuiltin('ActivateWindow(%d)' % id)
        xbmc.sleep(100)

        win = xbmcgui.Window(id)

        retry = 50
        while (retry > 0):
            try:
                xbmc.sleep(10)
                win.getControl(1).setLabel(label)
                win.getControl(5).setText(text)
                retry = 0
            except:
                retry -= 1

        return '1'
    except:
        return '1'
main.py 文件源码 项目:YoutubeTV 作者: dude56987 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def removeChannel(self,channelUsername):
        '''
        Remove channel with username channelUsername.

        :return None
        '''
        # check if channel exists in channels
        if channelUsername in self.cache.names:
            # remove the channel from the cache
            self.cache.deleteValue(channelUsername)
            # if channel has playlists in cache
            if channelUsername in self.playlistCache.names:
                # delete the playlists for the channel
                self.playlistCache.deleteValue(channelUsername)
            # delte the channel timer
            #del self.timer[channelUsername]
            self.timer.deleteValue(channelUsername)
            # delete the channel playlist timers
            #for timer in self.timer.keys():
            killArray=[]
            for timer in self.timer.names:
                if channelUsername+':' in timer:
                    killArray.append(timer)
                    #del self.timer[timer]
            for item in killArray:
                self.timer.deleteValue(item)
        # save the changes to the data
        xbmc.executebuiltin('container.Update('+_url+',replace)')
        popup('YoutubeTV','Channel '+channelUsername+' removed')
default.py 文件源码 项目:nuodtayo.tv 作者: benaranguren 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def play_video(episode_url, thumbnail):

    episodeDetails = {}

    for i in range(int(this.getSetting('loginRetries')) + 1):
        episodeDetails = get_media_info(episode_url)
        if episodeDetails and episodeDetails.get('StatusCode', 0) == 1:
            break
        else:
            login()

    if episodeDetails and episodeDetails.get('StatusCode', 0) == 1:
        media_url = episodeDetails['MediaReturnObj']['uri']
        common.log(episodeDetails['MediaReturnObj']['live'] == False)
        if not episodeDetails['MediaReturnObj']['live']:
            # re-enable bw limiting in v0.1.12. Streams has very variable rate
            # and without this limits, the stream will drop.
            media_url = media_url.replace('&b=100-1000', '&b=100-6000')
            server_override_enable = this.getSetting('server_override_enable')
            server_override_url = this.getSetting('server_override_url')
            common.log('#'*30)
            common.log(server_override_url)
            common.log(server_override_enable)
            if server_override_enable.lower() == 'true' and server_override_url:
                media_url = media_url.replace('http://o2-i.',
                                              server_override_url)

        liz = xbmcgui.ListItem(name, iconImage="DefaultVideo.png",
                               thumbnailImage=thumbnail, path=media_url)
        liz.setInfo(type="Video", infoLabels={"Title": name})
        liz.setProperty('IsPlayable', 'true')

        return xbmcplugin.setResolvedUrl(thisPlugin, True, liz)
    else:
        default_msg = 'Subscription is already expired \
                       or the item is not part of your \
                       subscription.'
        status_msg = episodeDetails.get('StatusMessage', default_msg)
        xbmc.executebuiltin('Notification(%s, %s)' % \
                            ('Media Error', status_msg))
default.py 文件源码 项目:nuodtayo.tv 作者: benaranguren 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def show_message(message, title=xbmcaddon.Addon().getLocalizedString(50107)):
    if not message:
        return
    xbmc.executebuiltin("ActivateWindow(%d)" % (10147, ))
    win = xbmcgui.Window(10147)
    xbmc.sleep(100)
    win.getControl(1).setLabel(title)
    win.getControl(5).setText(message)
default.py 文件源码 项目:cmik.xbmc 作者: cmik 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def showMessage(message, title = lang(50001)):
    if not message:
        return
    xbmc.executebuiltin("ActivateWindow(%d)" % 10147)
    win = xbmcgui.Window(10147)
    xbmc.sleep(100)
    win.getControl(1).setLabel(title)
    win.getControl(5).setText(message)
default.py 文件源码 项目:cmik.xbmc 作者: cmik 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def showNotification(message, title=lang(50001)):
    xbmc.executebuiltin('Notification(%s, %s)' % (title, message))
backuprestore.py 文件源码 项目:script.skin.helper.skinbackup 作者: marcelveldt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def restore_guisettings(self, filename, progressdialog):
        '''restore guisettings'''
        kodifile = xbmcvfs.File(filename, 'r')
        data = kodifile.read()
        importstring = eval(data)
        kodifile.close()
        xbmc.sleep(200)
        for count, skinsetting in enumerate(importstring):

            if progressdialog and progressdialog.iscanceled():
                return

            setting = skinsetting[1]
            settingvalue = skinsetting[2]

            if progressdialog:
                progressdialog.update((count * 100) / len(importstring),
                                      '%s %s' % (self.addon.getLocalizedString(32033), setting))

            if skinsetting[0] == "string":
                if settingvalue:
                    xbmc.executebuiltin("Skin.SetString(%s,%s)" % (setting, settingvalue))
                else:
                    xbmc.executebuiltin("Skin.Reset(%s)" % setting)
            elif skinsetting[0] == "bool":
                if settingvalue == "true":
                    xbmc.executebuiltin("Skin.SetBool(%s)" % setting)
                else:
                    xbmc.executebuiltin("Skin.Reset(%s)" % setting)
            xbmc.sleep(30)
utils.py 文件源码 项目:plugin.video.bdyun 作者: caasiu 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def showNotification(title,message, time=4000):
    """Show Notification

    Args: 
        title: has to be unicode
        message: has to be unicode
        time: Time that the message is beeing displayed
    """
    __addoniconpath__ = os.path.join(addon_dir(),"icon.png")
    log(u'Notification. %s: %s' % (title, message) )
    xbmc.executebuiltin(encode('Notification("' + title + '","' + message + '",'+(str(time)).decode('utf-8')+',"' + __addoniconpath__ + '")'))
default.py 文件源码 项目:plugin.video.bdyun 作者: caasiu 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def clear_cache():
    info = plugin.get_storage('info')
    homemenu = plugin.get_storage('homemenu')
    pcs_info = plugin.get_storage('pcs_info')
    info.clear()
    homemenu.clear()
    pcs_info.clear()
    dialog.notification('', u'????', xbmcgui.NOTIFICATION_INFO, 3000)
    xbmc.executebuiltin('Container.Refresh')
    return
default.py 文件源码 项目:plugin.video.bdyun 作者: caasiu 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def refresh():
    homemenu = plugin.get_storage('homemenu')
    homemenu.clear()
    xbmc.executebuiltin('Container.Refresh')
common.py 文件源码 项目:konsodi 作者: kharts 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def notify(message):
    """
    Opens notification window with message
    :param: message: str - message
    :return: None
    """
    icon = ""  # os.path.join(addonFolder, "icon.png")
    xbmc.executebuiltin(unicode('XBMC.Notification(' + message + ',3000,' + icon + ')').encode("utf-8"))
main_service.py 文件源码 项目:plugin.audio.spotify 作者: marcelveldt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def get_auth_token(self):
        '''check for valid credentials and grab token'''
        auth_token = None
        username = self.addon.getSetting("username").decode("utf-8")
        password = self.addon.getSetting("password").decode("utf-8")
        if username and password:
            self.spotty.username = username
            self.spotty.password = password
            auth_token = get_token(self.spotty)
        if auth_token:
            log_msg("Retrieved auth token")
            # store authtoken as window prop for easy access by plugin entry
            xbmc.executebuiltin("SetProperty(spotify-token, %s, Home)" % auth_token['access_token'])
        return auth_token


问题


面经


文章

微信
公众号

扫码关注公众号