def history(ret): m = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') data = Followed.select(Followed).order_by(Followed.updated_time.asc()) year = None month = None print_info('Bangumi Timeline') for i in data: if i.status == STATUS_DELETED: slogan = ' ABANDON' color = RED else: slogan = 'FINISHED' color = GREEN if not i.updated_time: date = datetime.datetime.fromtimestamp(0) else: date = datetime.datetime.fromtimestamp(int(i.updated_time)) if date.year != 1970: if date.year != year: print('%s%s%s' % (GREEN, str(date.year), COLOR_END)) year = date.year if date.year == year and date.month != month: print(' |\n |--- %s%s%s\n | |' % (YELLOW, m[date.month - 1], COLOR_END)) month = date.month print(' | |--- [%s%s%s] %s' % (color, slogan, COLOR_END, i.bangumi_name))
def history(ret): m = ( "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December", ) data = Followed.select(Followed).order_by(Followed.updated_time.asc()) bangumi_data = Bangumi.get_updating_bangumi() year = None month = None updating_bangumi = list( map(lambda s: s["name"], itertools.chain(*bangumi_data.values()))) print_info("Bangumi Timeline") for i in data: if i.status == STATUS_DELETED: slogan = "ABANDON" color = RED else: if i.bangumi_name in updating_bangumi: slogan = "FOLLOWING" color = YELLOW else: slogan = "FINISHED" color = GREEN if not i.updated_time: date = datetime.datetime.fromtimestamp(0) else: date = datetime.datetime.fromtimestamp(int(i.updated_time)) if date.year != 1970: if date.year != year: print("{}{}{}".format(GREEN, str(date.year), COLOR_END)) year = date.year if date.year == year and date.month != month: print(" |\n |--- {}{}{}\n | |".format( YELLOW, m[date.month - 1], COLOR_END)) month = date.month print(" | |--- [{}{:<9}{}] ({:<2}) {}".format( color, slogan, COLOR_END, i.episode, i.bangumi_name))
def history(ret): m = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') data = Followed.select(Followed).order_by(Followed.updated_time.asc()) bangumi_data = Bangumi.get_updating_bangumi() year = None month = None updating_bangumi = list( map(lambda s: s['name'], itertools.chain(*bangumi_data.values()))) print_info('Bangumi Timeline') for i in data: if i.status == STATUS_DELETED: slogan = 'ABANDON' color = RED else: if i.bangumi_name in updating_bangumi: slogan = 'FOLLOWING' color = YELLOW else: slogan = 'FINISHED' color = GREEN if not i.updated_time: date = datetime.datetime.fromtimestamp(0) else: date = datetime.datetime.fromtimestamp(int(i.updated_time)) if date.year != 1970: if date.year != year: print('%s%s%s' % (GREEN, str(date.year), COLOR_END)) year = date.year if date.year == year and date.month != month: print(' |\n |--- %s%s%s\n | |' % (YELLOW, m[date.month - 1], COLOR_END)) month = date.month print(' | |--- [%s%-9s%s] (%-2s) %s' % (color, slogan, COLOR_END, i.episode, i.bangumi_name))
def history(ret): m = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December') data = Followed.select(Followed).order_by(Followed.updated_time.asc()) bangumi_data = Bangumi.get_updating_bangumi() year = None month = None updating_bangumi = list(map(lambda s: s['name'], itertools.chain(*bangumi_data.values()))) print_info('Bangumi Timeline') for i in data: if i.status == STATUS_DELETED: slogan = 'ABANDON' color = RED else: if i.bangumi_name in updating_bangumi: slogan = 'FOLLOWING' color = YELLOW else: slogan = 'FINISHED' color = GREEN if not i.updated_time: date = datetime.datetime.fromtimestamp(0) else: date = datetime.datetime.fromtimestamp(int(i.updated_time)) if date.year != 1970: if date.year != year: print('%s%s%s' % (GREEN, str(date.year), COLOR_END)) year = date.year if date.year == year and date.month != month: print(' |\n |--- %s%s%s\n | |' % (YELLOW, m[date.month - 1], COLOR_END)) month = date.month print(' | |--- [%s%-9s%s] (%-2s) %s' % (color, slogan, COLOR_END, i.episode, i.bangumi_name))