Code

options: configurable timeout for MPD connections
[ncmpc.git] / src / options.c
index f7044ccbe24ddd9645b77a2e8f66f61c75291b03..1b3e9af09cbfb31e7edf7e79ef41d39094214c92 100644 (file)
@@ -60,6 +60,7 @@ options_t options = {
        .audible_bell = true,
        .bell_on_wrap = true,
        .status_message_time = 3,
+       .timeout_ms = DEFAULT_MPD_TIMEOUT,
 #ifndef NCMPC_MINI
        .scroll = DEFAULT_SCROLL,
        .welcome_screen_list = true,
@@ -368,9 +369,15 @@ options_init(void)
        options.list_format = g_strdup(DEFAULT_LIST_FORMAT);
        options.status_format = g_strdup(DEFAULT_STATUS_FORMAT);
        options.screen_list = g_strsplit_set(DEFAULT_SCREEN_LIST, " ", 0);
+#ifdef ENABLE_LYRICS_SCREEN
+       options.text_editor = g_strdup(DEFAULT_TEXT_EDITOR);
+#endif
 #ifndef NCMPC_MINI
        options.scroll_sep = g_strdup(DEFAULT_SCROLL_SEP);
 #endif
+       if (getenv("MPD_TIMEOUT") != NULL)
+               /* let libmpdclient parse the environment variable */
+               options.timeout_ms = 0;
 }
 
 void