summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Cichoń <michcic@gmail.com>2015-08-25 18:34:55 +0200
committerMichał Cichoń <michcic@gmail.com>2015-08-25 18:37:35 +0200
commit103d71ac2fb3ead96da16d25097f1f559c953fcd (patch)
tree42cf0817c59f83240e70c51cbbcd0269c5324bfd
parentb9d69f88437ece15e6662fc6091c69e9a9aa0ede (diff)
downloadpianobar-windows-103d71ac2fb3ead96da16d25097f1f559c953fcd.tar.gz
pianobar-windows-103d71ac2fb3ead96da16d25097f1f559c953fcd.tar.bz2
pianobar-windows-103d71ac2fb3ead96da16d25097f1f559c953fcd.zip
Add new type of message MSG_DEBUG.
This solve problem of playback time adding to artist when name is short. Debug messages are automatically copied to clipboard for easier debugging due to selection and copying in Windows console is not very convenient.
-rw-r--r--src/settings.c4
-rw-r--r--src/ui_act.c3
-rw-r--r--src/ui_types.h3
3 files changed, 6 insertions, 4 deletions
diff --git a/src/settings.c b/src/settings.c
index 7ed10f5..297cfbc 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -197,6 +197,8 @@ void BarSettingsRead (BarSettings_t *settings) {
settings->msgFormat[MSG_QUESTION].postfix = NULL;
settings->msgFormat[MSG_LIST].prefix = strdup ("\t");
settings->msgFormat[MSG_LIST].postfix = NULL;
+ settings->msgFormat[MSG_DEBUG].prefix = NULL;
+ settings->msgFormat[MSG_DEBUG].postfix = NULL;
for (size_t i = 0; i < BAR_KS_COUNT; i++) {
settings->keys[i] = dispatchActions[i].defaultKey;
@@ -331,7 +333,7 @@ void BarSettingsRead (BarSettings_t *settings) {
} else if (strncmp (formatMsgPrefix, key,
strlen (formatMsgPrefix)) == 0) {
static const char *mapping[] = {"none", "info", "nowplaying",
- "time", "err", "question", "list"};
+ "time", "err", "question", "list", "debug"};
const char *typeStart = key + strlen (formatMsgPrefix);
for (size_t i = 0; i < sizeof (mapping) / sizeof (*mapping); i++) {
if (streq (typeStart, mapping[i])) {
diff --git a/src/ui_act.c b/src/ui_act.c
index 920ca6b..ad7e0fe 100644
--- a/src/ui_act.c
+++ b/src/ui_act.c
@@ -344,8 +344,7 @@ BarUiActCallback(BarUiActDebug) {
assert (selSong != NULL);
/* print debug-alike infos */
- BarUiMsg (&app->settings, MSG_NONE,
- "\033[2K"
+ BarUiMsg (&app->settings, MSG_DEBUG,
"album:\t%s\n"
"artist:\t%s\n"
"audioFormat:\t%i\n"
diff --git a/src/ui_types.h b/src/ui_types.h
index dd3c3f8..aab4199 100644
--- a/src/ui_types.h
+++ b/src/ui_types.h
@@ -32,7 +32,8 @@ typedef enum {
MSG_ERR = 4,
MSG_QUESTION = 5,
MSG_LIST = 6,
- MSG_COUNT = 7, /* invalid type */
+ MSG_DEBUG = 7,
+ MSG_COUNT = 8, /* invalid type */
} BarUiMsg_t;
#endif /* SRC_UI_TYPES_H_2HR75RII */