~ubuntu-dev/ubuntu/lucid/mpd/lucid-201002101854

« back to all changes in this revision

Viewing changes to src/stats.c

  • Committer: Bazaar Package Importer
  • Author(s): Charles Majola
  • Date: 2005-02-15 10:43:58 UTC
  • Revision ID: james.westby@ubuntu.com-20050215104358-w8b7yaqqfmsoxj5k
Tags: upstream-0.11.5
ImportĀ upstreamĀ versionĀ 0.11.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* the Music Player Daemon (MPD)
 
2
 * (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
 
3
 * This project's homepage is: http://www.musicpd.org
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 */
 
18
 
 
19
#include "stats.h"
 
20
 
 
21
#include "tables.h"
 
22
#include "directory.h"
 
23
#include "myfprintf.h"
 
24
#include "player.h"
 
25
 
 
26
#include <time.h>
 
27
 
 
28
Stats stats;
 
29
 
 
30
void initStats() {
 
31
        stats.daemonStart = time(NULL);
 
32
        stats.numberOfSongs = 0;
 
33
        /*stats.playTime = 0;
 
34
        stats.songsPlayed = 0;*/
 
35
}
 
36
 
 
37
int printStats(FILE * fp) {
 
38
        myfprintf(fp,"artists: %li\n",numberOfArtists());
 
39
        myfprintf(fp,"albums: %li\n",numberOfAlbums());
 
40
        myfprintf(fp,"songs: %i\n",stats.numberOfSongs);
 
41
        myfprintf(fp,"uptime: %li\n",time(NULL)-stats.daemonStart);
 
42
        myfprintf(fp,"playtime: %li\n",(long)(getPlayerTotalPlayTime()+0.5));
 
43
        myfprintf(fp,"db_playtime: %li\n",stats.dbPlayTime);
 
44
        /*myfprintf(fp,"songs_played: %li\n",stats.songsPlayed);*/
 
45
        myfprintf(fp,"db_update: %li\n",getDbModTime());
 
46
        return 0;
 
47
}