Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

o Less cluttered output in UI if -D is not set.

  • Loading branch information...
commit 20e139ca3c9785d6d8d26e6f527c865f81c56019 1 parent 3dc037e
@hzeller authored
Showing with 26 additions and 9 deletions.
  1. +2 −1  folve-main.cc
  2. +21 −8 status-server.cc
  3. +3 −0  status-server.h
View
3  folve-main.cc
@@ -196,7 +196,8 @@ static int usage(const char *prg) {
"\t-r <refresh> : Seconds between refresh of status page;\n"
"\t Default is %d seconds; switch off with -1.\n"
"\t-g : Gapless convolving alphabetically adjacent files.\n"
- "\t-D : Moderate volume Folve debug messages to syslog.\n"
+ "\t-D : Moderate volume Folve debug messages to syslog,\n"
+ "\t and some more detailed configuration info in UI\n"
"\t-f : Operate in foreground; useful for debugging.\n"
"\t-o <mnt-opt> : other generic mount parameters passed to fuse.\n"
"\t-d : High volume fuse debug log. Implies -f.\n",
View
29 status-server.cc
@@ -152,6 +152,12 @@ StatusServer::~StatusServer() {
if (daemon_) MHD_stop_daemon(daemon_);
}
+bool StatusServer::show_details() {
+ // Right now, we just make this dependent on debug output. Could be a separate
+ // option.
+ return folve::IsDebugLogEnabled();
+}
+
// FileHandlerCache::Observer interface.
void StatusServer::RetireHandlerEvent(FileHandler *handler) {
HandlerStats stats;
@@ -265,18 +271,24 @@ static void CreateSelection(std::string *result,
const bool active = (int) i == selected;
if (active) {
Appendf(result, "<span title='%s' class='filter_sel active'>%s</span>\n",
- option_titles[i].c_str(), c.c_str());
+ (option_titles.size() > i) ? option_titles[i].c_str() : "",
+ c.c_str());
} else {
Appendf(result, "<a title='%s' class='filter_sel inactive' "
"href='%s?f=%zd'>%s</a>\n",
- option_titles[i].c_str(), kSettingsUrl, i, c.c_str());
+ (option_titles.size() > i) ? option_titles[i].c_str() : "",
+ kSettingsUrl, i, c.c_str());
}
}
}
void StatusServer::AppendSettingsForm() {
content_.append("<p>Active filter: ");
- CreateSelection(&content_, filesystem_->config_dirs(), ui_config_directories_,
+ CreateSelection(&content_,
+ show_details()
+ ? filesystem_->config_dirs()
+ : std::vector<std::string>(),
+ ui_config_directories_,
filesystem_->current_cfg_index());
if (filesystem_->config_dirs().size() == 1) {
content_.append(" (This is a boring configuration, add filter directories "
@@ -316,10 +328,11 @@ const std::string &StatusServer::CreatePage() {
Appendf(&content_, "<center style='background-color:#A0FFA0;'>"
"Welcome to "
"<a href='https://github.com/hzeller/folve#readme'>Folve</a> "
- FOLVE_VERSION "</center>\n"
- "Convolving audio files from <code>%s</code>\n",
- filesystem_->underlying_dir().c_str());
-
+ FOLVE_VERSION "</center>\n");
+ if (show_details()) {
+ Appendf(&content_, "Convolving audio files from <code>%s</code>\n",
+ filesystem_->underlying_dir().c_str());
+ }
AppendSettingsForm();
std::vector<HandlerStats> stat_list;
@@ -335,7 +348,7 @@ const std::string &StatusServer::CreatePage() {
active_filtered += stats.duration_seconds * stats.progress;
}
}
- if (folve::IsDebugLogEnabled()) {
+ if (show_details()) {
const int t_seen = total_seconds_music_seen_ + active_music_seen;
const int t_filtered = total_seconds_filtered_ + active_filtered;
Appendf(&content_, "Total opening files <b>%d</b> "
View
3  status-server.h
@@ -61,6 +61,9 @@ class StatusServer : protected FileHandlerCache::Observer {
void SetFilter(const char *value);
void SetDebug(const char *value);
+ // Show details that might only be interesting while setting up things.
+ bool show_details();
+
// -- interface FileHandlerCache::Observer
virtual void InsertHandlerEvent(FileHandler *handler) {}
virtual void RetireHandlerEvent(FileHandler *handler);
Please sign in to comment.
Something went wrong with that request. Please try again.