Page 2 of 2

Posted: Wed Mar 18, 2020 8:09 am
by Barf
Graham. thanx for the fixes. It works!! :D


Enclosed is a fix that makes the "Auto assign" feature slightly more creative (more things match). Patch against current SVN, i.e. revision 1675.

Code: Select all


Index: com/hifiremote/jp1/DeviceUpgrade.java
===================================================================
--- com/hifiremote/jp1/DeviceUpgrade.java       (revision 1675)
+++ com/hifiremote/jp1/DeviceUpgrade.java       (working copy)
@@ -3894,8 +3894,7 @@
           Button b = buttons[ i ];
           if ( assignments.getAssignment( b ) == null )
           {
-            if ( b.getName().equalsIgnoreCase( func.getName() )
-                || b.getStandardName().equalsIgnoreCase( func.getName() ) )
+           if ( func.matchingName(b) )
             {
               assignments.assign( b, func );
               break;
Index: com/hifiremote/jp1/Function.java
===================================================================
--- com/hifiremote/jp1/Function.java    (revision 1675)
+++ com/hifiremote/jp1/Function.java    (working copy)
@@ -386,4 +386,41 @@
   /** Default value used in upgrade when index==null */
   public static final int defaultGID = 0;
 
+  boolean matchingName(Button b) {
+    return matchingName(b.getName()) || matchingName(b.getStandardName());
+  }
+
+  private boolean matchingName(String candidate) {
+    String nameLower = name.toLowerCase();
+    String candidateLower = candidate.toLowerCase();
+    return name.equals(candidateLower) || canonicalize(nameLower).equals(canonicalize(candidateLower));
+  }
+
+  private static String[][] substitutes = {
+    {"key_", ""}, // Lirc
+    {"cursor", ""},
+    {"arrow", ""},
+    {"toggle", ""},
+    {"return", "exit"},
+    {"-", "down"},
+    {"\\+", "up"},
+    {">", "play"},
+    {"<", "reverse"},
+    {"\\|\\|", "pause"},
+    {"fwd", "forward"},
+    {"volume", "vol"},
+    {"channel", "ch"},
+    {"\\s+", ""}
+  };
+
+  private String canonicalize(String str) {
+    String work = str;
+    for (String[] substitute : substitutes) {
+      String from = substitute[0];
+      String to = substitute[1];
+      work = work.replaceAll(from, to);
+    }
+
+    return work;
+  }
 }


Posted: Wed Mar 18, 2020 11:25 am
by mathdon
Bengt, thanks for the patch. It will be in the next upload to the SVN.

Posted: Fri Mar 20, 2020 8:44 am
by mathdon
I have now posted development build 2 of RMIR v2.10 in the RMIR Development Folder on SourceForge. In addition to the RF support included in build 1 and described in an earlier post, this build provides enhanced identification of the various NEC protocols in the Learned Signals tab of RMIR and improvements to the range of executors that can be used in the automated conversion of learned signals to device upgrades. See this thread for more details.

Posted: Wed Mar 25, 2020 7:21 am
by mathdon
RMIR v2.10 has now been officially released, and supersedes version 2.09 and the development builds of version 2.10. See this announcement for details.