@@ -91,61 +91,58 @@ public void handleCommand(ChannelUID channelUID, Command command) {
9191 return ;
9292 }
9393
94- // Handle search command
95- if (CHANNEL_TIVO_SEARCH .equals (channelUID .getId ())) {
96- if (commandParameter .isBlank ()) {
97- logger .debug ("Search string was blank" );
98- return ;
99- }
100-
101- try {
102- sendCommand ("TELEPORT" , "SEARCH" , currentStatus );
103- } catch (InterruptedException e ) {
104- Thread .currentThread ().interrupt ();
105- }
94+ switch (channelUID .getId ()) {
95+ case CHANNEL_TIVO_CHANNEL_FORCE :
96+ commandKeyword = "FORCECH" ;
97+ break ;
98+ case CHANNEL_TIVO_CHANNEL_SET :
99+ commandKeyword = "SETCH" ;
100+ break ;
101+ case CHANNEL_TIVO_TELEPORT :
102+ commandKeyword = "TELEPORT" ;
103+ break ;
104+ case CHANNEL_TIVO_IRCMD :
105+ commandKeyword = "IRCODE" ;
106+ break ;
107+ case CHANNEL_TIVO_KBDCMD :
108+ commandKeyword = KEYBOARD ;
109+ break ;
110+ case CHANNEL_TIVO_SEARCH :
111+ if (commandParameter .isBlank ()) {
112+ logger .debug ("Search string was blank" );
113+ return ;
114+ }
106115
107- // Wait 1 second for the SEARCH screen to load
108- scheduler .schedule (() -> {
109116 try {
110- for (int i = 0 ; i < commandParameter .length (); i ++) {
111- if (Character .isLetter (commandParameter .charAt (i ))) {
112- sendCommand (KEYBOARD , String .valueOf (commandParameter .charAt (i )), currentStatus );
113- } else if (Character .isDigit (commandParameter .charAt (i ))) {
114- sendCommand (KEYBOARD , "NUM" + commandParameter .charAt (i ), currentStatus );
115- } else if (Character .isSpaceChar (commandParameter .charAt (i ))) {
116- sendCommand (KEYBOARD , "SPACE" , currentStatus );
117- } else {
118- logger .debug ("Search character not supported: {}" ,
119- String .valueOf (commandParameter .charAt (i )));
120- }
121- }
117+ sendCommand ("TELEPORT" , "SEARCH" , currentStatus );
122118 } catch (InterruptedException e ) {
123119 Thread .currentThread ().interrupt ();
124120 }
125- }, 1 , TimeUnit .SECONDS );
126- return ;
127- } else {
128- switch (channelUID .getId ()) {
129- case CHANNEL_TIVO_CHANNEL_FORCE :
130- commandKeyword = "FORCECH" ;
131- break ;
132- case CHANNEL_TIVO_CHANNEL_SET :
133- commandKeyword = "SETCH" ;
134- break ;
135- case CHANNEL_TIVO_TELEPORT :
136- commandKeyword = "TELEPORT" ;
137- break ;
138- case CHANNEL_TIVO_IRCMD :
139- commandKeyword = "IRCODE" ;
140- break ;
141- case CHANNEL_TIVO_KBDCMD :
142- commandKeyword = KEYBOARD ;
143- break ;
144- default :
145- logger .debug ("TiVo '{}' ignoring command '{}' for unsupported channel '{}'." , getThing ().getUID (),
146- command , channelUID .getId ());
147- return ;
148- }
121+
122+ // Wait 1 second for the SEARCH screen to load
123+ scheduler .schedule (() -> {
124+ try {
125+ for (int i = 0 ; i < commandParameter .length (); i ++) {
126+ if (Character .isLetter (commandParameter .charAt (i ))) {
127+ sendCommand (KEYBOARD , String .valueOf (commandParameter .charAt (i )), currentStatus );
128+ } else if (Character .isDigit (commandParameter .charAt (i ))) {
129+ sendCommand (KEYBOARD , "NUM" + commandParameter .charAt (i ), currentStatus );
130+ } else if (Character .isSpaceChar (commandParameter .charAt (i ))) {
131+ sendCommand (KEYBOARD , "SPACE" , currentStatus );
132+ } else {
133+ logger .debug ("Search character not supported: {}" ,
134+ String .valueOf (commandParameter .charAt (i )));
135+ }
136+ }
137+ } catch (InterruptedException e ) {
138+ Thread .currentThread ().interrupt ();
139+ }
140+ }, 1 , TimeUnit .SECONDS );
141+ return ;
142+ default :
143+ logger .debug ("TiVo '{}' ignoring command '{}' for unsupported channel '{}'." , getThing ().getUID (),
144+ command , channelUID .getId ());
145+ return ;
149146 }
150147 try {
151148 sendCommand (commandKeyword , commandParameter , currentStatus );
0 commit comments