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
099a2cb5
Commit
099a2cb5
authored
Nov 22, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stats: print db statistics only if db is available
Fixes crash on "stats" in certain configurations.
parent
042fe2a9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
NEWS
NEWS
+1
-0
Stats.cxx
src/Stats.cxx
+19
-6
No files found.
NEWS
View file @
099a2cb5
ver 0.18.5 (20??/??/??)
* configuration
- fix crash when db_file is configured without music_directory
- fix crash on "stats" without db_file/music_directory
* database
- proxy: auto-reload statistics
* decoder
...
...
src/Stats.cxx
View file @
099a2cb5
...
...
@@ -45,6 +45,8 @@ void stats_global_finish(void)
void
stats_update
(
void
)
{
assert
(
GetDatabase
()
!=
nullptr
);
Error
error
;
DatabaseStats
stats2
;
...
...
@@ -59,9 +61,11 @@ void stats_update(void)
}
}
void
stats_print
(
Client
&
client
)
static
void
db_
stats_print
(
Client
&
client
)
{
assert
(
GetDatabase
()
!=
nullptr
);
if
(
!
db_is_simple
())
/* reload statistics if we're using the "proxy"
database plugin */
...
...
@@ -73,14 +77,10 @@ stats_print(Client &client)
"artists: %u
\n
"
"albums: %u
\n
"
"songs: %u
\n
"
"uptime: %lu
\n
"
"playtime: %lu
\n
"
"db_playtime: %lu
\n
"
,
stats
.
artist_count
,
stats
.
album_count
,
stats
.
song_count
,
(
unsigned
long
)
g_timer_elapsed
(
uptime
,
NULL
),
(
unsigned
long
)(
client
.
player_control
.
GetTotalPlayTime
()
+
0.5
),
stats
.
total_duration
);
if
(
db_is_simple
())
...
...
@@ -88,3 +88,16 @@ stats_print(Client &client)
"db_update: %lu
\n
"
,
(
unsigned
long
)
db_get_mtime
());
}
void
stats_print
(
Client
&
client
)
{
client_printf
(
client
,
"uptime: %lu
\n
"
"playtime: %lu
\n
"
,
(
unsigned
long
)
g_timer_elapsed
(
uptime
,
NULL
),
(
unsigned
long
)(
client
.
player_control
.
GetTotalPlayTime
()
+
0.5
));
if
(
GetDatabase
()
!=
nullptr
)
db_stats_print
(
client
);
}
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