def waiting(self, semester, year, crns, alarm, rate): from lib.animation import load_animation, countdown from lib.searchbot import searchbot bot = searchbot(init=False) bot.setData(year=year, term=semester) changes = [self.notifychange(-1, alarm_) for alarm_ in alarm] while True: t_ = int(rate) * 60 result = "" print("Press Ctrl-C to quit") animation = load_animation("Fetching requested classes information", clear_at_end=False) timer = countdown(t_) animation.start() seats, result = self.printresult(year, semester, crns) for seat, change, option in zip(seats, changes, alarm): if change is not None: change = change(int(seat)) else: change = self.notifychange(seat, option) animation.end = True time.sleep(1) print(result) timer.start() while(t_): time.sleep(1) t_ -= 1
def isexit(self, signum, frame): from lib.animation import load_animation x = load_animation("Quitting", clear_at_end=False) x.start() for t in threading.enumerate(): t.end = True sys.exit(0)
def search(self, semester, year, crns): from lib.animation import load_animation animation = load_animation("Fetching requested classes information", clear_at_end=False) animation.start() _, result = self.printresult(year, semester, crns) animation.end = True time.sleep(1) print(result) return result
def save(self, semester, year, file_name): from lib.animation import load_animation from lib.searchbot import searchbot self.animation = load_animation("Fetching html file", clear_at_end=False) self.animation.start() loc = searchbot(year=year, term=semester).saveHtml(file_name=file_name) self.animation.end = True time.sleep(1) result = "Successfully Saved to " + loc print(result) return result