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


Python xbmc.getLocalizedString方法代码示例

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


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

示例1: get_authkey

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def get_authkey(self):
        '''get authentication key'''
        auth_token = None
        count = 10
        while not auth_token and count: # wait max 5 seconds for the token
            auth_token = self.win.getProperty("spotify-token").decode("utf-8")
            count -= 1
            if not auth_token:
                xbmc.sleep(500)
        if not auth_token:
            if self.win.getProperty("spotify.supportsplayback"):
                if self.win.getProperty("spotify-discovery") == "disabled":
                    msg = self.addon.getLocalizedString(11050)
                else:
                    msg = self.addon.getLocalizedString(11065)
                dialog = xbmcgui.Dialog()
                header = self.addon.getAddonInfo("name")
                dialog.ok(header, msg)
                del dialog
            else:
                # login with browser
                request_token_web(force=True)
                self.win.setProperty("spotify-cmd", "__LOGOUT__")
        return auth_token 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:26,代码来源:plugin_content.py

示例2: search_artists

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def search_artists(self):
        xbmcplugin.setContent(self.addon_handle, "artists")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(133))
        result = self.sp.search(
            q="artist:%s" %
            self.artistid,
            type='artist',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        artists = self.prepare_artist_listitems(result['artists']['items'])
        self.add_artist_listitems(artists)
        self.add_next_button(result['artists']['total'])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_artists:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_artists) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:19,代码来源:plugin_content.py

示例3: search_albums

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def search_albums(self):
        xbmcplugin.setContent(self.addon_handle, "albums")
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(132))
        result = self.sp.search(
            q="album:%s" %
            self.albumid,
            type='album',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        albumids = []
        for album in result['albums']['items']:
            albumids.append(album["id"])
        albums = self.prepare_album_listitems(albumids)
        self.add_album_listitems(albums, True)
        self.add_next_button(result['albums']['total'])
        xbmcplugin.addSortMethod(self.addon_handle, xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_albums:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_albums) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:22,代码来源:plugin_content.py

示例4: search_playlists

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def search_playlists(self):
        xbmcplugin.setContent(self.addon_handle, "files")
        result = self.sp.search(
            q=self.playlistid,
            type='playlist',
            limit=self.limit,
            offset=self.offset,
            market=self.usercountry)
        log_msg(result)
        xbmcplugin.setProperty(self.addon_handle, 'FolderName', xbmc.getLocalizedString(136))
        playlists = self.prepare_playlist_listitems(result['playlists']['items'])
        self.add_playlist_listitems(playlists)
        self.add_next_button(result['playlists']['total'])
        xbmcplugin.endOfDirectory(handle=self.addon_handle)
        if self.defaultview_playlists:
            xbmc.executebuiltin('Container.SetViewMode(%s)' % self.defaultview_playlists) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:18,代码来源:plugin_content.py

示例5: add_next_button

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def add_next_button(self, listtotal):
        # adds a next button if needed
        params = self.params
        if listtotal > self.offset + self.limit:
            params["offset"] = self.offset + self.limit
            url = "plugin://plugin.audio.spotify/"
            for key, value in params.iteritems():
                if key == "action":
                    url += "?%s=%s" % (key, value[0])
                elif key == "offset":
                    url += "&%s=%s" % (key, value)
                else:
                    url += "&%s=%s" % (key, value[0])
            li = xbmcgui.ListItem(
                xbmc.getLocalizedString(33078),
                path=url,
                iconImage="DefaultMusicAlbums.png"
            )
            li.setProperty('do_not_analyze', 'true')
            li.setProperty('IsPlayable', 'false')
            xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) 
开发者ID:kodi-community-addons,项目名称:plugin.audio.spotify,代码行数:23,代码来源:plugin_content.py

示例6: __init__

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def __init__(self, force=False, cache_short=None, cache_long=None, tmdb=None, login=False):
        super(TraktAPI, self).__init__(
            cache_short=cache_short, cache_long=cache_long,
            req_api_url='https://api.trakt.tv/', req_api_name='Trakt')
        self.authorization = ''
        self.sync = {}
        self.last_activities = None
        self.prev_activities = None
        self.refreshcheck = 0
        self.attempedlogin = False
        self.dialog_noapikey_header = u'{0} {1} {2}'.format(self.addon.getLocalizedString(32007), self.req_api_name, self.addon.getLocalizedString(32011))
        self.dialog_noapikey_text = self.addon.getLocalizedString(32012)
        self.client_id = 'e6fde6173adf3c6af8fd1b0694b9b84d7c519cefc24482310e1de06c6abe5467'
        self.client_secret = '15119384341d9a61c751d8d515acbc0dd801001d4ebe85d3eef9885df80ee4d9'
        self.headers = {'trakt-api-version': '2', 'trakt-api-key': self.client_id, 'Content-Type': 'application/json'}
        self.tmdb = tmdb
        self.library = 'video'

        if force:
            self.login()
            return

        self.authorize(login) 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:25,代码来源:traktapi.py

示例7: get_collection

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def get_collection(self, tmdbtype, page=1, limit=20):
        items = []
        if not self.tmdb or not self.authorize():
            return items
        collection = self.sync_collection(utils.type_convert(tmdbtype, 'trakt'))
        collection = sorted(collection, key=lambda i: i[utils.type_convert(tmdbtype, 'trakt')]['title'], reverse=False)
        start_at = limit * (page - 1)
        end_at = start_at + limit
        for i in collection[start_at:end_at]:
            i = i.get(utils.type_convert(tmdbtype, 'trakt'))
            i_tmdb = i.get('ids', {}).get('tmdb', '')
            item = ListItem(library=self.library, **self.tmdb.get_detailed_item(tmdbtype, i_tmdb))
            if item and item.label != 'N/A':
                items.append(item)
        if items and collection[end_at:]:  # If there's more items add the next page item
            items.append(ListItem(library=self.library, label=xbmc.getLocalizedString(33078), nextpage=page + 1))
        return items 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:19,代码来源:traktapi.py

示例8: refresh_item

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def refresh_item():
    dbtype = sys.listitem.getVideoInfoTag().getMediaType()
    if dbtype == 'episode':
        d_args = (
            'tv', sys.listitem.getProperty('tvshow.tmdb_id'),
            sys.listitem.getVideoInfoTag().getSeason(),
            sys.listitem.getVideoInfoTag().getEpisode())
    elif dbtype == 'tvshow':
        d_args = ('tv', sys.listitem.getProperty('tmdb_id'))
    elif dbtype == 'movie':
        d_args = ('movie', sys.listitem.getProperty('tmdb_id'))
    else:
        return
    details = _plugin.tmdb.get_detailed_item(*d_args, cache_refresh=True)
    if details:
        xbmcgui.Dialog().ok(_addon.getLocalizedString(32144), _addon.getLocalizedString(32143).format(details.get('label')))
    xbmc.executebuiltin('Container.Refresh') 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:19,代码来源:context.py

示例9: build_selectbox

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def build_selectbox(self, clearsetting=False, assertplayers=True):
        self.itemlist, self.actions = [], []
        if clearsetting:
            self.itemlist.append(xbmcgui.ListItem(xbmc.getLocalizedString(13403)))  # Clear Default
        if self.is_local:
            self.append_playeraction(u'{0} {1}'.format(self.addon.getLocalizedString(32061), 'Kodi'), self.is_local, identifier='play_kodi')
        for i in sorted(self.play_movie, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'play_movie', assertplayers=assertplayers)
        for i in sorted(self.search_movie, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'search_movie', assertplayers=assertplayers)
        for i in sorted(self.play_episode, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'play_episode', assertplayers=assertplayers)
        for i in sorted(self.search_episode, key=lambda x: x[1]):
            self.build_playeraction(i[0], 'search_episode', assertplayers=assertplayers)
        utils.kodi_log(u'Player -- Built {} Players!\n{}'.format(
            len(self.itemlist), self.identifierlist), 2) 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:18,代码来源:player.py

示例10: open_url

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def open_url(self, url, stream=False, check=False, cred=None, count=0):
        if not url:
            return False

        valid = self.check_url(url, cred)

        if not valid:
            return False
        if check:
            return True
        if valid == 'auth' and not cred:
            cred = (xbmcgui.Dialog().input(heading=xbmc.getLocalizedString(1014)) or '', xbmcgui.Dialog().input(heading=xbmc.getLocalizedString(733), option=xbmcgui.ALPHANUM_HIDE_INPUT) or '')

        response = requests.get(url, timeout=10.000, stream=stream, auth=cred)
        if response.status_code == 401:
            if count > 2 or not xbmcgui.Dialog().yesno(self.addon.getAddonInfo('name'), self.addon.getLocalizedString(32056), yeslabel=self.addon.getLocalizedString(32057), nolabel=xbmc.getLocalizedString(222)):
                xbmcgui.Dialog().ok(self.addon.getAddonInfo('name'), self.addon.getLocalizedString(32055))
                return False
            count += 1
            cred = (xbmcgui.Dialog().input(heading=xbmc.getLocalizedString(1014)) or '', xbmcgui.Dialog().input(heading=xbmc.getLocalizedString(733), option=xbmcgui.ALPHANUM_HIDE_INPUT) or '')
            response = self.open_url(url, stream, check, cred, count)
        return response 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:24,代码来源:downloader.py

示例11: set_userdiscover_selectlist_properties

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def set_userdiscover_selectlist_properties(self, data_list=None, header=None, multiselect=True):
        if not data_list:
            return
        header = header or self.addon.getLocalizedString(32111)
        func = xbmcgui.Dialog().multiselect if multiselect else xbmcgui.Dialog().select
        dialog_list = [i.get('name') for i in data_list]
        select_list = func(header, dialog_list)
        if not select_list:
            return
        if not multiselect:
            select_list = [select_list]
        for i in select_list:
            label = data_list[i].get('name')
            value = data_list[i].get('id')
            if not value:
                continue
            self.new_property_label = '{0} / {1}'.format(self.new_property_label, label) if self.new_property_label else label
            self.new_property_value = '{0} / {1}'.format(self.new_property_value, value) if self.new_property_value else '{}'.format(value) 
开发者ID:jurialmunkey,项目名称:plugin.video.themoviedb.helper,代码行数:20,代码来源:container.py

示例12: listing

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def listing(self):
        '''main listing with all our episode nodes'''
        all_items = [
            (self.addon.getLocalizedString(32027), "inprogress&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32002), "next&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32039), "recent&mediatype=episodes", "DefaultRecentlyAddedEpisodes.png"),
            (self.addon.getLocalizedString(32009), "recommended&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32010), "inprogressandrecommended&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32049), "inprogressandrandom&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32008), "random&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32042), "unaired&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32043), "nextaired&mediatype=episodes", "DefaultTvShows.png"),
            (self.addon.getLocalizedString(32068), "airingtoday&mediatype=episodes", "DefaultTvShows.png"),
            (xbmc.getLocalizedString(10134), "favourites&mediatype=episodes", "DefaultMovies.png")
        ]
        return self.metadatautils.process_method_on_list(create_main_entry, all_items) 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.widgets,代码行数:18,代码来源:episodes.py

示例13: localize

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def localize(self, text_id, default_text=u''):
        if isinstance(text_id, int):
            """
            We want to use all localization strings!
            Addons should only use the range 30000 thru 30999 (see: http://kodi.wiki/view/Language_support) but we
            do it anyway. I want some of the localized strings for the views of a skin.
            """
            if text_id >= 0 and (text_id < 30000 or text_id > 30999):
                result = xbmc.getLocalizedString(text_id)
                if result is not None and result:
                    return utils.to_unicode(result)
                pass
            pass

        result = self._addon.getLocalizedString(int(text_id))
        if result is not None and result:
            return utils.to_unicode(result)

        return utils.to_unicode(default_text) 
开发者ID:Kolifanes,项目名称:plugin.video.youtube,代码行数:21,代码来源:xbmc_context.py

示例14: check_skin_version

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def check_skin_version(self):
        '''check if skin changed'''
        try:
            skin = xbmc.getSkinDir()
            skin_addon = xbmcaddon.Addon(id=skin)
            skin_label = skin_addon.getAddonInfo('name').decode("utf-8")
            skin_version = skin_addon.getAddonInfo('version').decode("utf-8")
            this_skin = "%s-%s" % (skin_label, skin_version)
            del skin_addon
            if self.last_skin != this_skin:
                # auto correct skin settings if needed
                self.last_skin = this_skin
                self.win.setProperty("SkinHelper.skinTitle", "%s - %s: %s"
                                     % (skin_label, xbmc.getLocalizedString(19114), skin_version))
                self.win.setProperty("SkinHelper.skin_version", "%s: %s"
                                     % (xbmc.getLocalizedString(19114), skin_version))
                self.win.setProperty("SkinHelper.Version", self.addonversion.replace(".", ""))
                SkinSettings().correct_skin_settings()
        except Exception as exc:
            log_exception(__name__, exc) 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:22,代码来源:main_service.py

示例15: checkresourceaddons

# 需要导入模块: import xbmc [as 别名]
# 或者: from xbmc import getLocalizedString [as 别名]
def checkresourceaddons(addonslist):
    '''allow the skinner to perform a basic check if some required resource addons are available'''
    addon = xbmcaddon.Addon(ADDON_ID)
    for item in addonslist:
        setting = item.split(";")[0]
        addontype = item.split(";")[1]
        addontypelabel = item.split(";")[2]
        skinsetting = xbmc.getInfoLabel("Skin.String(%s.path)" % setting).decode("utf-8")
        if not skinsetting or (skinsetting and
                               getCondVisibility("!System.HasAddon(%s)" %
                                                      skinsetting.replace("resource://", "").replace("/", ""))):
            # skin setting is empty or filled with non existing addon...
            if not checkresourceaddon(setting, addontype):
                ret = xbmcgui.Dialog().yesno(
                    heading=addon.getLocalizedString(32007) % addontypelabel,
                    line1=addon.getLocalizedString(32008) % addontypelabel)
                xbmc.executebuiltin("Skin.Reset(%s.path)" % setting)
                if ret:
                    downloadresourceaddons(addontype)
                    checkresourceaddon(setting, addontype)
    del addon 
开发者ID:kodi-community-addons,项目名称:script.skin.helper.service,代码行数:23,代码来源:resourceaddons.py


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