(New small feature) 0.4.3 - repeating checking the content
This commit is contained in:
+5
-2
@@ -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.
|
||||
|
||||
+13
-9
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user