def print_desc(self, last_summary=None):
     if last_summary is None or last_summary.content != self.content:
         print("=======================================================")
         print(colorize(self.content, fg=GREEN))
         print("=======================================================")
         return self.content
     return None
 def print_desc(self, last_summary=None):
     if last_summary is None or (
             last_summary.content != self.content and self.confirm_count >= last_summary.confirm_count
             and self.survive_count >= last_summary.survive_count):
         print("=======================================================")
         print(colorize(self.content, fg=GREEN))
         print("=======================================================")
         return self.content
     return None
def notify_event(event):
    title = event.get_title()
    if OutputHelper.is_terminal_output:
        colorized = colorize(title, fg=YELLOW) + "\n" + event.summary + "\n" + event.source_url
        desc = "--------------                                               \n" + colorized
        print(u' '.join([desc]).encode('utf-8').strip())

    if OutputHelper.is_lark_output:
        msg = u"%s\\n%s" % (event.summary, event.source_url)
        notify_lark(title, msg, OutputHelper.lark_url)
def notify_summary(summary, increase_confirm_count, increase_dead_count, increase_survive_count):
    title = ''
    if increase_confirm_count > 0:
        title = u"%s 新增确诊 %d 例" % (title, increase_confirm_count)
    if increase_dead_count > 0:
        title = u"%s 新增死亡 %d 例" % (title, increase_dead_count)
    if increase_survive_count > 0:
        title = u"%s 新增痊愈 %d 例" % (title, increase_survive_count)

    if OutputHelper.is_terminal_output:
        print("=======================================================")
        terminal_info = colorize(summary.content, fg=GREEN)
        if len(title) > 0:
            terminal_info = "[" + title + "] " + terminal_info

        print(u' '.join([terminal_info]).encode('utf-8').strip())
        print("=======================================================")
    if OutputHelper.is_lark_output:
        notify_lark(title=title, msg=summary.content, lark_url=OutputHelper.lark_url)
    def print_desc(self):
        title = self.get_title()

        print(colorize(title, fg=YELLOW))
        print(self.summary)
 def __init__(self):
     print colorize("丁香园实时: ", fg=YELLOW) + "https://3g.dxy.cn/newh5/view/pneumonia"
    def get_desc(self):
        title = self.get_title()

        return colorize(title, fg=YELLOW) + "\n" \
               + self.summary