本文整理汇总了Python中pulsar.provider.register函数的典型用法代码示例。如果您正苦于以下问题:Python register函数的具体用法?Python register怎么用?Python register使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了register函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: search_movie
return results
def search_movie(info):
if settings.language == 'en': # Title in english
query = info['title'].encode('utf-8') # convert from unicode
if len(info['title']) == len(query): # it is a english title
query += ' ' + str(info['year']) # Title + year
else:
query = common.IMDB_title(info['imdb_id']) # Title + year
else: # Title en foreign language
query = common.translator(info['imdb_id'], settings.language) # Just title
query += ' #MOVIE&FILTER' # to use movie filters
return search(query)
def search_episode(info):
if info['absolute_number'] == 0:
query = info['title'].encode('utf-8') + ' s%02de%02d' % (info['season'], info['episode']) # define query
else:
query = info['title'].encode('utf-8') + ' %02d' % info['absolute_number'] # define query anime
query += ' #TV&FILTER' # to use TV filters
return search(query)
# This registers your module for use
provider.register(search, search_movie, search_episode)
del settings
del browser
del filters
开发者ID:Inter95,项目名称:tutvguia,代码行数:30,代码来源:main.py
示例2: parseJsonResults
def parseJsonResults(self, json):
results = []
if not 'torrents' in json:
self.provider.log.info('Error: %s %s'%(json['error_code'], json['error']))
return []
for torrent in json['torrents']:
self.provider.log.info('Getting torrent %s'%torrent['id'])
results.append({
"name": torrent['name'],
"uri": "%s/torrents/download/%s|Authorization=%s"%(self.provider.get_setting('url_address'), torrent['id'], self.token),
# "uri": "%s/torrents/download/%s"%(self.provider.get_setting('url_address'), torrent['id']),
# "info_hash": string
# "trackers": [string, ...]
"size": int(torrent['size']),
"seeds": int(torrent['seeders']),
"peers": int(torrent['leechers']),
"is_private": True
# "resolution": int
# "video_codec": int
# "audio_codec": int
# "rip_type": int
# "scene_rating": int
# "language": string (ISO 639-1)
})
return results
fp = t411FuriousProvider(provider)
provider.register(fp.search, fp.searchMovie, fp.searchEpisode)
开发者ID:abuisine,项目名称:furiouspulsar,代码行数:29,代码来源:main.py
注:本文中的pulsar.provider.register函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论