blob: d944b37ae688e982be693468d3ae0321e986de41 (
plain) (
blame)
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
|
#!/usr/bin/python
import os
import sys
sys.path.insert(0, "/usr/share/Watcher/")
import watch_log as x
from commands import Color
import commands as cmd
from analysis import weekly_logs
def help_option():
print(Color.BLUE("Watcher") + " - Minimal open source screen-time tracker\n")
print(Color.YELLOW("USAGE:")+"\n\t watcher [OPTION]\n")
print(Color.YELLOW("OPTIONS"))
print("\t-ds, --day-summary Shows today's screen-time and app-usage")
print("\t-ds [date] Shows that day's screen-time and app-usage\n\t\t\t\t\t (if date is not given then date=today's date)")
print("\t-ws, --week-summary Shows screen-time of each day of that running week")
print("\t-ws [week] Shows screen-time of each day of that week given by you")
print("\t-s, --start It starts taking logs afterwards in following directory ~/.cache/Watcher/raw_data/")
print(Color.YELLOW("\nEXAMPLE COMMANDS"))
print("\twatcher -ds 2022-01-31")
print("\twatcher -ws W01-2022")
print("\nFor more information see github repo: "+ Color.BLUE("https://github.com/Waishnav/Watcher") +" and Don't forget to star the repo")
def wrong_option():
print(Color.RED("Wrong")+" [OPTION] choosen. Have a look at the Options!!\n")
print(Color.YELLOW("OPTIONS"))
print("\t-ds or --day-summary [date] Displays where you have spend your time of that day")
print("\t-ws or --week-summary [week] Displays screen-time of each day of week")
print(Color.YELLOW("\nEXAMPLE COMMANDS"))
print("\twatcher -ds 2022-01-31")
print("\twatcher -ws W01-2022")
print("\nFor more information see github repo: "+ Color.BLUE("https://github.com/Waishnav/Watcher") +" and Don't forget to star the repo")
#print("▒▒▒\t▒▒▒\n███")
arg = sys.argv
if len(arg) == 2:
if arg[1] == "-ds" or arg[1] == "--day-summary":
cmd.daily_summary()
elif arg[1] == "-ws" or arg[1] == "--week-summary":
weekly_logs()
cmd.week_summary()
elif arg[1] == "-h" or arg[1] == "--help":
help_option()
elif arg[1] == "--start" or arg[1] == "-s":
print("Log creations started... \nif you wanna stop it, use keyboard-shortcut (Ctrl+Shift+C or Ctrl+C)")
x.log_creation()
elif arg[1] == "--version" or arg[1] == "-v":
print("Version: 1.3")
else:
wrong_option()
elif len(arg) == 3:
if arg[1] == "-ds" or arg[1] == "--day-summary":
if len(arg[2]) == 10:
cmd.daily_summary(str(arg[2]))
else:
wrong_option()
elif arg[1] == "-ws" or arg[1] == "--week-summary":
if len(arg[2]) == 8:
weekly_logs(str(arg[2]))
cmd.week_summary(str(arg[2]))
else:
wrong_option()
else:
wrong_option()
else:
wrong_option()
#parser = argparse.ArgumentParser(description="Minimal open source screen-time calulator for digitally wellbeing")
#parser.add_argument()
#args = parser.parse_args()
#print(args)
|