forked from alexkingorg/iTunes-Stats
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstats.php
More file actions
executable file
·104 lines (86 loc) · 2.26 KB
/
Copy pathstats.php
File metadata and controls
executable file
·104 lines (86 loc) · 2.26 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
require_once('config.inc.php');
require_once('backend/objects.inc.php');
require_once('backend/functions.inc.php');
$database_connection = mysql_connect(
$database_host
, $database_user
, $database_pass
);
if ($database_connection) {
if (!mysql_select_db($database_name, $database_connection)) {
die('<p>Error selecting database: '.$database_name);
}
}
else {
die('<p>Error connecting to database: '.$database_host);
}
$result = mysql_query("
SELECT sum(play_count)
FROM song
") or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "Plays: ".number_format($row[0]);
echo "<br>";
$plays = $row[0];
}
$day = 1;
$month = 1;
$year = 2010;
$startunix = mktime (0, 0, 0, $month, $day, $year);
$nowunix = time();
$timeunix = $nowunix - $startunix;
$time = floor($timeunix / (24 * 60 * 60));
$goal = 1000000;
$result = mysql_query("
SELECT count(play_count)
FROM song
") or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "Songs: ".number_format($row[0]);
echo "<br>";
}
$result = mysql_query("
SELECT count(name)
FROM artist
") or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "Artists: ".number_format($row[0]);
echo "<br>";
}
$result = mysql_query("
SELECT count(name)
FROM album
") or die(mysql_error());
while($row = mysql_fetch_array($result)){
echo "Albums: ".number_format($row[0]);
echo "<br>";
}
$day = 1;
$month = 12;
$year = 2009;
$startunix = mktime (0, 0, 0, $month, $day, $year);
$nowunix = time();
$timeunix = $nowunix - $startunix;
$time = floor($timeunix / (24 * 60 * 60));
$goal = 1000000000;
$left = $goal - $plays;
$perday = $plays / $time;
$til = $left / $perday;
echo "Plays perday: ".number_format($perday, 2)."<br>";
echo "Days to 1 bil: ".number_format($til, 2)."<br>";
//convert plays to data
$data = $plays*4;
//$mb = $data/1048576;
$gb = $data/1024;
$tb = $gb/1024;
$pb = $tb/1024;
echo "PB used: ".number_format($pb, 3)."<br>";
echo "<a href='index.php'>Index</a>";
echo "<br>";
echo "<a href='artist.php'>Top Artists</a>";
echo "<br>";
echo "<a href='song.php'>Top Songs</a>";
echo "<br>";
echo "<a href='album.php'>Top Albums</a>";
?>