-
Notifications
You must be signed in to change notification settings - Fork 3
/
time-tan
executable file
·80 lines (65 loc) · 2.09 KB
/
time-tan
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
import time, os, sys, argparse
# optional cli arguments
parser = argparse.ArgumentParser()
parser.add_argument('-t', '--time', help='Specify the time in minutes', type=int, required=False)
parser.add_argument('-a', '--anime', help='Enter any anime you wish to watch', type=str, required=False)
args = parser.parse_args()
# Makes the header purple
def prPurple(skk): print("\033[95m {}\033[00m" .format(skk))
# Returns the Time-tan header
def header():
header = " _______ __\n /_ __(_)___ ___ ___ / /_____ _____\n / / / / __ `__ \/ _ \______/ __/ __ `/ __ \ \n / / / / / / / / / __/_____/ /_/ /_/ / / / /\n /_/ /_/_/ /_/ /_/\___/ \__/\__,_/_/ /_/"
return header
def sysClear():
if os.name == 'posix':
os.system('clear')
else:
os.system('cls')
# Menu
def userInput():
sysClear()
prPurple(header() + "\n")
print("""
1. Select an anime manually
2. Continue last watched anime
3. Exit
""")
while True:
x = input(" Select an option > ")
if x == '1':
sysClear()
prPurple(header() + "\n")
y = input("\n What do you want to watch? > ")
return y
elif x == '2':
return '-c'
elif x == '3':
sysClear()
sys.exit()
else:
continue
def manualTime():
os.system('clear||cls')
prPurple(header())
y = input("\n How long do you want to study? (leave blank for 25 mins) > ")
if y == '':
y = 24
return int(y)
def animedoroTime():
prPurple(header() + "\n")
inTime = args.time if args.time else manualTime()
curTime = 0
option = args.anime if args.anime else userInput()
while True:
if inTime != 0:
sysClear()
prPurple(header() + "\n")
print(" ",inTime - curTime,"mins remain")
curTime = curTime + 1
time.sleep(60)
if curTime == inTime:
sysClear()
os.system(f'ani-cli {option}')
break
animedoroTime()