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


Python common.i18n函数代码示例

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


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

示例1: __auth_ip

 def __auth_ip(self, media_id):
     header = i18n('flashx_auth_header')
     line1 = i18n('auth_required')
     line2 = i18n('visit_link')
     line3 = i18n('click_pair') % 'http://flashx.tv/pair'
     with common.kodi.CountdownDialog(header, line1, line2, line3, countdown=120) as cd:
         return cd.start(self.__check_auth, [media_id])
开发者ID:marfegte,项目名称:repositorio-marfegte,代码行数:7,代码来源:flashx.py

示例2: __auth_ip

 def __auth_ip(self, media_id):
     header = i18n('vevio_auth_header')
     line1 = i18n('auth_required')
     line2 = i18n('visit_link')
     line3 = i18n('click_pair') % 'https://vev.io/pair'
     with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
         return cd.start(self.__check_auth, [media_id])
开发者ID:azzy9,项目名称:script.module.urlresolver,代码行数:7,代码来源:vevio.py

示例3: __auth_ip

 def __auth_ip(self, media_id):
     header = i18n('stream_auth_header')
     line1 = i18n('auth_required')
     line2 = i18n('visit_link')
     line3 = i18n('click_pair') % ('http://api.streamin.to/pair')
     with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
         return cd.start(self.__check_auth, [media_id])
开发者ID:Barefootedsoul,项目名称:script.module.urlresolver,代码行数:7,代码来源:streaminto.py

示例4: __auth_ip

 def __auth_ip(self, media_id):
     js_data = self.__get_json(INFO_URL)
     pair_url = js_data.get('result', {}).get('auth_url', '')
     if pair_url:
         pair_url = pair_url.replace('\/', '/')
         header = i18n('ol_auth_header')
         line1 = i18n('auth_required')
         line2 = i18n('visit_link')
         line3 = i18n('click_pair').decode('utf-8') % (pair_url)
         with common.kodi.CountdownDialog(header, line1, line2, line3) as cd:
             return cd.start(self.__check_auth, [media_id])
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:11,代码来源:openload.py

示例5: get_settings_xml

 def get_settings_xml(cls):
     xml = super(cls, cls).get_settings_xml()
     # xml.append('<setting id="%s_autopick" type="bool" label="%s" default="false"/>' % (
     #    cls.__name__, i18n('auto_primary_link')))
     xml.append(
         '<setting id="%s_auth" type="action" label="%s" action="RunPlugin(plugin://script.module.urlresolver/?mode=auth_ad)"/>' % (
             cls.__name__, i18n('auth_my_account')))
     xml.append(
         '<setting id="%s_reset" type="action" label="%s" action="RunPlugin(plugin://script.module.urlresolver/?mode=reset_ad)"/>' % (
             cls.__name__, i18n('reset_my_auth')))
     xml.append('<setting id="%s_token" visible="false" type="text" default=""/>' % cls.__name__)
     return xml
开发者ID:azzy9,项目名称:script.module.urlresolver,代码行数:12,代码来源:alldebrid.py

示例6: _auto_update

 def _auto_update(self, py_source, py_path, key=''):
     try:
         if self.get_setting('auto_update') == 'true' and py_source:
             headers = self.net.http_HEAD(py_source).get_headers(as_dict=True)
             common.logger.log(headers)
             old_etag = self.get_setting('etag')
             new_etag = headers.get('Etag', '')
             old_len = common.file_length(py_path, key)
             new_len = int(headers.get('Content-Length', 0))
             py_name = os.path.basename(py_path)
             
             if old_etag != new_etag or old_len != new_len:
                 common.logger.log('Updating %s: |%s|%s|%s|%s|' % (py_name, old_etag, new_etag, old_len, new_len))
                 self.set_setting('etag', new_etag)
                 new_py = self.net.http_GET(py_source).content
                 if new_py:
                     if key:
                         new_py = common.decrypt_py(new_py, key)
                         
                     if new_py and 'import' in new_py:
                         with open(py_path, 'w') as f:
                             f.write(new_py.encode('utf-8'))
                         common.kodi.notify('%s %s' % (self.name, common.i18n('resolver_updated')))
             else:
                 common.logger.log('Reusing existing %s: |%s|%s|%s|%s|' % (py_name, old_etag, new_etag, old_len, new_len))
             common.log_file_hash(py_path)
     except Exception as e:
         common.logger.log_warning('Exception during %s Auto-Update code retrieve: %s' % (self.name, e))
开发者ID:azzy9,项目名称:script.module.urlresolver,代码行数:28,代码来源:resolver.py

示例7: pick_source

def pick_source(sources, auto_pick=None):
    if auto_pick is None:
        auto_pick = common.get_setting('auto_pick') == 'true'
        
    if len(sources) == 1:
        return sources[0][1]
    elif len(sources) > 1:
        if auto_pick:
            return sources[0][1]
        else:
            result = xbmcgui.Dialog().select(common.i18n('choose_the_link'), [str(source[0]) if source[0] else 'Unknown' for source in sources])
            if result == -1:
                raise ResolverError(common.i18n('no_link_selected'))
            else:
                return sources[result][1]
    else:
        raise ResolverError(common.i18n('no_video_link'))
开发者ID:azzy9,项目名称:script.module.urlresolver,代码行数:17,代码来源:helpers.py

示例8: get_media_url

    def get_media_url(self, host, media_id):
        result = self.__check_auth(media_id)
        if not result:
            result = self.__auth_ip(media_id)

        if result:
            return helpers.get_media_url(result, patterns=['''src:\s*["'](?P<url>[^"']+).+?res:\s*(?P<label>\d+)'''], result_blacklist=["trailer"], generic_patterns=False).replace(' ', '%20')

        raise ResolverError(i18n('no_ip_authorization'))
开发者ID:marfegte,项目名称:repositorio-marfegte,代码行数:9,代码来源:flashx.py

示例9: get_media_url

    def get_media_url(self, host, media_id):
        result = self.__check_auth(media_id)
        if not result:
            result = self.__auth_ip(media_id)

        if result:
            return helpers.pick_source(result.items()) + helpers.append_headers(self.headers)

        raise ResolverError(i18n('no_ip_authorization'))
开发者ID:Barefootedsoul,项目名称:script.module.urlresolver,代码行数:9,代码来源:vshareeu.py

示例10: get_media_url

    def get_media_url(self, host, media_id):
        try:
            if not self.__file_exists(media_id):
                raise ResolverError('File Not Available')

            video_url = self.__check_auth(media_id)
            if not video_url:
                video_url = self.__auth_ip(media_id)
        except ResolverError:
            raise

        if video_url:
            headers = {'User-Agent': common.RAND_UA}
            video_url = video_url + helpers.append_headers(headers)
            return video_url
        else:
            raise ResolverError(i18n('no_ol_auth'))
开发者ID:amadu80,项目名称:repository.xvbmc,代码行数:17,代码来源:openload.py

示例11: get_media_url

 def get_media_url(self, host, media_id):
     web_url = self.get_url(host, media_id)
     headers = {'Referer': web_url}
     headers.update(self.headers)
     html = self.net.http_GET(web_url, headers=headers).content
     sources = helpers.scrape_sources(html, patterns=["""file:\s*["'](?P<url>[^"']+)"""])
     if sources:
         auth = self.__check_auth(media_id)
         if not auth:
             auth = self.__auth_ip(media_id)
             
         if auth:
             return helpers.pick_source(sources) + helpers.append_headers(headers)
         else:
             raise ResolverError(i18n('no_ip_authorization'))
     else:
         raise ResolverError('Unable to locate links')
开发者ID:Barefootedsoul,项目名称:script.module.urlresolver,代码行数:17,代码来源:streaminto.py

示例12: get_media_url

    def get_media_url(self, host, media_id):
        url = helpers.get_media_url(self.get_url(host, media_id), result_blacklist=['intro_black']).replace(' ', '%20')
        net = common.Net()
        headers = {}

        if '|' in url:
            qs_header_split = url.split('|')
            url = qs_header_split[0]

            headers = urlparse.parse_qs(qs_header_split[1])
            headers = dict((k, v[0]) for k, v in headers.iteritems())

        response = net.http_HEAD(url, headers=headers)
        if(response.get_url()):
            return response.get_url() + helpers.append_headers(headers)
        else:
            raise ResolverError(common.i18n('no_video_link'))
开发者ID:Barefootedsoul,项目名称:script.module.urlresolver,代码行数:17,代码来源:vidzella.py

示例13: get_media_url

 def get_media_url(self, host, media_id):
     try:
         self._auto_update(self.get_setting('url'), OL_PATH, self.get_setting('key'))
         reload(ol_gmu)
         return ol_gmu.get_media_url(self.get_url(host, media_id))  # @UndefinedVariable
     except Exception as e:
         logger.log_debug('Exception during openload resolve parse: %s' % (e))
         try:
             if not self.__file_exists(media_id):
                 raise ResolverError('File Not Available')
             
             video_url = self.__check_auth(media_id)
             if not video_url:
                 video_url = self.__auth_ip(media_id)
         except ResolverError:
             raise
         
         if video_url:
             return video_url
         else:
             raise ResolverError(i18n('no_ol_auth'))
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:21,代码来源:openload.py

示例14: get_settings_xml

 def get_settings_xml(cls):
     xml = super(cls, cls).get_settings_xml()
     xml.append('<setting id="%s_client_id" type="text" label="%s" default="%s"/>' % (cls.__name__, i18n('client_id'), 'am6l6dn0x3bxrdgc557p1qeg1ma3bto'))
     return xml
开发者ID:Barefootedsoul,项目名称:script.module.urlresolver,代码行数:4,代码来源:twitchtv.py

示例15: get_settings_xml

    def get_settings_xml(cls, include_login=True):
        """
        This method should return XML which describes the settings you would
        like for your plugin. You should make sure that the ``id`` starts
        with your plugins class name (which can be found using
        :attr:`cls.__name__`) followed by an underscore.

        Override this method if you want your plugin to have more settings than
        just 'priority'. If you do and still want the defaults settings you
        should call this method from the base class first.

        Returns:
            A list containing XML elements that will be valid in settings.xml
        """
        xml = [
            '<setting id="%s_priority" type="number" label="%s" default="100"/>' % (cls.__name__, common.i18n('priority')),
            '<setting id="%s_enabled" ''type="bool" label="%s" default="true"/>' % (cls.__name__, common.i18n('enabled'))
        ]
        if include_login:
            xml.append('<setting id="%s_login" ''type="bool" label="%s" default="true" visible="false"/>' % (cls.__name__, common.i18n('login')))
        return xml
开发者ID:azzy9,项目名称:script.module.urlresolver,代码行数:21,代码来源:resolver.py


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