summaryrefslogtreecommitdiff
path: root/smarttv-client/Javascript/Config.js
diff options
context:
space:
mode:
Diffstat (limited to 'smarttv-client/Javascript/Config.js')
-rwxr-xr-xsmarttv-client/Javascript/Config.js161
1 files changed, 36 insertions, 125 deletions
diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js
index b60d01d..38bed1c 100755
--- a/smarttv-client/Javascript/Config.js
+++ b/smarttv-client/Javascript/Config.js
@@ -17,7 +17,8 @@ var Config = {
debug : false,
usePdlForRecordings : true,
uploadJsFile : "",
-
+ directAcessTimeout : 1500,
+ widgetVersion : "unknown",
deviceType : 0 // Used to differentiate between browsers and platforms
// 0: Samsung
@@ -72,8 +73,9 @@ Config.init = function () {
}
else {
Config.doFirstLaunch();
-// Main.init();
- Display.showPopup ("WARNING: Cannot create widget folder. Try Config");
+// Display.showPopup ("WARNING: Cannot create widget folder. Try Config");
+ Display.showPopup (Lang[Lang.sel].configInit);
+
// Main.logToServer("ERROR: Cannot create widget folder curWidget.id= " +curWidget.id);
}
return;
@@ -88,35 +90,33 @@ Config.init = function () {
Config.doFirstLaunch = function () {
Config.firstLaunch = true;
-// Main.init(); // Obsolete?
Main.changeState(4);
};
-/*
-Config.fetchConfig = function () {
- if (this.XHRObj == null) {
- this.XHRObj = new XMLHttpRequest();
- }
-
- if (this.XHRObj) {
-
- this.XHRObj.onreadystatechange = function() {
- if (Config.XHRObj.readyState == 4) {
- Config.processConfig();
- }
- };
-
- this.XHRObj.open("GET", this.serverUrl + "/widget.conf", true);
- this.XHRObj.send(null);
- }
+
+Config.getWidgetVersion = function () {
+ $.ajax({
+ url: "config.xml",
+ type : "GET",
+ success : function(data, status, XHR ) {
+ Config.widgetVersion = $(data).find('ver').text();
+ Main.logToServer("Config.getWidgetVersion= " + Config.widgetVersion) ;
+ Display.updateWidgetVersion(Config.widgetVersion);
+ },
+ error : function (XHR, status, error) {
+ Main.log("Config.getVersion ERROR" ) ;
+ Main.logToServer("Config.getVersion ERROR" ) ;
+ }
+ });
};
-*/
+
Config.fetchConfig = function () {
$.ajax({
url: this.serverUrl + "/widget.conf",
type : "GET",
success : function(data, status, XHR ) {
+
Main.log ("Parsing config XML now");
Main.logToServer("Parsing config XML now");
Config.format = $(data).find('format').text();
@@ -132,8 +132,12 @@ Config.fetchConfig = function () {
Config.debug = ($(data).find('widgetdebug').text() == "true") ? true : false;
Config.usePdlForRecordings = ($(data).find('usePdlForRecordings').text() == "false") ? false : true;
Config.uploadJsFile = $(data).find('uploadJsFile').text();
-
+ Config.directAcessTimeout = $(data).find('directAcessTimeout').text();
+
Player.skipDuration = Config.skipDuration;
+ if (Config.directAcessTimeout != "") {
+ DirectAccess.delay = Config.directAcessTimeout;
+ }
Main.log("**** Config ****");
Main.log("serverUrl= " + Config.serverUrl);
Main.log("format= " + Config.format);
@@ -153,7 +157,9 @@ Config.fetchConfig = function () {
},
error : function (XHR, status, error) {
Main.log ("Config Server Error");
- Display.showPopup("Config Server Error " + XHR.status + " " + status);
+// Display.showPopup("Config Server Error " + XHR.status + " " + status);
+ Display.showPopup(Lang[Lang.sel].configNoServer + " "+ XHR.status + " " + status);
+
Main.logToServer("Config Server Error " + XHR.status + " " + status);
}
@@ -194,13 +200,14 @@ Config.readContext = function () {
while (line = fd.readLine()) {
var avp = line.split(" ");
-// Display.showPopup ("Reading Config: attr= " + avp[0] + " val= " + avp[1]);
if (avp.length > 1) {
Config.serverAddr = avp[1];
Config.serverUrl = "http://" + Config.serverAddr;
}
else {
- Display.showPopup ("ERROR: Error in Config File. Try widget re-install.");
+// Display.showPopup ("ERROR: Error in Config File. Try widget re-install.");
+ Display.showPopup (Lang[Lang.sel].configRead1);
+
// TODO: I should re-write the config file
}
}
@@ -217,7 +224,9 @@ Config.readContext = function () {
else {
Main.log("Config.readContext: Widget Folder creation failed");
- Display.showPopup ("WARNING: ConfigRead Error and WidgetFolder creation failed. <br> Launching Config-Menu from here");
+// Display.showPopup ("WARNING: ConfigRead Error and WidgetFolder creation failed. <br> Launching Config-Menu from here");
+ Display.showPopup (Lang[Lang.sel].configRead2);
+
// Main.log("-------------- Error: res = false ------------------------");
}
Config.doFirstLaunch();
@@ -225,105 +234,7 @@ Config.readContext = function () {
}
};
-/*
-Config.getXmlValue = function (itm) {
- var val = this.xmlDocument.getElementsByTagName(itm);
- var res = 0;
- try {
- res = val[0].firstChild.data;
- }
- catch (e) {
- Main.logToServer("parsing widget.conf: Item= " + itm + " not found" + e);
- Main.log ("parsing widget.conf: Item= " + itm + " not found e= " + e);
- }
- return res;
-
-};
-Config.getXmlString = function (itm) {
- var val = this.xmlDocument.getElementsByTagName(itm);
-
- var res = "";
- try {
- res = val[0].firstChild.data;
- }
- catch (e) {
- Main.logToServer("parsing widget.conf: Item= " + itm + " not found" + e);
- Main.log ("parsing widget.conf: Item= " + itm + " not found e= " + e);
- };
-
- return res;
-};
-*/
-/*
-Config.processConfig = function () {
- if (this.XHRObj.status != 200) {
- Main.log ("Config Server Error");
- Display.showPopup("Config Server Error " + this.XHRObj.status);
- Main.logToServer("Config Server Error " + this.XHRObj.status);
- }
- else {
- var xmlResponse = this.XHRObj.responseXML;
- if (xmlResponse == null) {
- Main.log ("xml error");
- Display.showPopup("Error in XML Config File");
- Main.logToServer("Error in XML Config File");
- return;
- }
- this.xmlDocument = xmlResponse.documentElement;
- if (!this.xmlDocument ) {
- Main.log("Failed to get valid Config XML");
- Display.showPopup("Failed to get valid Config XML");
- Main.logToServer("Failed to get valid Config XML");
- return;
- }
- else {
- Config.firstLaunch = false;
-
- Main.log ("Parsing config XML now");
- Main.logToServer("Parsing config XML now");
- this.format = Config.getXmlString("format");
- var res = Config.getXmlValue("tgtBufferBitrate");
- if (res != 0)
- this.tgtBufferBitrate = 1.0 * res;
- res = Config.getXmlValue("totalBufferDuration");
- if (res != 0) this.totalBufferDuration = 1.0 * res;
-
- res= Config.getXmlValue("initialBuffer");
- if (res != 0) this.initialBuffer = 1.0 * res;
-
- res = Config.getXmlValue("pendingBuffer");
- if (res != 0) this.pendingBuffer = 1.0 * res;
-
- res = Config.getXmlValue("skipDuration");
- if (res != 0) this.skipDuration= 1.0 * res;
-
- res = Config.getXmlValue("initialTimeOut");
- if (res != 0) this.initialTimeOut = 1.0 * res;
-
- res = Config.getXmlValue("liveChannels");
- if (res != 0) this.liveChannels = res;
-
- Player.skipDuration = Config.skipDuration;
- Main.log("**** Config ****");
- Main.log("serverUrl= " + Config.serverUrl);
- Main.log("format= " + Config.format);
- Main.log("tgtBufferBitrate= " + Config.tgtBufferBitrate);
- Main.log("totalBufferDuration= " + Config.totalBufferDuration);
- Main.log("initialBuffer= " + Config.initialBuffer);
- Main.log("pendingBuffer= " + Config.pendingBuffer);
- Main.log("skipDuration= " + Config.skipDuration);
- Main.log("initialTimeOut= " + Config.initialTimeOut);
- Main.log("liveChannels= " + Config.liveChannels);
-
- Main.log("**** /Config ****");
- };
-
- };
-
- Main.init();
-};
-*/
// This function cleans up after un-installation
Config.reset = function () {
var fileSystemObj = new FileSystem();