Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 54 made on Thursday September 22, 2011 at 15:02
Lowpro
Select Member
Joined:
Posts:
March 2004
2,081
Stumbled upon an issue today with my Now Playing page that I had somehow overlooked. Found that the channel name was not always being displayed cleanly on the page. The solution required a small change to one line of ProntoScript at the activity level which I've highlighted below.

function doNowPlaying() {
var e = CF.extender[2];
var s = e.serial[0];
s.bitrate = 9600;
s.databits = 8;
s.parity = 0;
s.stopbits = 1;
gci = s.match("GetChannelInformation\r",250);
gsi = s.match("GetSongInformation\r",250);
gas = s.match("GetAntennaStrength\r",250);
ghi = s.match("GetHardwareId\r",250);
widget("Channel Number").label = "\n\n\n\n" + gci; //Prior to change being made.
widget("Channel Name").label = gci;
widget("Category Name").label = gci + "\n\n\n\n";
widget("Artist Name").label = "\n"+ gsi;
widget("Song Title").label = gsi + "\n\n\n";
widget("Antenna Strength").label = gas + "\n";
widget("Hardware ID").label= ghi + "\n";
}


Also for reference, see the below example of the data received when sending the "GetChannelInformation\r" command.

GetChannelInformation (return command)
Current Channel Number is: 74 (2 blank spaces + 3 characters + return command)
Current Channel Name is:
Bluesville (16 characters + return command)
Current Category Name is:
Jazz & Blues (16 characters + return command)


Note that the actual channel number highlighted above is the only item not on a line of its own. It appears on the same line as the text, "Current Channel Number is:". As a result, I found that irrespective of the width and alignment of the text panel there was simply no way to display just the channel number without part of the channel number getting cut off or including part of the preceding text, this due to PEP v1's font not having a uniform character width. Channel 8 (one digit) for instance would be displayed on the panel as, "s: 8". Channel 100 (three digits) would being displayed on the panel showing part of the first digit being cut off. Two digit channels were the only ones that displayed cleanly without including part of the preceding text or cutting off part of the first digit. That being said, the solution ended up being quite simple. Using the replace() method I simply replaced the text preceding the channel number (which is always constant) with an empty space instead per the below.

widget("Channel Number").label = "\n\n\n\n" + gci.replace("Current Channel Number is:", " ");

This then allowed me to increase the width of the panel being used to ensure three digit channels could be displayed without getting cut off while at the same time taking the preceding text out of the equation for one digit channels that prior would have been showing a portion of the preceding text as well.

Last edited by Lowpro on November 21, 2011 12:20.
LP Related Links:
View my profile to access various
links to key posts and downloads.


Hosting Services by ipHouse