]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/blob - run/drunk_sum.py
Update changelog (hotfix)
[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 }
11
12 if __name__ == "__main__":
13     if len(argv) != 4:
14         print("Usage: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
15             "\"espresso lungo\"",
16             "\"2010-10-20\"",
17             "\"2020-10-20\""
18         ))
19         print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
20             "\"espresso lungo;espresso\"",
21             "\"2010-10-20\"",
22             "\"2020-10-20\""
23         ))
24         print("Or: PYTHONPATH=. python3 run/drunk_sum.py {} {} {}".format(
25             "coffee",
26             "2010-10-20",
27             "2020-10-20"
28         ))
29         exit(1)
30     g = CoffeebotGetter()
31     if ";" in argv[1]:
32         g.loadDrunkList(argv[1], argv[2], argv[3])
33     elif argv[1] in SS:
34         g.loadDrunkSum(SS[argv[1]], argv[2], argv[3])
35     else:
36         g.loadDrunkSum(argv[1], argv[2], argv[3])
37     print(g.getMsg())