In search results, display the icon_format (e.g. "cdmusic") in preference to search_f...
authorkenstir <kenstir@gmail.com>
Sat, 17 Oct 2015 14:39:34 +0000 (10:39 -0400)
committerkenstir <kenstir@gmail.com>
Sat, 17 Oct 2015 14:39:34 +0000 (10:39 -0400)
Open-ILS/src/Android/core/src/org/evergreen_ils/searchCatalog/SearchCatalog.java
Open-ILS/src/Android/kenstir_parse_logcat.pl

index ea6513b..d44834f 100644 (file)
@@ -265,14 +265,22 @@ public class SearchCatalog {
         String attrs = resp.getString("attrs");
         Log.d(TAG, "attrs="+attrs);
         String[] attr_arr = TextUtils.split(attrs, ", ");
+        String icon_format = "";
+        String search_format = "";
         for (int i=0; i<attr_arr.length; ++i) {
             String[] kv = TextUtils.split(attr_arr[i], "=>");
             String key = kv[0].replace("\"", "");
-            if (key.equalsIgnoreCase("search_format")) {
-                return kv[1].replace("\"", "");
+            if (key.equalsIgnoreCase("icon_format")) {
+                icon_format = kv[1].replace("\"", "");
+            } else if (key.equalsIgnoreCase("search_format")) {
+                search_format = kv[1].replace("\"", "");
             }
         }
-        return "";
+        if (!icon_format.isEmpty()) {
+            return icon_format;
+        } else {
+            return search_format;
+        }
     }
 
     public Object getCopyStatuses() {
index 7a11a28..3b0ed1e 100644 (file)
@@ -7,14 +7,17 @@
 use strict;
 use warnings;
 use Data::Dumper;
+use Getopt::Long;
 use JSON;
 
+my $debug = 0;
+GetOptions("-d=i" => \$debug) or die;
+
 my $logcat = `adb logcat -d`;
-my @lines = split(/\n/, $logcat);
+my @lines = split(/\r\n/, $logcat);
 foreach my $line (@lines) {
-    chomp($line);
-    $line =~ s/\015$//;
-    if ($line =~ /org.opensrf.net.http.GatewayRequest\(\d+\): ([^:]+):(.+)/) {
+    print "line: $line\n" if $debug;
+    if ($line =~ /org.opensrf.net.http.GatewayRequest\( *\d+\): ?([^:]+):(.+)/) {
         my($key,$val) = ($1,$2);
         if ($key eq 'result') {
             my $obj = decode_json($val);