-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoxOffice_cli.py
More file actions
77 lines (58 loc) · 1.85 KB
/
BoxOffice_cli.py
File metadata and controls
77 lines (58 loc) · 1.85 KB
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
#-*- coding: utf-8 -*-
"""
本程序可获取国内当天票房数据,
并将其可视化。
Usage:
Today boxoffice:
python BoxOffice_cli.py
Sum boxoffice:
python BoxOffice_cli.py -sum
Month boxoffice:
python BoxOffice_cli.py -m month("xxxx-xx")
Taipei weekend boxoffice:
python BoxOffice_cli.py -tw
US weekend boxoffice:
python Boxoffice_cli.py -us
"""
import sys
from plot_figure import plt_fig,plt_fig_month
from tw_boxoffice import tw_fig
from us_boxoffice import us_fig
__author__ = 'wellenwoo'
class Main(object):
def __init__(self):
"""预定义参数"""
self.fig = plt_fig()
self.fig_month = plt_fig_month()
self.tw_fig = tw_fig()
self.us_fig = us_fig()
def day_boxoffice(self):
self.fig.day_boxoffice(title = u'本日票房',ylabel = u'票房\万元')
def sum_boxoffice(self):
self.fig.sum_boxoffice(title =u'本日影片累计票房',ylabel = u'累计票房\万元')
def month_boxoffice(self,month):
title = u'{m}月份票房'.format(m = month)
self.fig_month.day_boxoffice(title,u'票房\万元',month)
def tw_boxoffice(self):
self.tw_fig.weekend()
def us_boxoffice(self):
self.us_fig.weekend()
if __name__ == '__main__':
print(__doc__)
main = Main()
if len(sys.argv)==1:
main.day_boxoffice()
elif len(sys.argv)==2:
action = sys.argv[1]
if action =="-sum":
main.sum_boxoffice()
elif action =="-tw":
main.tw_boxoffice()
elif action =="-us":
main.us_boxoffice()
elif len(sys.argv)==3:
month = sys.argv[2]
main.month_boxoffice(month)
else:
print(__doc__)