Skip to content

Commit ea2f8e9

Browse files
committed
update script
1 parent 51c4029 commit ea2f8e9

File tree

3 files changed

+99
-56
lines changed

3 files changed

+99
-56
lines changed

docs/index.html

+47-25
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,24 @@
2626

2727
<div class="container bg-light">
2828
<h1>Hexo Theme Stats Report of 2024-02-16</h1>
29+
<p>Star Data</p>
2930
<div class="row">
30-
<div id="canvas-holder" style="width:80%">
31-
<canvas id="fork_chart-area">3</canvas>
31+
<div id="canvas-holder" style="width:100%">
32+
<canvas id="star_chart-area">2</canvas>
3233
</div>
3334
</div>
35+
3436
<div class="row">
35-
<div id="canvas-holder" style="width:80%">
36-
<canvas id="star_chart-area">2</canvas>
37+
<div id="canvas-holder" style="width:100%">
38+
<canvas id="fork_chart-area">1</canvas>
3739
</div>
3840
</div>
41+
42+
43+
3944
<div class="row">
4045

41-
<div id="canvas-holder" style="width:80%">
46+
<div id="canvas-holder" style="width:100%">
4247
<canvas id="watch_chart-area">1</canvas>
4348
</div>
4449
</div>
@@ -49,14 +54,17 @@ <h1>Hexo Theme Stats Report of 2024-02-16</h1>
4954

5055

5156

57+
58+
59+
5260
<script>
53-
var fork_config = {
54-
type: 'pie',
61+
var star_config = {
62+
type: 'bar',
5563
data: {
5664
datasets: [{
5765
data:
5866

59-
[1538, 1242, 1207, 1107, 746, 673, 590, 572, 553, 526]
67+
[6726, 6422, 6183, 5132, 4027, 2962, 2780, 2592, 2202, 1924]
6068

6169
,
6270
backgroundColor: [
@@ -71,29 +79,37 @@ <h1>Hexo Theme Stats Report of 2024-02-16</h1>
7179
window.chartColors.green,
7280
window.chartColors.blue,
7381
],
74-
label: 'Forks'
82+
label: 'stars'
7583
}],
76-
labels: ['Icarus ', 'Matery ', 'Butterfly ', 'Fluid ', 'Cactus ', 'Maupassant ', 'Volantis ', 'Material ', 'indigo ', 'Apollo ']
84+
labels: ['Fluid', 'Butterfly', 'Icarus', 'Matery', 'Material', 'Cactus', 'indigo', 'Maupassant', 'NexT', 'Volantis']
7785
},
7886
options: {
7987
responsive: true,
8088
title: {
8189
display: true,
82-
text: 'Hexo Theme Fork Data'
90+
text: 'Hexo Theme star Data'
8391
},
92+
scales: {
93+
y: {
94+
beginAtZero: true
95+
}
96+
}
8497
}
8598
};
99+
100+
86101
var colorNames = Object.keys(window.chartColors);
87102
</script>
88-
103+
104+
89105
<script>
90-
var star_config = {
91-
type: 'pie',
106+
var fork_config = {
107+
type: 'bar',
92108
data: {
93109
datasets: [{
94110
data:
95111

96-
[6726, 6422, 6183, 5132, 4027, 2962, 2780, 2592, 2202, 1924]
112+
[1538, 1242, 1207, 1107, 746, 673, 590, 572, 553, 526]
97113

98114
,
99115
backgroundColor: [
@@ -108,31 +124,31 @@ <h1>Hexo Theme Stats Report of 2024-02-16</h1>
108124
window.chartColors.green,
109125
window.chartColors.blue,
110126
],
111-
label: 'stars'
127+
label: 'Forks'
112128
}],
113-
labels: ['Fluid ', 'Butterfly ', 'Icarus ', 'Matery ', 'Material ', 'Cactus ', 'indigo ', 'Maupassant ', 'NexT ', 'Volantis ']
129+
labels: ['Icarus', 'Matery', 'Butterfly', 'Fluid', 'Cactus', 'Maupassant', 'Volantis', 'Material', 'indigo', 'Apollo']
114130
},
115131
options: {
116132
responsive: true,
117133
title: {
118134
display: true,
119-
text: 'Hexo Theme star Data'
135+
text: 'Hexo Theme Fork Data'
120136
},
121137
}
122138
};
123-
124-
125139
var colorNames = Object.keys(window.chartColors);
126140
</script>
141+
142+
127143

128144
<script>
129145
var watch_config = {
130-
type: 'pie',
146+
type: 'bar',
131147
data: {
132148
datasets: [{
133149
data:
134150

135-
[6726, 6422, 6183, 5132, 4027, 2962, 2780, 2592, 2202, 1924]
151+
[83, 79, 70, 61, 59, 59, 54, 50, 43, 40]
136152

137153
,
138154
backgroundColor: [
@@ -149,7 +165,7 @@ <h1>Hexo Theme Stats Report of 2024-02-16</h1>
149165
],
150166
label: 'watchs'
151167
}],
152-
labels: ['Fluid ', 'Butterfly ', 'Icarus ', 'Matery ', 'Material ', 'Cactus ', 'indigo ', 'Maupassant ', 'NexT ', 'Volantis ']
168+
labels: ['Material', 'Icarus', 'indigo', 'Maupassant', 'Yelee', 'Matery', 'Keep', 'Jacman', 'Hueman', 'Apollo']
153169
},
154170
options: {
155171
responsive: true,
@@ -159,14 +175,20 @@ <h1>Hexo Theme Stats Report of 2024-02-16</h1>
159175
},
160176
}
161177
};
178+
179+
</script>
180+
181+
182+
<script>
162183

163184
window.onload = function () {
164-
var fork_ctx = document.getElementById('fork_chart-area').getContext('2d');
165-
new Chart(fork_ctx, fork_config);
185+
166186
var star_ctx = document.getElementById('star_chart-area').getContext('2d');
167187
new Chart(star_ctx, star_config);
168188
var watch_ctx = document.getElementById('watch_chart-area').getContext('2d');
169189
new Chart(watch_ctx, watch_config);
190+
var fork_ctx = document.getElementById('fork_chart-area').getContext('2d');
191+
new Chart(fork_ctx, fork_config);
170192
};
171193

172194

get_info.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def get_theme_list():
2020
__themes_list = []
2121
for theme in themes:
2222
x = {}
23-
x['name'] = theme.find('a', attrs={'class': 'plugin-name'}).text
24-
x['link'] = theme.find('a', attrs={'class': 'plugin-name'}).get('href')
25-
x['description'] = theme.find('p', attrs={'class': 'plugin-desc'}).text
23+
x['name'] = theme.find('a', attrs={'class': 'plugin-name'}).text.strip()
24+
x['link'] = theme.find('a', attrs={'class': 'plugin-name'}).get('href').strip()
25+
x['description'] = theme.find('p', attrs={'class': 'plugin-desc'}).text.strip()
2626
__themes_list.append(x)
2727
return __themes_list
2828

@@ -47,7 +47,7 @@ def get_theme_info_from_api(link):
4747
json_info = info.json()
4848
fork = json_info["forks_count"]
4949
star = json_info["stargazers_count"]
50-
watch = json_info["watchers_count"]
50+
watch = json_info["subscribers_count"]
5151
return {'watch':watch,'star': star, 'fork': fork}
5252
except Exception as e:
5353
logging.exception(e)
@@ -113,7 +113,7 @@ def main():
113113
results, key=lambda k: k['watch'], reverse=True)[:10]
114114

115115
def write_out(theme_list, file_name):
116-
with open(file_name, 'w') as f:
116+
with open(file_name, 'w',encoding="utf-8") as f:
117117
f.write(json.dumps(theme_list, indent=4, ensure_ascii=False))
118118
paths = ["report/{}".format(x) for x in ['star', 'fork', 'watch','total']]
119119
for path in paths:

templates/layout.html

+47-26
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,22 @@
2727
<div class="container bg-light">
2828
<h1>Hexo Theme Stats Report of {% if today%}{{today}}{%else%}Today{%endif%}</h1>
2929
<div class="row">
30-
<div id="canvas-holder" style="width:80%">
31-
<canvas id="fork_chart-area">3</canvas>
30+
<div id="canvas-holder" style="width:100%">
31+
<canvas id="star_chart-area">2</canvas>
3232
</div>
3333
</div>
34+
3435
<div class="row">
35-
<div id="canvas-holder" style="width:80%">
36-
<canvas id="star_chart-area">2</canvas>
36+
<div id="canvas-holder" style="width:100%">
37+
<canvas id="fork_chart-area">1</canvas>
3738
</div>
3839
</div>
40+
41+
42+
3943
<div class="row">
4044

41-
<div id="canvas-holder" style="width:80%">
45+
<div id="canvas-holder" style="width:100%">
4246
<canvas id="watch_chart-area">1</canvas>
4347
</div>
4448
</div>
@@ -48,15 +52,18 @@ <h1>Hexo Theme Stats Report of {% if today%}{{today}}{%else%}Today{%endif%}</h1>
4852

4953

5054

51-
{# fork #}
55+
56+
57+
58+
{# star #}
5259
<script>
53-
var fork_config = {
54-
type: 'pie',
60+
var star_config = {
61+
type: 'bar',
5562
data: {
5663
datasets: [{
5764
data:
58-
{% if fork_data %}
59-
{{ fork_data }}
65+
{% if star_data %}
66+
{{ star_data }}
6067
{% endif %}
6168
,
6269
backgroundColor: [
@@ -71,29 +78,37 @@ <h1>Hexo Theme Stats Report of {% if today%}{{today}}{%else%}Today{%endif%}</h1>
7178
window.chartColors.green,
7279
window.chartColors.blue,
7380
],
74-
label: 'Forks'
81+
label: 'stars'
7582
}],
76-
labels: {% if fork_labels %} {{ fork_labels }} {% endif %}
83+
labels: {% if star_labels %} {{ star_labels }} {% endif %}
7784
},
7885
options: {
7986
responsive: true,
8087
title: {
8188
display: true,
82-
text: 'Hexo Theme Fork Data'
89+
text: 'Hexo Theme star Data'
8390
},
91+
scales: {
92+
y: {
93+
beginAtZero: true
94+
}
95+
}
8496
}
8597
};
98+
99+
86100
var colorNames = Object.keys(window.chartColors);
87101
</script>
88-
{# star #}
102+
103+
{# fork #}
89104
<script>
90-
var star_config = {
91-
type: 'pie',
105+
var fork_config = {
106+
type: 'bar',
92107
data: {
93108
datasets: [{
94109
data:
95-
{% if star_data %}
96-
{{ star_data }}
110+
{% if fork_data %}
111+
{{ fork_data }}
97112
{% endif %}
98113
,
99114
backgroundColor: [
@@ -108,26 +123,26 @@ <h1>Hexo Theme Stats Report of {% if today%}{{today}}{%else%}Today{%endif%}</h1>
108123
window.chartColors.green,
109124
window.chartColors.blue,
110125
],
111-
label: 'stars'
126+
label: 'Forks'
112127
}],
113-
labels: {% if star_labels %} {{ star_labels }} {% endif %}
128+
labels: {% if fork_labels %} {{ fork_labels }} {% endif %}
114129
},
115130
options: {
116131
responsive: true,
117132
title: {
118133
display: true,
119-
text: 'Hexo Theme star Data'
134+
text: 'Hexo Theme Fork Data'
120135
},
121136
}
122137
};
123-
124-
125138
var colorNames = Object.keys(window.chartColors);
126139
</script>
140+
141+
127142
{# watch #}
128143
<script>
129144
var watch_config = {
130-
type: 'pie',
145+
type: 'bar',
131146
data: {
132147
datasets: [{
133148
data:
@@ -159,14 +174,20 @@ <h1>Hexo Theme Stats Report of {% if today%}{{today}}{%else%}Today{%endif%}</h1>
159174
},
160175
}
161176
};
177+
178+
</script>
179+
180+
181+
<script>
162182

163183
window.onload = function () {
164-
var fork_ctx = document.getElementById('fork_chart-area').getContext('2d');
165-
new Chart(fork_ctx, fork_config);
184+
166185
var star_ctx = document.getElementById('star_chart-area').getContext('2d');
167186
new Chart(star_ctx, star_config);
168187
var watch_ctx = document.getElementById('watch_chart-area').getContext('2d');
169188
new Chart(watch_ctx, watch_config);
189+
var fork_ctx = document.getElementById('fork_chart-area').getContext('2d');
190+
new Chart(fork_ctx, fork_config);
170191
};
171192

172193

0 commit comments

Comments
 (0)