本文整理汇总了Python中Search.buildLightNovelReply方法的典型用法代码示例。如果您正苦于以下问题:Python Search.buildLightNovelReply方法的具体用法?Python Search.buildLightNovelReply怎么用?Python Search.buildLightNovelReply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Search
的用法示例。
在下文中一共展示了Search.buildLightNovelReply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_comment
# 需要导入模块: import Search [as 别名]
# 或者: from Search import buildLightNovelReply [as 别名]
#.........这里部分代码省略.........
#AUTHOR SEARCH EXPANDED
for match in re.finditer("\<{2}([^>]*)\>{2}:\(([^)]+)\)", comment.body, re.S):
reply = ''
if (forceNormal) or (str(comment.subreddit).lower() in disableexpanded):
reply = Search.buildMangaReplyWithAuthor(match.group(1), match.group(2), False, comment)
else:
reply = Search.buildMangaReplyWithAuthor(match.group(1), match.group(2), True, comment)
if (reply is not None):
mangaArray.append(reply)
#Normal Manga
#NORMAL
for match in re.finditer("(?<=(?<!\<)\<)([^\<\>]+)\>(?!(:|\>))", comment.body, re.S):
reply = Search.buildMangaReply(match.group(1), False, comment)
if (reply is not None):
mangaArray.append(reply)
#AUTHOR SEARCH
for match in re.finditer("(?<=(?<!\<)\<)([^\<\>]*)\>:\(([^)]+)\)", comment.body, re.S):
reply = Search.buildMangaReplyWithAuthor(match.group(1), match.group(2), False, comment)
if (reply is not None):
mangaArray.append(reply)
#Expanded LN
for match in re.finditer("\]{2}([^]]*)\[{2}", comment.body, re.S):
reply = ''
if (forceNormal) or (str(comment.subreddit).lower() in disableexpanded):
reply = Search.buildLightNovelReply(match.group(1), False, comment)
else:
reply = Search.buildLightNovelReply(match.group(1), True, comment)
if (reply is not None):
lnArray.append(reply)
#Normal LN
for match in re.finditer("(?<=(?<!\])\])([^\]\[]*)(?=\[(?!\[))", comment.body, re.S):
reply = Search.buildLightNovelReply(match.group(1), False, comment)
if (reply is not None):
lnArray.append(reply)
#Here is where we create the final reply to be posted
#The final comment reply. We add stuff to this progressively.
commentReply = ''
#Basically just to keep track of people posting the same title multiple times (e.g. {Nisekoi}{Nisekoi}{Nisekoi})
postedAnimeTitles = []
postedMangaTitles = []
postedLNTitles = []
#Adding all the anime to the final comment. If there's manga too we split up all the paragraphs and indent them in Reddit markup by adding a '>', then recombine them
for i, animeReply in enumerate(animeArray):
if not (i is 0):
commentReply += '\n\n'
if not (animeReply['title'] in postedAnimeTitles):
postedAnimeTitles.append(animeReply['title'])
commentReply += animeReply['comment']