removed extra lines, added in some comments
This commit is contained in:
parent
9ae1602ec7
commit
111a7cb832
15
main.py
15
main.py
@ -13,9 +13,13 @@ try:
|
|||||||
old_ts = dt.strptime(open('last_check','r').read(),'%Y-%m-%d %H:%M:%S:%f')
|
old_ts = dt.strptime(open('last_check','r').read(),'%Y-%m-%d %H:%M:%S:%f')
|
||||||
except:
|
except:
|
||||||
old_ts = dt.strptime('20230101000000','%Y%m%d%H%M%S')
|
old_ts = dt.strptime('20230101000000','%Y%m%d%H%M%S')
|
||||||
|
|
||||||
# load in the relevant .env variables
|
# load in the relevant .env variables
|
||||||
dotenv.load_dotenv()
|
dotenv.load_dotenv()
|
||||||
conf = dotenv.dotenv_values()
|
conf = dotenv.dotenv_values()
|
||||||
|
discord_user = conf['DISCORD_USERNAME']
|
||||||
|
dicord_webhook_url = conf['DISCORD_WEBHOOK_TEST']
|
||||||
|
webhook = SyncWebhook.from_url(conf['DISCORD_WEBHOOK_TEST'])
|
||||||
|
|
||||||
# list with urls to check
|
# list with urls to check
|
||||||
the_urls = [
|
the_urls = [
|
||||||
@ -26,16 +30,7 @@ the_urls = [
|
|||||||
'https://github.com/superseriousbusiness/gotosocial/releases.atom'
|
'https://github.com/superseriousbusiness/gotosocial/releases.atom'
|
||||||
]
|
]
|
||||||
|
|
||||||
discord_user = conf['DISCORD_USERNAME']
|
# loop through urls for latest release
|
||||||
dicord_webhook_url = conf['DISCORD_WEBHOOK_TEST']
|
|
||||||
webhook = SyncWebhook.from_url(conf['DISCORD_WEBHOOK_TEST'])
|
|
||||||
|
|
||||||
# test the last release date against the last check date:
|
|
||||||
# if old_ts.rstrip() != '' and {{release_date}} > old_ts.rstrip():
|
|
||||||
# post
|
|
||||||
# else:
|
|
||||||
# break
|
|
||||||
|
|
||||||
for url in the_urls:
|
for url in the_urls:
|
||||||
release = feedparser.parse(url)
|
release = feedparser.parse(url)
|
||||||
release_date = dt.strptime(release['entries'][0]['updated'], '%Y-%m-%dT%H:%M:%SZ')
|
release_date = dt.strptime(release['entries'][0]['updated'], '%Y-%m-%dT%H:%M:%SZ')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user