Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a6c5928c
Commit
a6c5928c
authored
Sep 07, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stats: don't pass "fd" to printStats()
Pass the client struct instead of the raw file descriptor.
parent
93e6d4c3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
command.c
src/command.c
+1
-1
stats.c
src/stats.c
+17
-10
stats.h
src/stats.h
+3
-1
No files found.
src/command.c
View file @
a6c5928c
...
...
@@ -999,7 +999,7 @@ static int handleRandom(struct client *client, mpd_unused int *permission,
static
int
handleStats
(
struct
client
*
client
,
mpd_unused
int
*
permission
,
mpd_unused
int
argc
,
mpd_unused
char
*
argv
[])
{
return
printStats
(
client
_get_fd
(
client
)
);
return
printStats
(
client
);
}
static
int
handleClearError
(
mpd_unused
struct
client
*
client
,
mpd_unused
int
*
permission
,
...
...
src/stats.c
View file @
a6c5928c
...
...
@@ -20,7 +20,7 @@
#include "directory.h"
#include "tag.h"
#include "
myfprintf
.h"
#include "
client
.h"
#include "player_control.h"
#include "tagTracker.h"
#include "os_compat.h"
...
...
@@ -33,15 +33,22 @@ void initStats(void)
stats
.
numberOfSongs
=
0
;
}
int
printStats
(
int
fd
)
int
printStats
(
struct
client
*
client
)
{
fdprintf
(
fd
,
"artists: %i
\n
"
,
getNumberOfTagItems
(
TAG_ITEM_ARTIST
));
fdprintf
(
fd
,
"albums: %i
\n
"
,
getNumberOfTagItems
(
TAG_ITEM_ALBUM
));
fdprintf
(
fd
,
"songs: %i
\n
"
,
stats
.
numberOfSongs
);
fdprintf
(
fd
,
"uptime: %li
\n
"
,
time
(
NULL
)
-
stats
.
daemonStart
);
fdprintf
(
fd
,
"playtime: %li
\n
"
,
(
long
)(
getPlayerTotalPlayTime
()
+
0
.
5
));
fdprintf
(
fd
,
"db_playtime: %li
\n
"
,
stats
.
dbPlayTime
);
fdprintf
(
fd
,
"db_update: %li
\n
"
,
getDbModTime
());
client_printf
(
client
,
"artists: %i
\n
"
"albums: %i
\n
"
"songs: %i
\n
"
"uptime: %li
\n
"
"playtime: %li
\n
"
"db_playtime: %li
\n
"
"db_update: %li
\n
"
,
getNumberOfTagItems
(
TAG_ITEM_ARTIST
),
getNumberOfTagItems
(
TAG_ITEM_ALBUM
),
stats
.
numberOfSongs
,
time
(
NULL
)
-
stats
.
daemonStart
,
(
long
)(
getPlayerTotalPlayTime
()
+
0
.
5
),
stats
.
dbPlayTime
,
getDbModTime
());
return
0
;
}
src/stats.h
View file @
a6c5928c
...
...
@@ -19,6 +19,8 @@
#ifndef STATS_H
#define STATS_H
struct
client
;
typedef
struct
_Stats
{
unsigned
long
daemonStart
;
int
numberOfSongs
;
...
...
@@ -31,6 +33,6 @@ extern Stats stats;
void
initStats
(
void
);
int
printStats
(
int
fd
);
int
printStats
(
struct
client
*
client
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment