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
0d449d8d
Commit
0d449d8d
authored
Jan 18, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stats: no CamelCase
Renamed functions and types.
parent
e8c148ab
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
23 deletions
+26
-23
command.c
src/command.c
+1
-1
main.c
src/main.c
+1
-1
stats.c
src/stats.c
+11
-11
stats.h
src/stats.h
+13
-10
No files found.
src/command.c
View file @
0d449d8d
...
...
@@ -1061,7 +1061,7 @@ static enum command_return
handle_stats
(
struct
client
*
client
,
G_GNUC_UNUSED
int
argc
,
G_GNUC_UNUSED
char
*
argv
[])
{
return
printStats
(
client
);
return
stats_print
(
client
);
}
static
enum
command_return
...
...
src/main.c
View file @
0d449d8d
...
...
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
if
(
options
.
kill
)
killFromPidFile
();
initStats
();
stats_global_init
();
tag_lib_init
();
log_init
(
options
.
verbose
,
options
.
stdOutput
);
...
...
src/stats.c
View file @
0d449d8d
...
...
@@ -26,18 +26,17 @@
#include "strset.h"
#include "dbUtils.h"
S
tats
stats
;
struct
s
tats
stats
;
void
initStats
(
void
)
void
stats_global_init
(
void
)
{
stats
.
daemonStart
=
time
(
NULL
);
stats
.
numberOfSongs
=
0
;
stats
.
start_time
=
time
(
NULL
);
}
void
stats_update
(
void
)
{
stats
.
numberOfSongs
=
countSongsIn
(
NULL
);
stats
.
dbPlayTime
=
sumSongTimesIn
(
NULL
);
stats
.
song_count
=
countSongsIn
(
NULL
);
stats
.
song_duration
=
sumSongTimesIn
(
NULL
);
}
struct
visit_data
{
...
...
@@ -63,7 +62,8 @@ visit_tag_items(struct song *song, void *_data)
return
0
;
}
static
unsigned
int
getNumberOfTagItems
(
int
type
)
static
unsigned
int
getNumberOfTagItems
(
enum
tag_type
type
)
{
struct
visit_data
data
=
{
.
type
=
type
,
...
...
@@ -78,7 +78,7 @@ static unsigned int getNumberOfTagItems(int type)
return
ret
;
}
int
printStats
(
struct
client
*
client
)
int
stats_print
(
struct
client
*
client
)
{
client_printf
(
client
,
"artists: %u
\n
"
...
...
@@ -90,10 +90,10 @@ int printStats(struct client *client)
"db_update: %li
\n
"
,
getNumberOfTagItems
(
TAG_ITEM_ARTIST
),
getNumberOfTagItems
(
TAG_ITEM_ALBUM
),
stats
.
numberOfSongs
,
time
(
NULL
)
-
stats
.
daemonStart
,
stats
.
song_count
,
time
(
NULL
)
-
stats
.
start_time
,
(
long
)(
getPlayerTotalPlayTime
()
+
0
.
5
),
stats
.
dbPlayTime
,
stats
.
song_duration
,
db_get_mtime
());
return
0
;
}
src/stats.h
View file @
0d449d8d
...
...
@@ -21,20 +21,23 @@
struct
client
;
typedef
struct
_Stats
{
unsigned
long
daemonStart
;
int
numberOfSongs
;
unsigned
long
dbPlayTime
;
/*unsigned long playTime;
unsigned long songsPlayed; */
}
Stats
;
struct
stats
{
unsigned
long
start_time
;
extern
Stats
stats
;
/** number of song files in the music directory */
unsigned
song_count
;
void
initStats
(
void
);
/** sum of all song durations in the music directory (in
seconds) */
unsigned
long
song_duration
;
};
extern
struct
stats
stats
;
void
stats_global_init
(
void
);
void
stats_update
(
void
);
int
printStats
(
struct
client
*
client
);
int
stats_print
(
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