summaryrefslogtreecommitdiff
path: root/smarttv-client
diff options
context:
space:
mode:
authorthlo <smarttv640@gmail.com>2013-01-27 21:43:19 +0100
committerthlo <t.lohmar@gmx.de>2013-01-27 21:43:19 +0100
commit8ecd6c71008f5527e5de6b0772d6750effdcea79 (patch)
treec4351beddd53183b8fa667fa8b4fd3777c251965 /smarttv-client
parente26a7a6733c86a2b32c0506ebd25011fe2901e98 (diff)
downloadvdr-plugin-smarttvweb-8ecd6c71008f5527e5de6b0772d6750effdcea79.tar.gz
vdr-plugin-smarttvweb-8ecd6c71008f5527e5de6b0772d6750effdcea79.tar.bz2
Localtime shown in Main and Video Select Menu.
Free HDD space shown in Main and Video Select Menu. Title in progress overlay are single lined (no overflow). EPG data of Live channels are updated. Navigation (Page Up / down, Return, etc) more consistent.
Diffstat (limited to 'smarttv-client')
-rwxr-xr-xsmarttv-client/CSS/Main.css38
-rw-r--r--smarttv-client/Javascript/Buttons.js7
-rwxr-xr-xsmarttv-client/Javascript/Data.js57
-rwxr-xr-xsmarttv-client/Javascript/Display.js308
-rw-r--r--smarttv-client/Javascript/Epg.js186
-rwxr-xr-xsmarttv-client/Javascript/Main.js176
-rwxr-xr-xsmarttv-client/Javascript/Options.js4
-rwxr-xr-xsmarttv-client/Javascript/Player.js25
-rwxr-xr-xsmarttv-client/Javascript/Server.js90
-rwxr-xr-xsmarttv-client/config.xml2
-rwxr-xr-xsmarttv-client/index.html17
11 files changed, 672 insertions, 238 deletions
diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css
index ccc6714..cb6ac5e 100755
--- a/smarttv-client/CSS/Main.css
+++ b/smarttv-client/CSS/Main.css
@@ -6,7 +6,7 @@
margin: 0;
border: 0;
position: relative;
- color:#FFFFFF;
+ color: #FFFFFF;
background-color: transpant;
text-shadow: 1px 1px 1px #000;
@@ -53,13 +53,22 @@ body {
border-width:2px;
font-size:16px;
-webkit-border-radius: 7px;
- padding-top:20px;
+ padding-top:5px;
padding-left:20px;
padding-right:20px;
background: rgba(6,109,171,1) 100%;
background: -webkit-linear-gradient(-45deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
-webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);
}
+
+
+#selectNow{
+ text-align: left;
+}
+#selectDisk{
+ text-align: right;
+}
+
/* background-size: 100%;
*/
#optionsScreen {
@@ -137,14 +146,32 @@ body {
height: 35px;
width: 90%;
background-repeat:repeat-x;
- font-size:25px;
padding-top:3px;
- padding-left:20px;
+ padding-left:10px;
z-index:10;
+ }
+
+#logo div {
+ display:inline-block;
}
+#logoNow {
+ text-align: left;
+ font-size:18px;
+ width: 35%;
+}
+#logoTitle {
+ text-align: center;
+ font-size:25px;
+ width: 30%;
+}
+#logoDisk {
+ text-align: right;
+ font-size:18px;
+ width: 35%;
+}
/* Right Half */
#rightHalf {
position: absolute;
@@ -350,6 +377,9 @@ body {
width:50%; height:16px;
text-align:left;
font-size:16px;
+ overflow:hidden;
+ text-overflow: ellipsis;
+ white-space : nowrap;
}
#olStartStop {
diff --git a/smarttv-client/Javascript/Buttons.js b/smarttv-client/Javascript/Buttons.js
index bec1155..8edab38 100644
--- a/smarttv-client/Javascript/Buttons.js
+++ b/smarttv-client/Javascript/Buttons.js
@@ -137,7 +137,7 @@ Buttons.selectBtnRight = function () {
Buttons.onInput = function () {
var keyCode = event.keyCode;
- alert("Buttons Input= " + keyCode);
+// alert("Buttons Input= " + keyCode);
switch(keyCode) {
case tvKey.KEY_LEFT:
Main.log("Select Left");
@@ -158,8 +158,9 @@ Buttons.onInput = function () {
break;
case 1:
Main.logToServer("Buttons: Resume from "+Player.resumePos);
- Player.playVideo(Player.resumePos);
-// Server.getResume(Player.guid);
+// Player.playVideo(Player.resumePos);
+ Spinner.show();
+ Server.getResume(Player.guid);
break;
}
Buttons.hide();
diff --git a/smarttv-client/Javascript/Data.js b/smarttv-client/Javascript/Data.js
index 2b95fa7..03b7a31 100755
--- a/smarttv-client/Javascript/Data.js
+++ b/smarttv-client/Javascript/Data.js
@@ -10,7 +10,8 @@ Data.reset = function() {
this.folderList = [];
- this.folderList.push({item : this.assets, id: 0});
+// this.folderList.push({item : this.assets, id: 0});
+ Main.log("Data.reset: folderList.push. this.folderList.length= " + this.folderList.length);
};
Data.completed= function(sort) {
@@ -18,26 +19,31 @@ Data.completed= function(sort) {
this.assets.sortPayload();
this.folderList.push({item : this.assets, id: 0});
+ Main.log("Data.completed: folderList.push. this.folderList.length= " + this.folderList.length);
Main.log ("Data.completed()= " +this.folderList.length);
};
-Data.selectFolder = function (idx) {
- this.folderList.push({item : this.getCurrentItem().childs[idx], id: idx});
+Data.selectFolder = function (idx, first_idx) {
+ this.folderList.push({item : this.getCurrentItem().childs[idx], id: idx, first:first_idx});
+ Main.log("Data.selectFolder: folderList.push. this.folderList.length= " + this.folderList.length);
+};
+
+Data.folderUp = function () {
+ itm = this.folderList.pop();
+ Main.log("Data.folderUp: folderList.pop. this.folderList.length= " + this.folderList.length);
+ return itm;
+// return itm.id;
};
Data.isRootFolder = function() {
+ Main.log("Data.isRootFolder: this.folderList.length= " + this.folderList.length);
if (this.folderList.length == 1)
return true;
else
return false;
};
-Data.folderUp = function () {
- itm = this.folderList.pop();
- return itm.id;
-};
-
Data.addItem = function(t_list, pyld) {
this.assets.addChild(t_list, pyld, 0);
};
@@ -52,12 +58,16 @@ Data.findEpgUpdateTime = function() {
return this.assets.findEpgUpdateTime(Display.GetEpochTime() + 10000, "", 0);
// min, guid, level
};
+
+Data.updateEpg = function (guid, entry) {
+ this.assets.updateEpgEntry(guid, entry, 0);
+};
+
Data.getCurrentItem = function () {
return this.folderList[this.folderList.length-1].item;
};
-Data.getVideoCount = function()
-{
+Data.getVideoCount = function() {
return this.folderList[this.folderList.length-1].item.childs.length;
};
@@ -142,12 +152,13 @@ Item.prototype.findEpgUpdateTime = function (min, guid, level) {
var digi =new Date(this.childs[i].payload['start'] * 1000);
var str = digi.getHours() + ":" + digi.getMinutes();
- Main.log(prefix + "min= " + min+ " start= " + this.childs[i].payload['start'] + " (" + str+ ") title= " + this.childs[i].title);
+// Main.log(prefix + "min= " + min+ " start= " + this.childs[i].payload['start'] + " (" + str+ ") title= " + this.childs[i].title);
if ((this.childs[i].payload['start'] != 0) && ((this.childs[i].payload['start'] + this.childs[i].payload['dur']) < min)) {
min = this.childs[i].payload['start'] + this.childs[i].payload['dur'];
guid = this.childs[i].payload['guid'] ;
Main.log(prefix + "New Min= " + min + " new id= " + guid + " title= " + this.childs[i].title);
+// Main.logToServer(prefix + "New Min= " + min + " new id= " + guid + " title= " + this.childs[i].title);
}
}
}
@@ -155,6 +166,30 @@ Item.prototype.findEpgUpdateTime = function (min, guid, level) {
return { "min": min, "guid" : guid};
};
+Item.prototype.updateEpgEntry = function (guid, entry, level) {
+ var prefix= "";
+ for (var i = 0; i < level; i++)
+ prefix += "-";
+ for (var i = 0; i < this.childs.length; i++) {
+ if (this.childs[i].isFolder == true) {
+ var res = this.childs[i].updateEpgEntry(guid, entry, level+1);
+ if (res == true)
+ return true;
+ }
+ else {
+ if (this.childs[i].payload['guid'] == guid) {
+ Main.log("updateEpgEntry: Found " + this.childs[i].title);
+ this.childs[i].payload.prog = entry.prog;
+ this.childs[i].payload.desc = entry.desc;
+ this.childs[i].payload.start = entry.start;
+ this.childs[i].payload.dur = entry.dur;
+ return true;
+ }
+ }
+ }
+ return false;
+};
+
Item.prototype.print = function(level) {
var prefix= "";
for (var i = 0; i < level; i++)
diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js
index 4f181ae..a304d74 100755
--- a/smarttv-client/Javascript/Display.js
+++ b/smarttv-client/Javascript/Display.js
@@ -51,17 +51,31 @@ Display.init = function()
{
success = false;
}
-
+
for (var i = 0; i <= this.LASTIDX; i++) {
var elm = $("#video"+i);
- $(elm).css({"width" : "100%", "text-align": "left" });
- $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"20%"}));
- $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"70%"}));
- $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"5%"}));
-
- }
+ $(elm).css({"width" : "100%", "text-align": "left", "padding-top": "4px", "padding-bottom": "5px" });
+ $(elm).append($("<div>").css({ "display": "inline-block", "width":"20%",
+ "overflow": "hidden", "text-overflow":"ellipsis", "height": "14px"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "width":"70%",
+ "overflow": "hidden", "text-overflow":"ellipsis", "white-space": "nowrap", "height": "14px"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "width":"5%",
+ "height": "14px"}));
+ }
+
-
+/* for (var i = 0; i <= this.LASTIDX; i++) {
+ var elm = $("#video"+i);
+ $(elm).css({"width" : "100%", "text-align": "left" });
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"20%",
+ "overflow": "hidden", "text-overflow":"ellipsis"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"70%",
+ "overflow": "hidden", "text-overflow":"ellipsis"}));
+ $(elm).append($("<div>").css({ "display": "inline-block", "padding-top": "4px", "padding-bottom": "6px", "width":"5%"
+ }));
+ }
+*/
+
var done = false;
var i = 0;
@@ -83,8 +97,9 @@ Display.init = function()
return success;
};
+
Display.putInnerHTML = function (elm, val) {
- alert(Config.deviceType + " " +elm + " " + val);
+// alert(Config.deviceType + " " +elm + " " + val);
switch (Config.deviceType) {
case 0:
// Samsung specific handling of innerHtml
@@ -231,18 +246,45 @@ Display.show = function() {
// document.getElementById("main").style.display="block";
$("#main").show();
- this.itemHeight = Math.round(parseInt($("#videoList").height()) / (this.LASTIDX +1) );
- alert ("vidList= " + $("#videoList").height()+ " itmHeight= " + this.itemHeight );
-
+ this.itemHeight = Math.round(parseInt($("#videoList").height()) / (this.LASTIDX +1) );
+};
+
+Display.tuneLeftSide = function() {
+ var res = {};
+ res.w1 = "20%";
+ res.w2 = "70%";
+ res.w3 = "5%";
+ switch (Main.state) {
+ case Main.eLIVE:
+ case Main.eMED:
+ res.w1 = "5%";
+ res.w2 = "85%";
+ res.w3 = "5%";
+ break;
+ case Main.eREC:
+ res.w1 = "20%";
+ res.w2 = "70%";
+ res.w3 = "5%";
+ break;
+ default:
+ Main.logToServer("ERROR in Display.tuneLeftSide. Should not be here");
+ break;
+ }
+ Main.log("Display.tuneLeftSide: w1= " + res.w1 +" w2= " + res.w2 + " w3= " + res.w3 );
+ return res;
};
+
Display.setVideoList = function(selected, first) {
//
var listHTML = "";
var res = {};
// var first_item = selected;
- var first_item = first; //thlo
+ var first_item = first; //thlo
+// var first_item = selected - ( selected % (Display.LASTIDX +1))
+
+ tab_style = Display.tuneLeftSide();
var i=0;
Main.log("Display.setVideoList title= " +Data.getCurrentItem().childs[selected].title + " selected= " + selected + " first_item= " + first_item);
this.handleDescription(selected);
@@ -255,8 +297,8 @@ Display.setVideoList = function(selected, first) {
res = Display.getDisplayTitle (Data.getCurrentItem().childs[first_item+i]);
}
this.videoList[i] = document.getElementById("video"+i);
-
- Display.setVideoItem(this.videoList[i], res);
+ Display.setVideoItem(this.videoList[i], res, tab_style);
+
this.unselectItem(this.videoList[i]);
}
@@ -264,16 +306,23 @@ Display.setVideoList = function(selected, first) {
this.selectItem(this.videoList[this.currentWindow]);
listHTML = (selected +1) + " / " + Data.getVideoCount();
-
- Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
+ $("#videoCount").text(listHTML);
+// Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
};
-Display.setVideoItem = function (elm, cnt) {
+Display.setVideoItem = function (elm, cnt, style) {
// cnt
$(elm).children("div").eq(0).text (cnt.c1);
$(elm).children("div").eq(1).text (cnt.c2);
$(elm).children("div").eq(2).text (cnt.c3);
-
+
+ if (typeof(style) != "undefined") {
+// Main.log ("Display.setVideoItem: change style w1= " + style.w1 + " w2= " + style.w2 + " w3= " + style.w3);
+ $(elm).children("div").eq(0).css("width", style.w1 );
+ $(elm).children("div").eq(1).css("width", style.w2 );
+ $(elm).children("div").eq(2).css("width", style.w3 );
+ }
+ /*
var itm = $(elm).children("div").eq(1);
if (itm.outerHeight() > this.itemHeight) {
var temp = cnt.c2;
@@ -282,6 +331,7 @@ Display.setVideoItem = function (elm, cnt) {
itm.text(temp + '...');
}
}
+ */
};
//Video Select Screen
@@ -295,7 +345,7 @@ Display.resetVideoList = function () {
break;
}
Display.unselectItem(elm);
- Display.setVideoItem(elm, {c1: "", c2: "", c3: ""});
+ Display.setVideoItem(elm, {c1: "", c2: "", c3: ""}, {w1: "20%", w2:"70%", w3:"5%"});
i ++;
}
@@ -323,8 +373,8 @@ Display.handleDescription =function (selected) {
var d_str ="";
var msg = "";
- if (Main.state == 1) {
- // Live
+ switch (Main.state) {
+ case Main.eLIVE:
var now = Display.GetEpochTime();
d_str = hour + ":" + min;
@@ -333,20 +383,26 @@ Display.handleDescription =function (selected) {
msg += "<b>"+ prog + "</b><br>";
msg += "<br>Start: " + d_str + "<br>";
msg += "Duration: " + Display.durationString(length) + "h<br>";
- Main.log("itm.payload.start= " + itm.payload.start + " length= " + length + " now= " +now);
+// Main.log("itm.payload.start= " + itm.payload.start + " length= " + length + " now= " +now);
msg += "Remaining: " + Display.durationString((itm.payload.start + length - now));
-
-
- }
- else {
- // on-demand
+ msg += "<br><br>"+ desc;
+ break;
+ case Main.eREC:
d_str = mon + "/" + day + " " + hour + ":" + min;
msg += "<b>" + title + "</b>";
msg += "<br><br>" + d_str;
msg += " Duration: " + Display.durationString(length) + "h";
- }
- msg += "<br><br>"+ desc;
+ msg += "<br><br>"+ desc;
+ break;
+ case Main.eMED:
+ msg += "<b>" + title + "</b>";
+ break;
+ default:
+ Main.logToServer("ERROR in Display.handleDescription: Should not be here");
+ break;
+ }
+
Display.setDescription(msg);
}
@@ -365,9 +421,9 @@ Display.setVideoListPosition = function(position, move)
this.handleDescription(position);
- listHTML = (position + 1) + " / " + Data.getVideoCount();
- Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
-
+// listHTML = (position + 1) + " / " + Data.getVideoCount();
+// Display.putInnerHTML(document.getElementById("videoCount"), listHTML);
+ $("#videoCount").text((position + 1) + " / " + Data.getVideoCount());
if(Data.getVideoCount() < this.LASTIDX) {
for (var i = 0; i < Data.getVideoCount(); i++)
@@ -443,6 +499,54 @@ Display.setDescription = function(description) {
Display.putInnerHTML(descriptionElement, description);
};
+Display.getDisplayTitle = function(item) {
+ var res = {c1:"", c2:"", c3:""};
+ switch (Main.state) {
+ case Main.eLIVE:
+ // Live
+ if (item.isFolder == true) {
+ res.c2 = item.title;
+ res.c3 = "<" + Display.getNumString(item.childs.length, 2) +">";
+ }
+ else {
+ res.c2 = item.title;
+ }
+ break;
+ case Main.eREC:
+ // Recordings
+ if (item.isFolder == true) {
+ res.c1 = "<" + Display.getNumString(item.childs.length, 3) + ">";
+ res.c2 = item.title;
+ }
+ else {
+ var digi = new Date(parseInt(item.payload.start*1000));
+ var mon = Display.getNumString ((digi.getMonth()+1), 2);
+ var day = Display.getNumString (digi.getDate(), 2);
+ var hour = Display.getNumString (digi.getHours(), 2);
+ var min = Display.getNumString (digi.getMinutes(), 2);
+
+ var d_str = mon + "/" + day + " " + hour + ":" + min;
+ res.c1 = d_str;
+ res.c2 = item.title;
+ }
+ break;
+ case Main.eMED:
+ if (item.isFolder == true) {
+ res.c3 = "<" + Display.getNumString(item.childs.length, 3) + ">";
+ res.c2 = item.title;
+ }
+ else {
+ res.c2 = item.title;
+ }
+ break;
+ default:
+ Main.logToServer("ERROR in Display.getDisplayTitle: Shall be in state 1, 2 or 3. State= " + Main.state);
+ break;
+ }
+ return res;
+};
+
+
/*
* Overlay Functions
@@ -452,17 +556,49 @@ Display.setDescription = function(description) {
* Progress Overlay
*
*/
+
+Display.initOlForLive = function () {
+ $("#olTitle").css("width", "50%");
+ $("#olStartStop").show();
+};
+
+Display.initOlForRecordings = function () {
+ $("#olStartStop").hide();
+ $("#olTitle").css("width", "75%");
+};
+
+Display.updateOlForLive = function (start_time, duration, now) {
+
+ Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title + " - " +Data.getCurrentItem().childs[Main.selectedVideo].payload.prog);
+ Display.setStartStop (start_time, (start_time + duration));
+ Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000;
+ Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
+
+// Display.updateTotalTime(Player.totalTime);
+ var digi = new Date((Data.getCurrentItem().childs[Main.selectedVideo].payload.start*1000));
+ Main.log (" Date(): StartTime= " + digi.getHours() + ":" + digi.getMinutes() + ":" + digi.getSeconds());
+// Player.cptOffset = (now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000;
+ Player.setCurrentPlayTimeOffset((now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000);
+ Player.OnCurrentPlayTime(0); // updates the HTML elements of the Progressbar
+};
+
Display.setOlTitle = function (title) {
this.olTitle = title;
- var elm = document.getElementById("olTitle");
- Display.putInnerHTML(elm, Display.olTitle);
+ $("#olTitle").text(this.olTitle);
+// Main.log("Display.setOlTitle: font-size=" + $("#olTitle").css("font-size"));
+// Main.log("Display.setOlTitle: height=" + $("#olTitle").css("height"));
+// Main.log("Display.setOlTitle: outerHeight=" + $("#olTitle").outerHeight());
+
+// var elm = document.getElementById("olTitle");
+// Display.putInnerHTML(elm, Display.olTitle);
};
Display.resetStartStop = function () {
Display.olStartStop = "";
- var elm = document.getElementById("olStartStop");
+ $("#olStartStop").text("");
+/* var elm = document.getElementById("olStartStop");
Display.putInnerHTML(elm, Display.olStartStop);
-
+*/
};
Display.setStartStop = function(start, stop) {
this.olStartStop = "";
@@ -480,9 +616,12 @@ Display.setStartStop = function(start, stop) {
if (minutes<=9)
minutes='0'+minutes;
this.olStartStop = this.olStartStop + hours + ":" + minutes;
-
- var elm = document.getElementById("olStartStop");
+
+ $("#olStartStop").text(Display.olStartStop);
+
+/* var elm = document.getElementById("olStartStop");
Display.putInnerHTML(elm, Display.olStartStop);
+ */
};
Display.setSkipDuration = function(duration) {
@@ -490,8 +629,11 @@ Display.setSkipDuration = function(duration) {
this.olStartStop = duration;
- var elm = document.getElementById("olStartStop");
+ $("#olStartStop").text("Next Skip: " + Display.olStartStop+"sec");
+
+/* var elm = document.getElementById("olStartStop");
Display.putInnerHTML(elm, "Next Skip: " + Display.olStartStop+"sec");
+ */
};
// Player.OnCurrentPlayTime
@@ -518,8 +660,9 @@ Display.updateRecBar = function (start_time, duration){
};
+
Display.status = function(status) {
- Main.log(status);
+ Main.log("Display.status: " +status);
Display.putInnerHTML(this.statusDiv, status);
Display.putInnerHTML(this.statusPopup, status);
};
@@ -538,45 +681,6 @@ Display.progress = function(status) {
};
-Display.getDisplayTitle = function(item) {
- var res = {c1:"", c2:"", c3:""};
- switch (Main.state) {
- case 1:
- // Live
- if (item.isFolder == true) {
- res.c2 = item.title;
- res.c3 = "<" + Display.getNumString(item.childs.length, 2) +">";
- }
- else {
- res.c2 = item.title;
- }
- break;
- case 2:
- case 3:
- // Recordings
- if (item.isFolder == true) {
- res.c1 = "<" + Display.getNumString(item.childs.length, 3) + ">";
- res.c2 = item.title;
- }
- else {
- var digi = new Date(parseInt(item.payload.start*1000));
- var mon = Display.getNumString ((digi.getMonth()+1), 2);
- var day = Display.getNumString (digi.getDate(), 2);
- var hour = Display.getNumString (digi.getHours(), 2);
- var min = Display.getNumString (digi.getMinutes(), 2);
-
- var d_str = mon + "/" + day + " " + hour + ":" + min;
- res.c1 = d_str;
- res.c2 = item.title;
- }
- break;
- default:
- Main.log("ERROR: Shall be in state 1 or 2. State= " + Main.state);
- break;
- }
- return res;
-};
-
//--------------------------------------------------------
@@ -676,18 +780,54 @@ Display.handlerShowProgress = function() {
document.getElementById("olProgressBar").style.width = timePercent + "%";
- var timeElement = document.getElementById("olTimeInfo");
- Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
+ $("#olTimeInfo").text(Player.curPlayTimeStr + " / " + Player.totalTimeStr);
+// var timeElement = document.getElementById("olTimeInfo");
+// Display.putInnerHTML(timeElement, Player.curPlayTimeStr + " / " + Player.totalTimeStr);
- var nowElement = document.getElementById("olNow");
var Digital=new Date();
var hours=Digital.getHours();
var minutes=Digital.getMinutes();
if (minutes<=9)
minutes='0'+minutes;
- Display.putInnerHTML(nowElement, hours + ':' + minutes);
+ $("#olNow").text(hours + ':' + minutes);
+// var nowElement = document.getElementById("olNow");
+// Display.putInnerHTML(nowElement, hours + ':' + minutes);
+};
+
+
+var ClockHandler = {
+ timeoutObj : null,
+ isActive : false,
+ elm : ""
+};
+
+ClockHandler.start = function(elm){
+ if (this.isActive ==true)
+ window.clearTimeout(this.timeoutObj);
+
+ this.isActive = true;
+ this.elm = elm;
+ ClockHandler.update();
+};
+
+ClockHandler.update = function() {
+ var date = new Date();
+ var hours= date.getHours();
+ var minutes= date.getMinutes();
+ if (minutes<=9)
+ minutes='0'+minutes;
+ $(this.elm).text(hours + ':' + minutes);
+
+ this.timeoutObj = window.setTimeout(function() {ClockHandler.update(); }, (10*1000));
};
+ClockHandler.stop = function(){
+ if (this.isActive == false )
+ return;
+
+ window.clearTimeout(this.timeoutObj);
+ this.isActive = false;
+};
/*
* OverlayHandler Class
diff --git a/smarttv-client/Javascript/Epg.js b/smarttv-client/Javascript/Epg.js
index c400e0e..89bd05c 100644
--- a/smarttv-client/Javascript/Epg.js
+++ b/smarttv-client/Javascript/Epg.js
@@ -9,33 +9,181 @@
*/
var Epg = {
- restfulUrl : ""
-
+ timeoutObj : null,
+ isActive : false,
+ guidErrors : {},
+ guidTitle : {},
+ curGuid : "",
+ lastGuid :"",
+ sameGuidCount : 0,
+ globalCount :0
};
-// Should be called after initial config
-Epg.init = function () {
- if (Config.serverUrl == "")
+Epg.stopUpdates = function () {
+ if (this.isActive == false )
+ return;
+
+ window.clearTimeout(this.timeoutObj);
+ this.isActive = false;
+ this.curGui = "";
+};
+
+Epg.startEpgUpdating = function() {
+ Main.log("");
+ Main.log("**** Epg.startEpgUpdating ****");
+
+ if (this.isActive == true)
+ return;
+
+/* if (this.globalCount == 30) {
+ Main.log ("stopping");
return;
- if (Config.serverUrl.indexOf(':') != -1) {
- Main.log ("Epg: Serverurl= " + Config.serverUrl);
- this.restfulUrl = Config.serverUrl.splice(0, Config.serverUrl.indexOf(':')) + ":8002";
}
+ */
+ this.globalCount ++;
+ if (Main.state != Main.eLIVE) {
+ Main.logToServer("ERROR in Epg.startEpgUpdating: I am NOT in state Main.eLive...!!");
+ return;
+ }
+ this.isActive = true;
+ var res = Data.findEpgUpdateTime();
+
+ var now = Display.GetEpochTime();
+ var delay = Math.round(res.min - now) *1000;
+ this.curGuid = res.guid;
+
+ Main.log("Epg.startEpgUpdating: Next update for GUID= " + res.guid + " with Min= " + res.min + " delay= " + (delay/1000.0) + "sec");
+
+ if (this.lastGuid == res.guid) {
+ // lastGuid is only changed, when the last response was successful
+ // number of repetitive errors are checked in the error response procedure
+ this.sameGuidCount ++;
+ Main.logToServer("WARNING in Epg.startEpgUpdating: again same Guid guid= " + res.guid + "(" +Epg.guidTitle[res.guid] +") (sameGuidCount= " +this.sameGuidCount+"). OrgDelay= " + (delay/1000.0) + "sec. Delaying...");
+ delay = 1000;
+ if (this.sameGuidCount > 60) {
+ Epg.insertFakeEntry(res.guid);
+ Main.logToServer("ERROR in EPG.updateEPG: insertFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
+ Epg.isActive = false;
+ Epg.startEpgUpdating();
+// Main.logToServer("ERROR in EPG.updateEPG: 10x same guid !!! - Please file a bug report! - Bitte eine Fehlermeldung posten");
+// Display.showPopup("EPG.updateEPG: 10x same guid !!!<br>Please file a bug report!<br>Bitte eine Fehlermeldung posten");
+ return;
+ }
+ }
+ else {
+ this.sameGuidCount = 0;
+ }
+
+ if (delay <0) {
+ delay = 300; //bit delay in msec
+ }
+// var guid = res.guid;
+ if (!(res.guid in this.guidErrors)) {
+ this.guidErrors[res.guid] = 0;
+ };
+
+ Main.log("Iter over this.guidErrors");
+ for (var prop in this.guidErrors) {
+ Main.log(" " +prop + " == " + this.guidErrors[prop]);
+ }
+ Main.log("Iter Done");
+
+ Main.log("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid] +") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
+ Main.logToServer("Epg.startEpgUpdating: next Update for guid= " + res.guid + " (" +Epg.guidTitle[res.guid]+ ") guidErrors= "+this.guidErrors[res.guid]+ " in " + (delay/1000.0) +"sec");
+// Main.logToServer("Epg.startEpgUpdating: next Update for guid= " + res.guid + " in " + (delay/1000.0) +"sec");
- Main.log ("Restful API Url= "+ this.restfulUrl);
+ this.timeoutObj = window.setTimeout(function() { Epg.updateEpg(res.guid); }, delay);
+};
+
+Epg.updateEpg = function (guid) {
+ var url = Config.serverUrl + "/epg.xml?id=" + guid;
+ if (Epg.guidErrors[guid] >2) {
+ Main.logToServer("WARNING in Epg.updateEpg: guid= " + guid + " uses mode=nodesc" );
+ url = url +"&mode=nodesc";
+ }
+ Main.log("Epg.updateEpg: Prep for guid= " + guid + " with ErrorCount= " + Epg.guidErrors[guid] +" and url= " + url);
$.ajax({
- type: "HEAD",
+ type: "GET",
async: true,
- url: this.restfulUrl + "channels.xml",
- success: function(message,text,response){
- Main.log("AJAX Response: MSG= " + message + " txt= " + text + " resp= " + response);
- }
- });
+ url: url,
+ success: Epg.parseResponse,
+ error: Epg.handleError
+ });
+};
+
+Epg.handleError = function (XHR, textStatus, errorThrown) {
+
+ Epg.guidErrors[Epg.curGuid] += 1;
+ Main.log("EPG.updateEPG Error ("+XHR.status +": " +XHR.responseText+")EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
+ Main.logToServer("EPG.updateEPG Error Response("+ XHR.status + ") EPG.curGuid= "+Epg.curGuid +" Epg.guidErrors[Epg.curGuid]= " +Epg.guidErrors[Epg.curGuid]);
+
+ Epg.isActive = false;
+ Main.log("--------------------------------------------");
+ if (Epg.guidErrors[Epg.curGuid] < 10) {
+ Epg.startEpgUpdating();
+ }
+ else {
+ Epg.insertFakeEntry(Epg.curGuid);
+ Main.logToServer("ERROR in EPG.updateEPG: insertingFakeEntry for guid= " + res.guid + " (" + Epg.guidTitle[res.guid] +")");
+ Epg.startEpgUpdating();
+// Display.showPopup("EPG.updateEPG: stop updating !!!<br>Please file a bug report!<br>Bitte eine Fehlermeldung posten");
+ }
+ return;
+};
+
+Epg.insertFakeEntry = function (guid) {
+ Main.logToServer("Epg.insertFakeEntry for guid= " + guid + " (" + Epg.guidErrors[guid] +")");
+ var now = Display.GetEpochTime();
+
+ entry={};
+ entry.prog = "Unknown";
+ entry.desc = "Empty";
+ entry.start = now;
+ entry.dur = 120;
+
+ Data.updateEpg(guid, entry);
+};
+
+Epg.parseResponse = function (message,text, XHR) {
+
+ $(message).find("programme").each(function(){
+ var guid = $(this).find("guid").text();
+ if (guid != Epg.curGuid) {
+ Main.logToServer("ERROR in Epg.parseResponse : Guid (="+ guid + ") != Epg.curGuid (=" + Epg.curGuid+ ") " );
+ }
+
+ Epg.guidErrors[Epg.curGuid] = 0;
+
+ entry={};
+ entry.prog = $(this).find("title").text();
+ entry.desc = $(this).find("desc").text();
+ entry.start = parseInt($(this).find("start").text());
+ entry.dur = (parseInt($(this).find("end").text()) - parseInt($(this).find("start").text()));
+
+ Main.log("Epg.parseResponse : Guid= "+ guid + " title= " + entry.prog+ " start= " +entry.start + " dur= " + entry.dur);
+// Main.logToServer("Epg.parseResponse : Guid= "+ guid + " title= " + entry.prog+ " start= " +entry.start + " dur= " + entry.dur);
+
+ Data.updateEpg(guid, entry);
+
+ //trigger Display refresh
+ if (Data.getCurrentItem().childs[Main.selectedVideo].payload.guid == guid) {
+ // the updated record is either playing or in Menu
+ if (Player.state != Player.STOPPED) {
+ Main.logToServer("Updating Progress Bar");
+ Display.updateOlForLive (entry.start, entry.dur, Display.GetEpochTime()); // Updates the progress bar
+ }
+ else {
+ Main.logToServer("Updating Right Half");
+ Display.handleDescription(Main.selectedVideo);
+ }
+ }
+
+ Epg.lastGuid = guid;
+ Epg.isActive = false;
+ Main.log("--------------------------------------------");
+ Epg.startEpgUpdating();
+ });
};
-Epg.startEpgUpdating = function() {
- var res = Data.findEpgUpdateTime();
- Main.log("GUID= " + res.guid + " Min= " + res.min);
-}; \ No newline at end of file
diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js
index 69db6ae..382b81c 100755
--- a/smarttv-client/Javascript/Main.js
+++ b/smarttv-client/Javascript/Main.js
@@ -132,17 +132,17 @@ Main.init = function () {
if ( Player.init() && Server.init() && Audio.init()) {
Display.setVolume( Audio.getVolume() );
-// Epg.init();
// Start retrieving data from server
Server.dataReceivedCallback = function() {
- /* Use video information when it has arrived */
- Display.setVideoList(Main.selectedVideo, Main.selectedVideo);
+ /* Use video information when it has arrived */
+ Display.setVideoList(Main.selectedVideo, Main.selectedVideo);
- Display.show();
- if (Player.isLive == true) {
- Epg.startEpgUpdating();
- }
- };
+ Display.show();
+// if (Player.isLive == true) {
+ if (Main.state == Main.eLIVE) {
+ Epg.startEpgUpdating();
+ }
+ };
// Enable key event processing
this.enableKeys();
@@ -152,6 +152,14 @@ Main.init = function () {
Main.log("Failed to initialise");
}
+ ClockHandler.start("#selectNow");
+
+// Epg.updateEpg("S19.2E-1-1101-28106");
+ Server.updateVdrStatus();
+
+// Display.handlerShowProgress();
+// Display.initOlForRecordings();
+// Display.setOlTitle("Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo Hallo Echo");
/*
*
* Fetch JS file
@@ -195,6 +203,11 @@ Main.changeState = function (state) {
var old_state = this.state;
this.state = state;
+ ClockHandler.stop();
+ Epg.stopUpdates();
+
+ Server.updateVdrStatus();
+
switch (this.state) {
case Main.eMAIN:
Main.selectMenuKeyHndl.select = old_state;
@@ -203,24 +216,32 @@ Main.changeState = function (state) {
Display.resetSelectItems(old_state);
document.getElementById("selectScreen").style.display="block";
+
+ ClockHandler.start("#selectNow");
Display.hide();
Display.resetVideoList();
break;
case Main.eLIVE:
document.getElementById("selectScreen").style.display="none";
+ ClockHandler.start("#logoNow");
Display.show();
+ Main.selectedVideo = 0;
Data.reset ();
Main.liveSelected();
break;
case Main.eREC:
document.getElementById("selectScreen").style.display="none";
+ ClockHandler.start("#logoNow");
Display.show();
+ Main.selectedVideo = 0;
Data.reset ();
Main.recordingsSelected();
break;
case Main.eMED:
document.getElementById("selectScreen").style.display="none";
+ ClockHandler.start("#logoNow");
Display.show();
+ Main.selectedVideo = 0;
Data.reset ();
Main.mediaSelected();
break;
@@ -237,17 +258,8 @@ Main.changeState = function (state) {
Main.recordingsSelected = function() {
Player.stopCallback = function() {
- //
-// var msg = "devid:" + Network.getMac() + "\n";
-// Player.curPlayTime = 15.4 * 1000;
- var msg = "";
- msg += "filename:" + Data.getCurrentItem().childs[Main.selectedVideo].payload.guid + "\n";
- msg += "resume:"+ (Player.curPlayTime/1000) + "\n" ;
-
- var XHRObj = new XMLHttpRequest();
- XHRObj.open("POST", Config.serverUrl + "/setResume.xml", true);
- XHRObj.send(msg);
-
+ Server.saveResume ();
+ Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew = "false";
Display.show();
};
Server.errorCallback = function (msg) {
@@ -314,22 +326,23 @@ Main.enableKeys = function() {
document.getElementById("anchor").focus();
};
-Main.keyDown = function() {
+Main.keyDown = function(event) {
+event = event || window.event;
switch (this.state) {
case 0:
// selectView
- this.selectMenuKeyHndl.handleKeyDown();
+ this.selectMenuKeyHndl.handleKeyDown(event);
break;
case 1:
// Live
Main.log("Live - Main.keyDown PlayerState= " + Player.getState());
if(Player.getState() == Player.STOPPED) {
// Menu Key
- this.menuKeyHndl.handleKeyDown();
+ this.menuKeyHndl.handleKeyDown(event);
}
else {
// Live State Keys
- this.livePlayStateKeyHndl.handleKeyDown();
+ this.livePlayStateKeyHndl.handleKeyDown(event);
};
break;
@@ -339,11 +352,11 @@ Main.keyDown = function() {
Main.log("Recordings - Main.keyDown PlayerState= " + Player.getState());
if(Player.getState() == Player.STOPPED) {
// Menu Key
- this.menuKeyHndl.handleKeyDown();
+ this.menuKeyHndl.handleKeyDown(event);
}
else {
// Play State Keys
- this.playStateKeyHndl.handleKeyDown();
+ this.playStateKeyHndl.handleKeyDown(event);
};
break;
@@ -368,22 +381,14 @@ Main.playItem = function (url) {
// Live
// Check for updates
Display.hide();
+ Display.initOlForLive();
Display.showProgress();
- Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title + " - " +Data.getCurrentItem().childs[Main.selectedVideo].payload.prog);
- Display.setStartStop (start_time, (start_time + duration));
Player.isLive = true;
Player.bufferState = 0;
Player.isRecording = false;
- Player.totalTime = Data.getCurrentItem().childs[Main.selectedVideo].payload.dur * 1000;
- Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
-// Display.updateTotalTime(Player.totalTime);
- var digi = new Date((Data.getCurrentItem().childs[Main.selectedVideo].payload.start*1000));
- Main.log (" Date(): StartTime= " + digi.getHours() + ":" + digi.getMinutes() + ":" + digi.getSeconds());
-// Player.cptOffset = (now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000;
- Player.setCurrentPlayTimeOffset((now - Data.getCurrentItem().childs[Main.selectedVideo].payload.start) * 1000);
- Player.OnCurrentPlayTime(0);
+ Display.updateOlForLive (start_time, duration, now);
Main.log ("Live now= " + now + " StartTime= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.start + " offset= " +Player.cptOffset );
Main.log("Live Content= " + Data.getCurrentItem().childs[Main.selectedVideo].title + " dur= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.dur);
@@ -392,38 +397,15 @@ Main.playItem = function (url) {
Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
Player.playVideo(-1);
break;
- case Main.eMED:
- Display.hide();
- Display.showProgress();
-
- Player.setCurrentPlayTimeOffset(0);
- Player.isLive = false;
- Player.isRecording = false;
- Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
-
- document.getElementById("olRecProgressBar").display="none";
- Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
+ case Main.eREC:
+ Display.initOlForRecordings();
Display.resetStartStop();
- Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
- Player.playVideo(-1);
-
- Player.guid = "unknown";
-
- break;
- case Main.eREC:
- /*
- * Check is isnew = false
- * if yes, then open a popup with the choice to play or to resume
- * The player is in any case started from somewhere else
-
- * If resume, then play is issued from resume callback
- */
// Main.getResume(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
Player.guid = Data.getCurrentItem().childs[Main.selectedVideo].payload.guid;
- Server.getResume(Player.guid);
+// Server.getResume(Player.guid);
Player.setCurrentPlayTimeOffset(0);
Player.isLive = false;
@@ -447,11 +429,9 @@ Main.playItem = function (url) {
document.getElementById("olRecProgressBar").display="none";
}
Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
- Display.resetStartStop();
Main.log("IsNew= " +Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew);
-
-/* if (Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew == "false") {
+ if (Data.getCurrentItem().childs[Main.selectedVideo].payload.isnew == "false") {
Buttons.show();
}
else {
@@ -460,18 +440,41 @@ Main.playItem = function (url) {
Player.playVideo(-1);
}
-*/
+
break;
- };
+ case Main.eMED:
+ Display.hide();
+ Display.initOlForRecordings();
+ Display.showProgress();
+
+ Player.setCurrentPlayTimeOffset(0);
+ Player.isLive = false;
+ Player.isRecording = false;
+ Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
+
+ document.getElementById("olRecProgressBar").display="none";
+ Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
+ Display.resetStartStop();
+
+ Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
+ Player.playVideo(-1);
+
+ Player.guid = "unknown";
+
+ break;
+ default:
+ Main.logToServer("ERROR in Main.playItem: should not be here");
+ break;
+ };
};
Main.selectPageUp = function() {
- if (this.selectedVideo == 0) {
+/* if (this.selectedVideo == 0) {
Main.changeState(0);
return;
};
-
+*/
Main.previousVideo(Display.LASTIDX + 1);
/* this.selectedVideo = (this.selectedVideo - (Display.LASTIDX + 1));
if (this.selectedVideo < 0) {
@@ -503,7 +506,7 @@ Main.selectPageDown = function() {
Main.nextVideo = function(no) {
// Just move the selectedVideo pointer and ensure wrap around
this.selectedVideo = (this.selectedVideo + no) % Data.getVideoCount();
- Main.log("nextVideo= " + this.selectedVideo);
+ Main.log("Main.nextVideo= " + this.selectedVideo);
};
Main.previousVideo = function(no) {
@@ -512,8 +515,7 @@ Main.previousVideo = function(no) {
if (this.selectedVideo < 0) {
this.selectedVideo += Data.getVideoCount();
}
- Main.log("previousVideo= " + this.selectedVideo);
-
+ Main.log("Main.previousVideo= " + this.selectedVideo);
};
Main.selectNextVideo = function() {
@@ -524,8 +526,7 @@ Main.selectNextVideo = function() {
Display.setVideoListPosition(this.selectedVideo, Main.DOWN);
};
-Main.selectPreviousVideo = function()
-{
+Main.selectPreviousVideo = function() {
Player.stopVideo();
Main.previousVideo(1);
@@ -836,7 +837,8 @@ function cPlayStateKeyHndl(def_hndl) {
};
-cPlayStateKeyHndl.prototype.handleKeyDown = function () {
+cPlayStateKeyHndl.prototype.handleKeyDown = function (event) {
+// var keyCode = event.keyCode;
var keyCode = event.keyCode;
if(Player.getState() == Player.STOPPED) {
@@ -994,7 +996,7 @@ function cLivePlayStateKeyHndl(def_hndl) {
};
-cLivePlayStateKeyHndl.prototype.handleKeyDown = function () {
+cLivePlayStateKeyHndl.prototype.handleKeyDown = function (event) {
var keyCode = event.keyCode;
if(Player.getState() == Player.STOPPED) {
@@ -1016,13 +1018,15 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function () {
if (Main.selectedVideo == (Data.getVideoCount() -1)) {
//Last VideoItem, check wrap around or folder fall-down
if (Data.isRootFolder() != "true") {
- Main.selectedVideo = Data.folderUp();
+// Main.selectedVideo = Data.folderUp();
+ var itm = Data.folderUp();
+ Main.selectedVideo = itm.id;
}
}
Main.nextVideo(1); // increase and wrap
// check, if new element is a folder again
if (Data.getCurrentItem().childs[Main.selectedVideo].isFolder == true) {
- Data.selectFolder(Main.selectedVideo);
+ Data.selectFolder(Main.selectedVideo, Main.selectedVideo);
Main.selectedVideo= 0;
}
// Main.nextVideo(1);
@@ -1042,13 +1046,15 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function () {
if (Main.selectedVideo == 0) {
//First VideoItem,
if (Data.isRootFolder() != "true") {
- Main.selectedVideo = Data.folderUp();
+// Main.selectedVideo = Data.folderUp();
+ var itm = Data.folderUp();
+ Main.selectedVideo = itm.id;
}
}
Main.previousVideo(1);
// check, if new element is a folder again
if (Data.getCurrentItem().childs[Main.selectedVideo].isFolder == true) {
- Data.selectFolder(Main.selectedVideo);
+ Data.selectFolder(Main.selectedVideo, Main.selectedVideo);
Main.selectedVideo= Data.getVideoCount()-1;
}
@@ -1113,7 +1119,7 @@ function cMenuKeyHndl (def_hndl) {
};
-cMenuKeyHndl.prototype.handleKeyDown = function () {
+cMenuKeyHndl.prototype.handleKeyDown = function (event) {
var keyCode = event.keyCode;
Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
@@ -1137,7 +1143,7 @@ cMenuKeyHndl.prototype.handleKeyDown = function () {
if (Data.getCurrentItem().childs[Main.selectedVideo].isFolder == true) {
Main.log ("selectFolder= " +Main.selectedVideo);
- Data.selectFolder(Main.selectedVideo);
+ Data.selectFolder(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
Main.selectedVideo= 0;
Display.setVideoList(Main.selectedVideo, Main.selectedVideo); // thlo
}
@@ -1157,9 +1163,11 @@ cMenuKeyHndl.prototype.handleKeyDown = function () {
Main.changeState(0);
}
else {
- Main.selectedVideo = Data.folderUp();
+// Main.selectedVideo = Data.folderUp();
+ var itm = Data.folderUp();
+ Main.selectedVideo = itm.id;
Main.log("folderUp selectedVideo= " + Main.selectedVideo);
- Display.setVideoList(Main.selectedVideo, Main.selectedVideo); // thlo
+ Display.setVideoList(Main.selectedVideo, itm.first); // thlo
}
widgetAPI.blockNavigation(event);
@@ -1193,7 +1201,7 @@ function cSelectMenuKeyHndl (def_hndl) {
this.selectMax = 4; // Highest Select Entry
};
-cSelectMenuKeyHndl.prototype.handleKeyDown = function () {
+cSelectMenuKeyHndl.prototype.handleKeyDown = function (event) {
var keyCode = event.keyCode;
Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
diff --git a/smarttv-client/Javascript/Options.js b/smarttv-client/Javascript/Options.js
index f59a58a..55eebf9 100755
--- a/smarttv-client/Javascript/Options.js
+++ b/smarttv-client/Javascript/Options.js
@@ -122,8 +122,8 @@ Options.deleteAll = function () {
Options.deleteChar = function() {
var txt = document.getElementById(Options.inputElm).value;
- alert("Options.cursorPos= " +Options.cursorPos);
- alert("txt.length= " +txt.length);
+// alert("Options.cursorPos= " +Options.cursorPos);
+// alert("txt.length= " +txt.length);
document.getElementById(Options.inputElm).value = txt.slice(0, (Options.cursorPos-1)) + txt.slice(Options.cursorPos);
Options.cursorPos = Options.cursorPos -1;
Options.setCursor(Options.cursorPos);
diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js
index 9d9c1e0..4105ba9 100755
--- a/smarttv-client/Javascript/Player.js
+++ b/smarttv-client/Javascript/Player.js
@@ -173,7 +173,9 @@ Player.playVideo = function(resume_pos) {
Display.updatePlayTime();
Display.status("Play");
- Display.showStatus();
+ Display.hideStatus();
+// Display.showStatus();
+
Display.showProgress();
this.state = this.PLAYING;
@@ -181,12 +183,13 @@ Player.playVideo = function(resume_pos) {
Player.ResetTrickPlay();
Player.skipDuration = Config.skipDuration; // reset
- Main.log ("StartPlayback for " + this.url);
+ Main.log ("Player.playVideo: StartPlayback for " + this.url);
if (resume_pos == -1)
this.plugin.Play( this.url );
else
this.plugin.ResumePlay(this.url, resume_pos);
+
Audio.plugin.SetSystemMute(false);
pluginObj.setOffScreenSaver();
this.pluginBD.DisplayVFD_Show(0100); // Play
@@ -199,6 +202,7 @@ Player.pauseVideo = function() {
this.state = this.PAUSED;
Display.status("Pause");
+ Display.showStatus();
var res = this.plugin.Pause();
if (res == false)
Display.showPopup("pause ret= " + ((res == true) ? "True" : "False"));
@@ -232,6 +236,7 @@ Player.resumeVideo = function() {
Display.showProgress();
this.state = this.PLAYING;
Display.status("Play");
+ Display.hideStatus();
var res = this.plugin.Resume();
if (res == false)
Display.showPopup("resume ret= " + ((res == true) ? "True" : "False"));
@@ -257,7 +262,7 @@ Player.jumpToVideo = function(percent) {
// Display.showPopup("jumpToVideo= " + percent + "% of " + (this.totalTime/1000) + "sec<br>--> tgt = " + tgt + "sec curPTime= " + (this.curPlayTime/1000)+"sec");
this.plugin.Stop();
- Display.showStatus();
+// Display.showStatus();
var res = this.plugin.ResumePlay(this.url, tgt );
if (res == false)
@@ -390,7 +395,7 @@ Player.onBufferingStart = function() {
// should trigger from here the overlay
Display.showProgress();
Display.status("Buffering...");
- Display.showStatus();
+// Display.showStatus();
};
Player.onBufferingProgress = function(percent)
@@ -447,11 +452,10 @@ Player.OnStreamInfoReady = function() {
// Player.curPlayTimeStr = Display.durationString(Player.totalTime / 1000.0);
Player.totalTimeStr =Display.durationString(Player.totalTime / 1000.0);
-/* var height = Player.plugin.GetVideoHeight();
- var width = Player.GetVideoWidth();
- Display.showPopup("Resolution= " + height + " x " +width);
- Main.log("Resolution= " + height + " x " +width);
-*/
+ var height = Player.plugin.GetVideoHeight();
+ var width = Player.plugin.GetVideoWidth();
+// Display.showPopup("Resolution= " + height + " x " +width);
+ Main.logToServer("Resolution= " + width + " x " + height );
};
Player.OnRenderingComplete = function() {
@@ -478,8 +482,9 @@ Player.OnStreamNotFound = function() {
Player.OnNetworkDisconnected = function() {
// when the ethernet is disconnected or the streaming server stops supporting the content in the middle of streaming.
Main.log ("ERROR: Lost Stream (Unavailable?)");
-
+
// widgetAPI.putInnerHTML(document.getElementById("popup"), "Lost Stream (Unavailable?)");
Display.showPopup("Lost Stream (Unavailable?)");
+ Server.saveResume();
};
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js
index e53e0d9..3b3226f 100755
--- a/smarttv-client/Javascript/Server.js
+++ b/smarttv-client/Javascript/Server.js
@@ -62,13 +62,8 @@ Server.createVideoList = function() {
Main.log ("creating Video list now");
Main.logToServer("creating Video list now");
-// var splashElement = document.getElementById("splashStatus");
-// Display.putInnerHTML(splashElement, "Creating Video list now" );
if (this.XHRObj.status != 200) {
-// Display.putInnerHTML(splashElement, "XML Server Error " + this.XHRObj.status);
-// Display.status("XML Server Error " + this.XHRObj.status);
-// Display.showPopup("XML Server Error " + this.XHRObj.status);
if (this.errorCallback != null) {
this.errorCallback(this.XHRObj.responseText);
}
@@ -78,7 +73,6 @@ Server.createVideoList = function() {
var xmlResponse = this.XHRObj.responseXML;
if (xmlResponse == null) {
Display.status("xmlResponse == null" );
-// Display.putInnerHTML(splashElement, "Error in XML File ");
Display.showPopup("Error in XML File");
if (this.errorCallback != null) {
this.errorCallback("XmlError");
@@ -86,17 +80,14 @@ Server.createVideoList = function() {
return;
}
var xmlElement = xmlResponse.documentElement;
-// var xmlElement = this.XHRObj.responseXML.documentElement;
if (!xmlElement) {
-// Display.putInnerHTML(splashElement, "Failed to get valid XML!!!");
Display.status("Failed to get valid XML");
Display.showPopup("Failed to get valid XML");
return;
}
else
{
-// Display.putInnerHTML(splashElement, "Parsing ...");
var items = xmlElement.getElementsByTagName("item");
if (items.length == 0) {
Display.showPopup("Something wrong. Response does not contain any item");
@@ -141,6 +132,10 @@ Server.createVideoList = function() {
catch (e) {}
var desc = descriptionElement.firstChild.data;
+ if (Main.state == Main.eLIVE) {
+ Epg.guidTitle[guid] = titleElement.firstChild.data;
+// Main.log("Server: Guid= " + guid +" -> " + Epg.guidTitle[guid]);
+ }
if (titleElement && linkElement) {
var title_list = titleElement.firstChild.data.split("~");
Data.addItem( title_list, {link : linkElement.firstChild.data,
@@ -157,7 +152,6 @@ Server.createVideoList = function() {
}
Data.completed(this.doSort);
-// Display.putInnerHTML(splashElement, "Done...");
if (this.dataReceivedCallback)
{
@@ -167,17 +161,59 @@ Server.createVideoList = function() {
}
};
+Server.updateVdrStatus = function (){
+ Main.log ("get VDR Status");
+ $.ajax({
+ url: Config.serverUrl + "/vdrstatus.xml",
+ 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 unit = "GB";
+ var free_str = free.toFixed(2);
+ if (free_str.length > 6) {
+ free = free / 1024.0;
+ free_str = free.toFixed(2);
+ unit = "TB";
+ }
+// Main.log ("free.length= " + free_str.length);
+ $("#logoDisk").text("Free: " +free_str + unit);
+ $("#selectDisk").text("Free: " +free_str + unit);
+ },
+ error: function(jqXHR, status, error){
+ Main.log("VdrStatus: Error");
+ }
+ });
+}
Server.getResume = function (guid) {
- Main.log ("***** getResume *****");
+// Main.log ("***** getResume *****");
$.ajax({
url: Config.serverUrl + "/getResume.xml",
type : "POST",
data : "filename:" + guid +"\n",
success : function(data, status, XHR ) {
Main.log("**** Resome Success Response - status= " + status + " mime= " + XHR.responseType + " data= "+ data);
- var xmlResponse = XHR.responseXML;
+
+ var resume_str = $(data).find("resume").text();
+ if (resume_str != "") {
+ var resume_val = parseFloat(resume_str);
+ Main.log("resume val= " + resume_val );
+ Main.logToServer("resume val= " + resume_val );
+ Player.resumePos = resume_val;
+// Buttons.show();
+ Player.playVideo( resume_val);
+ }
+ else {
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ }
+
+/* var xmlResponse = XHR.responseXML;
if (xmlResponse == null) {
Main.logToServer("Resume: xmlResponse is null");
Display.hide();
@@ -190,7 +226,6 @@ Server.getResume = function (guid) {
Display.hide();
Display.showProgress();
Player.playVideo();
-
}
var xml_str = (new XMLSerializer()).serializeToString(xmlElement);
Main.logToServer(" XML Response= " + xml_str + " NodeType= " + xmlElement.nodeType);
@@ -203,23 +238,42 @@ Server.getResume = function (guid) {
Main.log("resume val= " + resume_val );
Main.logToServer("resume val= " + resume_val );
Player.resumePos = resume_val;
- Buttons.show();
-// Player.playVideo( resume_val);
+// Buttons.show();
+ Player.playVideo( resume_val);
}
catch (e) {
Main.log("Resume Parsing Error: " +e);
Display.hide();
Display.showProgress();
- Player.playVideo();
+ Player.playVideo(-1);
}
-
+ */
},
error : function (jqXHR, status, error) {
Main.log("**** Resome Error Response - status= " + status + " error= "+ error);
Display.hide();
Display.showProgress();
- Player.playVideo();
+ Player.playVideo(-1);
}
});
};
+Server.saveResume = function() {
+ //
+// var msg = "devid:" + Network.getMac() + "\n";
+// Player.curPlayTime = 15.4 * 1000;
+ var msg = "";
+ msg += "filename:" + Data.getCurrentItem().childs[Main.selectedVideo].payload.guid + "\n";
+ msg += "resume:"+ (Player.curPlayTime/1000) + "\n" ;
+
+ $.post(Config.serverUrl + "/setResume.xml", msg, function(data, textStatus, XHR) {
+ Main.logToServer("SaveResume Status= " + XHR.status );
+ }, "text");
+
+/* var XHRObj = new XMLHttpRequest();
+ XHRObj.open("POST", Config.serverUrl + "/setResume.xml", true);
+ XHRObj.send(msg);
+ */
+};
+
+
diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml
index c239fd8..9e3edde 100755
--- a/smarttv-client/config.xml
+++ b/smarttv-client/config.xml
@@ -9,7 +9,7 @@
<BigThumbIcon>Images/icon/SmartTvWeb_115.png</BigThumbIcon>
<ListIcon>Images/icon/SmartTvWeb_85.png</ListIcon>
<BigListIcon>Images/icon/SmartTvWeb_95.png</BigListIcon>
- <ver>0.86</ver>
+ <ver>0.87</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>
diff --git a/smarttv-client/index.html b/smarttv-client/index.html
index 1241049..fb65aec 100755
--- a/smarttv-client/index.html
+++ b/smarttv-client/index.html
@@ -62,6 +62,12 @@
<div id="popup"></div>
<div id="selectScreen">
<div id="selectView">
+ <table id="selectStatus" width="100%" padding-bottom="15px">
+ <tr align="justify">
+ <td id="selectNow">0:0</td>
+ <td id="selectDisk">Free: 1Gb</td>
+ </tr>
+ </table>
<div id="selectItem1">1: Live</div>
<div id="selectItem2">2: Recordings</div>
<div id="selectItem3">3: Media</div>
@@ -77,8 +83,15 @@
</div>
<div id="main">
- <div id="logo">VDR on SmartTV</div>
-
+ <center>
+ <table width="90%">
+ <tr >
+ <td id="logoNow" >0:0</td>
+ <td id="logoTitle">VDR on SmartTV</td>
+ <td id="logoDisk">Free 1Gb</td>
+ </tr>
+ </table>
+ </center>
<div id ="rightHalf">
<div id="status"></div>
<div id="description"></div>