mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Make maintenance scripts installable
Add wrappers for the maintenance scripts to the setuptools configuration. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
85866796a4
commit
37188603b5
9 changed files with 9 additions and 0 deletions
28
aurweb/scripts/tuvotereminder.py
Executable file
28
aurweb/scripts/tuvotereminder.py
Executable file
|
@ -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()
|
Loading…
Add table
Add a link
Reference in a new issue