RM/RMIR v2.09 available

Discussion forum for JP1 software tools currently in use, or being developed, such as IR, KM, RemoteMaster, and other misc apps/tools.

Moderator: Moderators

Barf
Expert
Posts: 1523
Joined: Fri Oct 24, 2008 1:54 pm
Location: Munich, Germany
Contact:

Post 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;
+  }
 }

mathdon
Expert
Posts: 4725
Joined: Tue Jul 22, 2008 8:53 am
Location: Cambridge, UK

Post by mathdon »

Bengt, thanks for the patch. It will be in the next upload to the SVN.
Graham
mathdon
Expert
Posts: 4725
Joined: Tue Jul 22, 2008 8:53 am
Location: Cambridge, UK

Post 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.
Graham
mathdon
Expert
Posts: 4725
Joined: Tue Jul 22, 2008 8:53 am
Location: Cambridge, UK

Post 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.
Graham
Post Reply