PDA

View Full Version : Modifying gadget .js help



Terrapin2190
April 4th, 2015, 01:13 AM
Okay... so I really like the Airlock Blue HUD gadgets. But most of the internet radio stations in the javascript file aren't working. I'm attempting to add my own personalized list of stations to the stations.js file in 'shell:gadgets \Airlock Blue Computer Status.gadget\js'. I've figured out how to add different stations from soma.fm using the input from soma radio stations within stations.js, but adding from other websites, I've been having some trouble.

Here are some sample scripts. The soma.fm scripts are working.


theStream[4] = "http://ice.somafm.com/spacestation";
theLogo[4] = "Tune in, turn on, space out. Spaced-out ambient and mid-tempo electronica.";
theXML[4] = "N";
theName[4] = "Space Station Soma";
theWebsite[4] = "http://somafm.com/play/spacestation";
theType[4] = "WMP";

theStream[5] = "http://ice.somafm.com/doomed";
theLogo[5] = "Dark industrial/ambient music for tortured souls.";
theXML[5] = "N";
theName[5] = "Doomed";
theWebsite[5] = "http://ice.somafm.com/doomed";
theType[5] = "WMP";

theStream[6] = "http://stream.radiotime.com/listen.stream?streamIds=677379";
theLogo[6] = "Enjoy streaming Grateful Dead, Jerry Garcia Band, Phil and Friends, Ratdog and other bands.";
theXML[6] = "B";
theName[6] = "Grateful Dead Radio";
theWebsite[6] = "http://tunein.com/radio/Grateful-Dead-Radio-s54607";
theType[6] = "WMP";

theStream[7] = "http://kdhx.fm/live";
theLogo[7] = "88.1 KDHX Independent Radio St. Louis";
theXML[7] = "B";
theName[7] = "88.1 KDHX";
theWebsite[7] = "http://kdhx.fm/live";
theType[7] = "WMP";

I've opened javascript info from a few different live radio players and found a lot of different entries regarding where the player is pointing to, but I'm confused on what 'theXML' means and how 'theStream' and 'theWebsite' differs and how to know which is which in javascript info.

You can open
http://tunein.com/radio/Grateful-Dead-Radio-s54607
and
http://kdhx.fm/live
right-click and select 'view page source' to view the javascript info.
(I'm using Cyberfox, not sure if it's accessible in other web browsers or not)


Also, with the Airlock Blue Computer Status gadget, it won't display my WiFi signal strength. It does display the router name and a check mark on top of it, but the meter is stuck at 0%. I haven't peeked into the .js yet to see what's in there.
(Nevermind, I just took a better look at it and it's my battery showing 0%. Which, my battery has been toast for years now. I just use it to elevate my laptop hahaha!)
My bad.



On a side note, I'd also like the gadget to remember what radio station I chose upon rebooting my PC. I'm guessing it has to do with the 'settings.js'

Here's the script on that, which is small but looks confusing to me haha...


// loadSettings - first method called when Settings page loads
///////////////////////////////////////////////////////////////////////////////////////////////////
function loadSettings() {

System.Gadget.onSettingsClosing = procSettingsClosingEvent; // set settings page closing event
if (System.Gadget.Settings.read("radioURL") == ""){System.Gadget.Settings.write("radioURL","http://www.977music.com/tunein/web/hitz.asx")}
stationPicker.value = System.Gadget.Settings.read("radioURL");
}
///////////////////////////////////////////////////////////////////////////////////////////////////
function procSettingsClosingEvent(event){
// process settings page closing event
if (event.closeAction == event.Action.commit) {
// save settings
System.Gadget.Settings.write("radioURL", stationPicker.value);
}
event.cancel = false;
}


Thanks so much in advance for anyone willing to help. I'm learning!

Terrapin2190
April 5th, 2015, 09:55 AM
Alright! UPDATE!! I haven't found out how to add my 2 favorite local radio stations (one recently moved, updated their website, and seems to strictly use a flash player so it's hard to get a lock on their stream... the other can't afford to stream online from their website... Bummer.), BUT I have figured out how to add some radio stations! Usually all you need is an M3U link. I'm not sure yet is .pls or other formats work yet.

EDIT: .pls didn't work for me, but it could have been a bad link. As far as I can tell, most Windows Media Player and Winamp links work. That includes .m3u, .asx, and possibly .wax.

Here's how it's done. First, as an example, go to this website:
http://www.internet-radio.com/stations/soul/page2
(Yeah, I love me some good old funky soul tunes haha)

All you need to do is copy the link from the M3U button and paste it in the 'stations.js' file between the quotation marks after 'theStream' and 'theWebsite'

I'll upload a modified stations.js file later if anyone wants to use it. Perhaps, with Pats permission (and if I can figure out how to modify the gadget installers themselves) I'll be able to upload an updated version of Airlock Blue gadgets. With updated radio stations for the Computer Status gadget and 12-hour time for the clock widget. Also working with JMB to add AM/PM markers.

Terrapin2190
April 6th, 2015, 02:52 AM
Booted my PC and the Computer Status Widget was still on the last station I was listening to. I guess it only resets under special circumstances, closing sidebar.exe or the widget itself. Problem solved! Without having to look into it haha. Big thanks to Pats again for these nice looking gadgets :)