-
Notifications
You must be signed in to change notification settings - Fork 0
/
outline_service.py
executable file
·33 lines (26 loc) · 1.03 KB
/
outline_service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python3
import sqlite3
from datetime import datetime
from outline.core.outline import Outline
import logging
from time import sleep
from pathlib import Path
from os import path
BASE_DIR = Path(__file__).resolve().parent
while True:
date = datetime.today().date()
db = sqlite3.connect(path.join(BASE_DIR, 'db.sqlite3'))
keys = db.execute(f'select * from outline_link where exp_date="{str(date)}" and enabled=1').fetchall()
for key in keys:
apiUrl = db.execute(f'select * from outline_server where id={key[10]}').fetchone()[2]
outline_server = Outline(apiUrl)
if outline_server.set_date_limit(key[11], 1_000_000):
# db.execute(f'delete from outline_link where id={key[0]}')
db.execute(f'update outline_link set max_size=1000000, enabled=0 where id={key[0]}')
db.commit()
logging.info(f'{key[1]}')
print(f'{key[1]}')
else:
logging.error(f'the key {key} did not deleted from server')
db.close()
sleep(3600)