diff options
author | thlo <t.lohmar@gmx.de> | 2013-04-05 17:43:54 +0200 |
---|---|---|
committer | thlo <t.lohmar@gmx.de> | 2013-04-05 17:43:54 +0200 |
commit | 0d3bb5c8d940b416ccc06a68a8ccfc35370fdbd4 (patch) | |
tree | 5e1b34165922afd5940e3ff566221fbd34d76155 /smarttv-client/Javascript/Server.js | |
parent | d5c26eb7a9c51e82be0ac41bd04f4433043776cd (diff) | |
download | vdr-plugin-smarttvweb-0d3bb5c8d940b416ccc06a68a8ccfc35370fdbd4.tar.gz vdr-plugin-smarttvweb-0d3bb5c8d940b416ccc06a68a8ccfc35370fdbd4.tar.bz2 |
Selection of audio tracks.
First version of web video (yt) support.
various bug fixes.
Diffstat (limited to 'smarttv-client/Javascript/Server.js')
-rwxr-xr-x | smarttv-client/Javascript/Server.js | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js index ec969b8..77b8cff 100755 --- a/smarttv-client/Javascript/Server.js +++ b/smarttv-client/Javascript/Server.js @@ -7,6 +7,7 @@ var Server = { XHRObj : null
};
+
Server.init = function()
{
var success = true;
@@ -90,8 +91,8 @@ Server.updateVdrStatus = function (){ type : "GET",
success : function(data, status, XHR){
var free = $(data).find('free').text() / 1024.0;
- var used = $(data).find('used').text() / 1024.0;
- var percent = $(data).find('percent').text();
+// var used = $(data).find('used').text() / 1024.0;
+// var percent = $(data).find('percent').text();
var unit = "GB";
var free_str = free.toFixed(2);
@@ -107,7 +108,7 @@ Server.updateVdrStatus = function (){ Main.log("VdrStatus: Error");
}
});
-}
+};
Server.getResume = function (guid) {
@@ -179,3 +180,45 @@ Server.deleteRecording = function(guid) { }
});
};
+
+
+Server.notifyServer = function (state) {
+ Main.log("Server.notifyServer state="+state +"&mac=" + Network.ownMac + "&ip=" + Network.ownIp);
+ $.ajax({
+ url: Config.serverUrl + "/clients?state="+state +"&mac=" + Network.ownMac + "&ip=" + Network.ownIp,
+ type : "GET",
+ success : function(data, status, XHR ) {
+ Main.log("Config.notifyServer OK" ) ;
+ },
+ error : function (XHR, status, error) {
+ Main.log("Config.notifyServer failed" ) ;
+ }
+ });
+};
+
+var HeartbeatHandler = {
+ timeoutObj : null,
+ isActive : false
+};
+
+
+HeartbeatHandler.start = function(){
+ if (this.isActive ==true)
+ window.clearTimeout(this.timeoutObj);
+
+ this.isActive = true;
+ HeartbeatHandler.update();
+};
+
+HeartbeatHandler.update = function() {
+ Server.notifyServer("running");
+ this.timeoutObj = window.setTimeout(function() {HeartbeatHandler.update(); }, (60*1000)); // once every 1min
+};
+
+HeartbeatHandler.stop = function(){
+ if (this.isActive == false )
+ return;
+
+ window.clearTimeout(this.timeoutObj);
+ this.isActive = false;
+};
|