diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-10-17 15:20:29 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-10-17 15:23:13 +0200 |
commit | 37188603b52a3dac23df229ada82c7da0c3d9c00 (patch) | |
tree | f7df7af7edcd8ca49fe1354883537013d020319f /aurweb/scripts/tuvotereminder.py | |
parent | 85866796a40923708f6b868c32ddc2f2f4417d1d (diff) | |
download | aur-37188603b52a3dac23df229ada82c7da0c3d9c00.tar.gz aur-37188603b52a3dac23df229ada82c7da0c3d9c00.tar.xz |
Make maintenance scripts installable
Add wrappers for the maintenance scripts to the setuptools
configuration.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb/scripts/tuvotereminder.py')
-rwxr-xr-x | aurweb/scripts/tuvotereminder.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/aurweb/scripts/tuvotereminder.py b/aurweb/scripts/tuvotereminder.py new file mode 100755 index 00000000..97b1d12e --- /dev/null +++ b/aurweb/scripts/tuvotereminder.py @@ -0,0 +1,28 @@ +#!/usr/bin/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() |