aurweb/aurweb/scripts/tuvotereminder.py
Lukas Fleischer cb307bf01a Do not hardcode path to the Python interpreter
Use `/usr/bin/env python3` instead of `/usr/bin/python3` in the shebang
of Python scripts. This adds support for non-standard Python interpreter
paths such as the paths used in virtualenv environments.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2017-08-25 07:01:12 +02:00

28 lines
624 B
Python
Executable file

#!/usr/bin/env python3
import subprocess
import time
import aurweb.config
import aurweb.db
notify_cmd = aurweb.config.get('notifications', 'notify-cmd')
def main():
conn = aurweb.db.Connection()
now = int(time.time())
filter_from = now + 500
filter_to = now + 172800
cur = conn.execute("SELECT ID FROM TU_VoteInfo " +
"WHERE End >= ? AND End <= ?",
[filter_from, filter_to])
for vote_id in [row[0] for row in cur.fetchall()]:
subprocess.Popen((notify_cmd, 'tu-vote-reminder', str(vote_id))).wait()
if __name__ == '__main__':
main()