]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/blob - run/drunk_sum.py
Update top 5 mate stats runnable
[hubacji1/coffee-getter.git] / run / drunk_sum.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 """Print drunk drink in time period."""
4 from sys import argv, exit
5 from cbgetter import CoffeebotGetter
6
7 SS = {
8     "covfefe": "espresso;espresso lungo;cappuccino;latte macchiato",
9     "coffee": "espresso;espresso lungo;cappuccino;latte macchiato",
10     "mate": "Club-Mate 0,5 l;Club-Mate 0,33 l",
11 }
12
13 if __name__ == "__main__":
14     if len(argv) != 4:
15         print("Usage: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
16             "\"espresso lungo\"",
17             "\"2010-10-20\"",
18             "\"2020-10-20\""
19         ))
20         print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
21             "\"espresso lungo;espresso\"",
22             "\"2010-10-20\"",
23             "\"2020-10-20\""
24         ))
25         print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
26             "coffee",
27             "2010-10-20",
28             "2020-10-20"
29         ))
30         print("Instead of beverage real name, you may use:")
31         print("- coffee (for all coffees)")
32         print("- covfefe (equal to coffee)")
33         print("- mate (for all Club-mates)")
34         exit(1)
35     g = CoffeebotGetter()
36     if ";" in argv[1]:
37         g.loadDrunkList(argv[1], argv[2], argv[3])
38     elif argv[1] in SS:
39         g.loadDrunkSum(SS[argv[1]], argv[2], argv[3])
40     else:
41         g.loadDrunkSum(argv[1], argv[2], argv[3])
42     print(g.getMsg())