本文整理汇总了Python中DatabaseHandler.getRequestStats方法的典型用法代码示例。如果您正苦于以下问题:Python DatabaseHandler.getRequestStats方法的具体用法?Python DatabaseHandler.getRequestStats怎么用?Python DatabaseHandler.getRequestStats使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseHandler
的用法示例。
在下文中一共展示了DatabaseHandler.getRequestStats方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: buildAnimeComment
# 需要导入模块: import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler import getRequestStats [as 别名]
def buildAnimeComment(isExpanded, mal, hb, ani, ap, anidb):
try:
comment = ''
title = None
jTitle = None
cType = None
malURL = None
hbURL = None
aniURL = None
apURL = ap
anidbURL = anidb
youtubeTrailer = None
status = None
episodes = None
genres = []
countdown = None
nextEpisode = None
desc = None
if mal:
desc = mal['synopsis']
if mal['type']:
cType = mal['type']
malURL = 'http://myanimelist.net/anime/' + str(mal['id'])
if ani is not None:
title = ani['title_romaji']
aniURL = 'http://anilist.co/anime/' + str(ani['id'])
try:
cType = ani['type']
desc = ani['description']
except:
pass
status = ani['airing_status'].title()
try:
if ani['title_japanese'] is not None:
jTitle = ani['title_japanese']
if ani['youtube_id'] is not None:
youtubeTrailer = ani['youtube_id']
if ani['total_episodes'] is not None:
if ani['total_episodes'] == 0:
episodes = 'Unknown'
else:
episodes = ani['total_episodes']
if ani['genres'] is not None:
genres = ani['genres']
if ani['airing'] is not None:
countdown = ani['airing']['countdown']
nextEpisode = ani['airing']['next_episode']
except:
print('No full details for Anilist')
if hb is not None:
title = hb['title']
desc = hb['synopsis']
status = hb['status']
if hb['show_type']:
cType = hb['show_type']
hbURL = hb['url']
if hb['mal_id'] and not malURL:
malURL = 'http://myanimelist.net/anime/' + str(hb['mal_id'])
if (hb['genres'] is not None) and (not genres):
for genre in hb['genres']:
genres.append(genre['name'])
if (hb['episode_count'] is not None):
episodes = hb['episode_count']
else:
episodes = 'Unknown'
stats = DatabaseHandler.getRequestStats(title,False)
if ani is None:
stats = DatabaseHandler.getRequestStats(hb['title'],False)
else:
stats = DatabaseHandler.getRequestStats(ani['title_romaji'],False)
#---------- BUILDING THE COMMENT ----------#
#----- TITLE -----#
#.........这里部分代码省略.........
示例2: buildMangaComment
# 需要导入模块: import DatabaseHandler [as 别名]
# 或者: from DatabaseHandler import getRequestStats [as 别名]
def buildMangaComment(isExpanded, mal, ani, mu, ap):
try:
comment = ''
title = None
jTitle = None
cType = None
malURL = None
aniURL = None
muURL = mu
apURL = ap
status = None
chapters = None
volumes = None
genres = []
desc = None
if not (mal is None):
title = mal['title']
malURL = 'http://myanimelist.net/manga/' + str(mal['id'])
desc = mal['synopsis']
status = mal['status']
cType = mal['type']
try:
if (int(mal['chapters']) == 0):
chapters = 'Unknown'
else:
chapters = mal['chapters']
except:
chapters = 'Unknown'
try:
volumes = mal['volumes']
except:
volumes = 'Unknown'
if ani is not None:
if title is None:
title = ani['title_english']
aniURL = 'http://anilist.co/manga/' + str(ani['id'])
desc = ani['description']
status = ani['publishing_status'].title()
cType = ani['type']
try:
if ani['title_japanese'] is not None:
jTitle = ani['title_japanese']
if ani['total_chapters'] is not None:
if ani['total_chapters'] == 0:
chapters = 'Unknown'
else:
chapters = ani['total_chapters']
if ani['total_volumes'] is not None:
volumes = ani['total_volumes']
else:
volumes = 'Unknown'
if ani['genres'] is not None:
genres = ani['genres']
except Exception as e:
print(e)
stats = DatabaseHandler.getRequestStats(title,True)
#---------- BUILDING THE COMMENT ----------#
#----- TITLE -----#
comment += '**' + title.strip() + '** - ('
#----- LINKS -----#
urlComments = []
if malURL is not None:
urlComments.append('[MAL](' + malURL + ')')
if apURL is not None:
urlComments.append('[A-P](' + apURL + ')')
if aniURL is not None:
urlComments.append('[ANI](' + aniURL + ')')
if muURL is not None:
urlComments.append('[MU](' + muURL + ')')
for i, link in enumerate(urlComments):
if i is not 0:
comment += ', '
comment += link
comment += ')'
#----- JAPANESE TITLE -----#
if (isExpanded):
#.........这里部分代码省略.........