diff --git a/CHANGELOG.org b/CHANGELOG.org index 0e1c3ae..b151e72 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -11,6 +11,9 @@ New feature: get an anime info from page ** 0.3.0 <2022-07-09> New feature: send a notification -** 0.4.1 <2022-07-09> - New feature: check for new url or update state +** 0.4.2 <2022-07-09> + New feature: check for a new url and for the updated state New small feature: add the urls config file + Little Fix: add update status in quotes +** 0.4.3 <2022-07-09> + New small feature: repeating checking the content. diff --git a/src/main.py b/src/main.py index 9f3b2e4..7bc6ab6 100644 --- a/src/main.py +++ b/src/main.py @@ -20,6 +20,7 @@ from db import DataBase from scraper import Scraper from notify import Notification +import time def get_urls(file_path): """Read file that containes urls.""" @@ -53,15 +54,18 @@ def main(): # Checks for new urls in file and add as current state # If one of page has updated then notifing. - for url in urls: - data = scr.get_anime(url) - if data == None: - continue - url, title, status = data - r = db.add_anime_if(url, title, status) - if r == -1: - n = Notification(title, MESSAGE) - n.send() + # Repeating the checking with the waiting period. + while True: + for url in urls: + data = scr.get_anime(url) + if data == None: + continue + url, title, status = data + r = db.add_anime_if(url, title, status) + if r == -1: + n = Notification(title, MESSAGE) + n.send() + time.sleep(WAITING_PERIOD) if __name__ == "__main__": main()