]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Ensure metadata and cover art are enabled if metadata support is included at compilat...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 13 Jul 2020 09:47:10 +0000 (10:47 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 13 Jul 2020 09:47:10 +0000 (10:47 +0100)
dacp.c
metadata_hub.c
shairport.c

diff --git a/dacp.c b/dacp.c
index c6b9968fde5c2334437b085232973bfa1ca8a5bf..a5d0d659860407928c20f9a1952ae8e839fbfbe5 100644 (file)
--- a/dacp.c
+++ b/dacp.c
@@ -154,7 +154,7 @@ int dacp_send_command(const char *command, char **body, ssize_t *bodysize) {
   // debug(1,"dacp_send_command: command is: \"%s\".",command);
 
   if (dacp_server.port == 0) {
-    debug(3, "No DACP port specified yet");
+    // debug(3, "No DACP port specified yet");
     result = 490; // no port specified
   } else {
 
@@ -504,11 +504,13 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
                (metadata_store.advanced_dacp_server_active != 0);
       metadata_store.dacp_server_active = 0;
       metadata_store.advanced_dacp_server_active = 0;
+      /*
       debug(3,
             "setting metadata_store.dacp_server_active and "
             "metadata_store.advanced_dacp_server_active to 0 with an update "
             "flag value of %d",
             ch);
+      */
       metadata_hub_modify_epilog(ch);
 
       uint64_t time_to_wait_for_wakeup_ns =
@@ -1249,7 +1251,7 @@ int dacp_get_volume(int32_t *the_actual_volume) {
     } else {
       debug(1, "Unexpected return code %d from dacp_get_speaker_list.", http_response);
     }
-  } else if (http_response != 400) {
+  } else if ((http_response != 400) && (http_response != 490)) {
     debug(3, "Unexpected return code %d from dacp_get_client_volume.", http_response);
   }
   if (the_actual_volume) {
index 190895c0a432cb0bfda3869b20370950a0bb1ca3..7b20ae18d2f6c99fddbeb61a3e1850eba092c62c 100644 (file)
@@ -148,7 +148,7 @@ void _metadata_hub_modify_prolog(const char *filename, const int linenumber) {
        }
        last_metadata_hub_modify_prolog_file = strdup(filename);
        last_metadata_hub_modify_prolog_line = linenumber;
-    debug(3, "Metadata_hub write lock acquired.");
+    // debug(3, "Metadata_hub write lock acquired.");
   }
   metadata_hub_re_lock_access_is_delayed = 0;
 }
@@ -169,7 +169,7 @@ void _metadata_hub_modify_epilog(int modified, const char *filename, const int l
                }
   }
   pthread_rwlock_unlock(&metadata_hub_re_lock);
-  debug(3, "Metadata_hub write lock unlocked.");
+  // debug(3, "Metadata_hub write lock unlocked.");
 }
 
 /*
index 14e5072575c32f6da842f359a84f4e8143bfdc15..975b71fc6100c51b17ad265f6340d635c2cde852 100644 (file)
@@ -266,7 +266,7 @@ void usage(char *progname) {
   printf("    --metadata-pipename=PIPE send metadata to PIPE, e.g. "
          "--metadata-pipename=/tmp/shairport-sync-metadata.\n");
   printf("                            The default is /tmp/shairport-sync-metadata.\n");
-  printf("    --get-coverart          send cover art through the metadata pipe.\n");
+  printf("    -g, --get-coverart      send cover art through the metadata pipe.\n");
 #endif
   printf("    -u, --use-stderr        log messages through STDERR rather than the system log.\n");
   printf("\n");
@@ -418,6 +418,17 @@ int parse_options(int argc, char **argv) {
   // seconds then we can add an offset of 5.17 seconds and still leave a second's worth of buffers
   // for unexpected circumstances
 
+#ifdef CONFIG_METADATA
+      /* Get the metadata setting. */
+      config.metadata_enabled = 1; // if metadata support is included, then enable it by default
+      config.get_coverart = 1; // if metadata support is included, then enable it by default
+#endif
+
+#ifdef CONFIG_CONVOLUTION
+      config.convolution_max_length = 8192;
+#endif
+      config.loudness_reference_volume_db = -20;
+
 #ifdef CONFIG_METADATA_HUB
   config.cover_art_cache_dir = "/tmp/shairport-sync/.cache/coverart";
   config.scan_interval_when_active =
@@ -846,7 +857,6 @@ int parse_options(int argc, char **argv) {
 
 #ifdef CONFIG_METADATA
       /* Get the metadata setting. */
-      config.metadata_enabled = 1; // if metadata support is included, then enable it by default
       if (config_lookup_string(config.cfg, "metadata.enabled", &str)) {
         if (strcasecmp(str, "no") == 0)
           config.metadata_enabled = 0;
@@ -856,7 +866,6 @@ int parse_options(int argc, char **argv) {
           die("Invalid metadata enabled option choice \"%s\". It should be \"yes\" or \"no\"");
       }
 
-      config.get_coverart = 1; // if metadata support is included, then enable it by default
       if (config_lookup_string(config.cfg, "metadata.include_cover_art", &str)) {
         if (strcasecmp(str, "no") == 0)
           config.get_coverart = 0;
@@ -988,7 +997,6 @@ int parse_options(int argc, char **argv) {
               dvalue);
       }
 
-      config.convolution_max_length = 8192;
       if (config_lookup_int(config.cfg, "dsp.convolution_max_length", &value)) {
         config.convolution_max_length = value;
 
@@ -1015,7 +1023,6 @@ int parse_options(int argc, char **argv) {
           die("Invalid dsp.convolution. It should be \"yes\" or \"no\"");
       }
 
-      config.loudness_reference_volume_db = -20;
       if (config_lookup_float(config.cfg, "dsp.loudness_reference_volume_db", &dvalue)) {
         config.loudness_reference_volume_db = dvalue;
         if (dvalue > 0 || dvalue < -100)
@@ -1168,7 +1175,7 @@ int parse_options(int argc, char **argv) {
       break;
     case 'g':
       if (config.metadata_enabled == 0)
-        die("If you want to get cover art, you must also select the --metadata-pipename option.");
+        die("If you want to get cover art, ensure metadata_enabled is true.");
       break;
 #endif
     case 'S':