Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions nauta.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env python3
import sys
sys.path.append('tools/')

from pprint import pprint
from textwrap import dedent
Expand All @@ -15,6 +17,7 @@
import re

import logging
from timeset import *

CONFIG_DIR = os.path.expanduser("~/.local/share/nauta/")
try:
Expand Down Expand Up @@ -196,6 +199,7 @@ def up(args):
time.sleep(1)
if not os.path.exists(LOGOUT_URL_FILE):
break
timer(args, login_time, down)
except KeyboardInterrupt:
print("Got a Ctrl+C, logging out...")
log("Got Ctrl+C. Attempting disconnect...")
Expand Down Expand Up @@ -454,6 +458,7 @@ def main(args):
up_parser = subparsers.add_parser('up')
up_parser.set_defaults(func=up)
up_parser.add_argument('username', nargs="?")
up_parser.add_argument('time', nargs="?")

down_parser = subparsers.add_parser('down')
down_parser.set_defaults(func=down)
Expand Down
Binary file added tools/__pycache__/timeset.cpython-39.pyc
Binary file not shown.
6 changes: 6 additions & 0 deletions tools/timeset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import time
def timer(limit_time, init_time, logout_fun):
print('diff', int(time.time()) - init_time)
if limit_time.time and int(time.time()) - init_time >= int(limit_time.time):
print('You will be disconnected')
logout_fun([])