2
0
Fork 0

Add counter and report for each service checked

This commit is contained in:
Carlos Galindo 2023-09-07 13:26:15 +02:00
parent eb4228b698
commit fd915d92a3

View file

@ -146,6 +146,7 @@ class FeedReader:
return None
return feed.entries[0]
def read_feed(self) -> bool | None:
'''Read a feed and post an issue if a new item is found'''
entry = self.first_item()
@ -219,5 +220,19 @@ class GithubReader(GithubTagReader):
if __name__ == "__main__":
from config import FEED_READERS
fail = 0
ok = 0
posted = 0
for reader in FEED_READERS:
reader.read_feed()
res = reader.read_feed()
if res == None:
print(f"No versions of {reader.name} available.")
fail += 1
elif res == False:
ok += 1
elif res == True:
print(f"{reader.name} outdated, issue posted!")
posted += 1
else:
print(f"{reader.name} read with status {res}")
print(f"I've added {posted} new issues, {fail} items have no versions and {ok} items are up to date.")