2017-05-08 20:54:05 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Statistics for dcav.pw</title>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1>Screenshot statistics for dcav.pw</h1>
|
|
|
|
<h2>Leaderboards</h2>
|
|
|
|
<table>
|
|
|
|
<tr>
|
|
|
|
<th></th>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Count</th>
|
|
|
|
<th>Size</th>
|
|
|
|
</tr>
|
|
|
|
<%
|
|
|
|
require 'filesize'
|
|
|
|
class User
|
2017-05-08 21:14:37 +00:00
|
|
|
attr_accessor :name, :count, :size
|
2017-05-08 20:54:05 +00:00
|
|
|
def <=> (other)
|
|
|
|
other.count <=> count
|
|
|
|
end
|
|
|
|
end
|
|
|
|
usernames = ["christoffermadsen","jmaa","jacob","alexander"]
|
2017-05-08 21:14:37 +00:00
|
|
|
users = []
|
|
|
|
shot_dir = "/var/shots/"
|
2017-05-08 20:54:05 +00:00
|
|
|
usernames.each do |username|
|
2017-05-08 21:14:37 +00:00
|
|
|
user = User.new
|
2017-05-08 20:54:05 +00:00
|
|
|
user.name = username
|
2017-05-08 21:14:37 +00:00
|
|
|
size = `du -B1 #{shot_dir}#{username}/ | awk {'print $1'} | head -n 1`
|
|
|
|
count = `ls -1 #{shot_dir}#{username}/ | wc -l | head -n 1`
|
|
|
|
|
2017-05-08 20:54:05 +00:00
|
|
|
[size,count].each do |x|
|
|
|
|
x.delete! "\n"
|
|
|
|
end
|
2017-05-08 21:14:37 +00:00
|
|
|
|
|
|
|
user.size = size.to_i
|
2017-05-08 20:54:05 +00:00
|
|
|
user.count = count.to_i
|
2017-05-08 21:14:37 +00:00
|
|
|
users << user
|
2017-05-08 20:54:05 +00:00
|
|
|
end
|
|
|
|
count = 0
|
|
|
|
users.sort.each do |user|
|
|
|
|
count += 1
|
2017-05-08 21:14:37 +00:00
|
|
|
%>
|
|
|
|
<%= %Q{
|
|
|
|
<tr>
|
|
|
|
<td>#{count}</td>
|
|
|
|
<td>#{user.name}</td>
|
|
|
|
<td class=\"right-align\">#{user.count}</td>
|
|
|
|
<td class=\"right-align\">#{Filesize.from(user.size.to_s + "B").pretty}</td>
|
|
|
|
</tr>}
|
|
|
|
%>
|
2017-05-08 20:54:05 +00:00
|
|
|
<% end %>
|
|
|
|
</table>
|
|
|
|
<h2>Charts</h2>
|
|
|
|
<img src="img/screenshot_count.svg" />
|
|
|
|
<br />
|
|
|
|
<img src="img/screenshot_size.svg" />
|
|
|
|
<br />
|
|
|
|
<img src="img/dcavpie.svg" />
|
|
|
|
<br />
|
|
|
|
<i>Page generated at <%= Time.now %></i>
|
|
|
|
</body>
|
|
|
|
</html>
|