diff options
author | thlo <smarttv640@gmail.com> | 2013-09-15 08:12:21 +0200 |
---|---|---|
committer | thlo <smarttv640@gmail.com> | 2013-09-15 08:12:21 +0200 |
commit | 88ebe413d168ba254dd0d6a89675283c1f805d55 (patch) | |
tree | 2285be88cab4e4c2b978b425e72222dbeebdfbe7 | |
parent | 9dd62e850315f7aa75b8455a2141133c75e4942e (diff) | |
parent | c10639b7ed6cc898fad009fbcd2ef17b01d15d3b (diff) | |
download | vdr-plugin-smarttvweb-88ebe413d168ba254dd0d6a89675283c1f805d55.tar.gz vdr-plugin-smarttvweb-88ebe413d168ba254dd0d6a89675283c1f805d55.tar.bz2 |
Merge branch 'master' of projects.vdr-developer.org:vdr-plugin-smarttvweb
-rwxr-xr-x | smarttv-client/CSS/Main.css | 54 | ||||
-rw-r--r-- | smarttv-client/Images/helpbar/help_pause.png | bin | 0 -> 206 bytes | |||
-rw-r--r-- | smarttv-client/Images/helpbar/help_play.png | bin | 0 -> 236 bytes | |||
-rw-r--r-- | smarttv-client/Images/helpbar/help_rec.png | bin | 0 -> 320 bytes | |||
-rw-r--r-- | smarttv-client/Images/helpbar/help_stop.png | bin | 0 -> 214 bytes | |||
-rw-r--r-- | smarttv-client/Javascript/Buttons.js | 20 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Config.js | 92 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Display.js | 37 | ||||
-rw-r--r-- | smarttv-client/Javascript/Helpbar.js | 192 | ||||
-rw-r--r-- | smarttv-client/Javascript/ImgViewer.js | 293 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Main.js | 81 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Network.js | 3 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Options.js | 9 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Player.js | 2 | ||||
-rwxr-xr-x | smarttv-client/Javascript/Server.js | 595 | ||||
-rw-r--r-- | smarttv-client/Javascript/Timers.js | 105 | ||||
-rwxr-xr-x | smarttv-client/config.xml | 2 | ||||
-rwxr-xr-x | smarttv-client/index.html | 11 |
18 files changed, 1329 insertions, 167 deletions
diff --git a/smarttv-client/CSS/Main.css b/smarttv-client/CSS/Main.css index 5ee123c..93aba17 100755 --- a/smarttv-client/CSS/Main.css +++ b/smarttv-client/CSS/Main.css @@ -44,6 +44,7 @@ body { padding-bottom:3px;
margin-top:5px;
margin-bottom : 5px;
+ padding-left:3px;
text-align: center;
background : transparent;
border-radius: 0px;
@@ -54,6 +55,7 @@ body { padding-bottom:3px;
margin-top:5px;
margin-bottom : 5px;
+ padding-left:3px;
text-align: center;
border-radius: 3px;
background : white;
@@ -79,7 +81,7 @@ body { border-style:solid;
border-width:1px;
background-color: white;
- background-color: "-webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 50%,rgba(215,222,227,1) 51%,rgba(245,247,249,1) 100%)";
+ background-color: -webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 50%,rgba(215,222,227,1) 51%,rgba(245,247,249,1) 100%);
}
.style_overflow {
@@ -92,10 +94,50 @@ body { border-radius: 4px;
background: red;
}
+
+.style_timerAct {
+ width :8px;
+ height:8px;
+ border-radius: 4px;
+ background: green;
+}
+
.style_timerNone {
width :8px;
}
+.style_headline {
+ color : black;
+ font-size:14px;
+ background : linear-gradient(0deg, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
+ background : -webkit-linear-gradient(top, #1e5799 0%,#2989d8 41%,#7db9e8 100%);
+ border-radius: 3px;
+ -webkit-box-shadow: 2px 2px 1px 2px rgba(0,0,0, 0.5);
+}
+
+
+.style_hbOverlay {
+ position: absolute;
+ z-index:70;
+ border-radius: 7px;
+ border-width:1px;
+ background:rgba(0,0,139, 0.8);
+ border-style:solid;
+ border-width:1px;
+ -webkit-box-shadow:3px 3px 7px 4px rgba(0,0,0, 0.5);
+}
+
+.style_hbOverlayRow {
+ padding-left : 5px;
+ padding-right: 5px;
+}
+
+.style_hbOverlayLElm {
+}
+.style_hbOverlayRElm {
+}
+
+
#timerScreen {
position: absolute;
left: 0px; top: 0px;
@@ -292,7 +334,7 @@ body { position: absolute;
display: none;
left: 120px; top: 10px;
- width: 720px; height: 100px;
+ width: 720px; height: 200px;
border-style:solid;
border-width:2px;
-webkit-border-radius: 7px;
@@ -607,3 +649,11 @@ body { z-index:60;
}
+#imageViewer {
+ position:absolute;
+ left:0px; top:0px;
+ width:100%; height:100%;
+ text-align: center;
+ background: black;
+ z-index:10;
+}
\ No newline at end of file diff --git a/smarttv-client/Images/helpbar/help_pause.png b/smarttv-client/Images/helpbar/help_pause.png Binary files differnew file mode 100644 index 0000000..f3214c7 --- /dev/null +++ b/smarttv-client/Images/helpbar/help_pause.png diff --git a/smarttv-client/Images/helpbar/help_play.png b/smarttv-client/Images/helpbar/help_play.png Binary files differnew file mode 100644 index 0000000..c21cd7a --- /dev/null +++ b/smarttv-client/Images/helpbar/help_play.png diff --git a/smarttv-client/Images/helpbar/help_rec.png b/smarttv-client/Images/helpbar/help_rec.png Binary files differnew file mode 100644 index 0000000..e26ce3e --- /dev/null +++ b/smarttv-client/Images/helpbar/help_rec.png diff --git a/smarttv-client/Images/helpbar/help_stop.png b/smarttv-client/Images/helpbar/help_stop.png Binary files differnew file mode 100644 index 0000000..ca5c7b6 --- /dev/null +++ b/smarttv-client/Images/helpbar/help_stop.png diff --git a/smarttv-client/Javascript/Buttons.js b/smarttv-client/Javascript/Buttons.js index 5791aec..3b946db 100644 --- a/smarttv-client/Javascript/Buttons.js +++ b/smarttv-client/Javascript/Buttons.js @@ -42,6 +42,7 @@ Buttons.init = function (){ // $("#prc-buttons-anchor").attr("onkeydown", "Button.prButton.onInput();");
}
};
+
Buttons.ynReturnCallback = function () {
switch (Main.state) {
case Main.eOPT:
@@ -51,6 +52,10 @@ Buttons.ynReturnCallback = function () { Buttons.ynHide();
Timers.focus();
break;
+ case Main.eMED:
+ Buttons.ynHide();
+
+ break;
default:
break;
}
@@ -79,9 +84,12 @@ Buttons.ynEnterCallback = function () { break;
case Main.eTMR:
- Timers.deleteTimer();
+
+ Timers.timerCallback();
+ break;
+ case Main.eMED:
+ Server.deleteMedFile(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
break;
-
}
break;
@@ -144,6 +152,11 @@ Buttons.prcHide = function () { Main.enableKeys();
};
+//change the Headline Text of the yn buttons (Default is "Delete ?")
+Buttons.ynHeadlineText = function(msg) {
+ $("#yn-btn-text").text(msg);
+};
+
Buttons.ynShow = function () {
Main.log("Buttons.ynShow()");
this.ynButton.show();
@@ -151,6 +164,7 @@ Buttons.ynShow = function () { };
Buttons.ynHide = function () {
+ $("#yn-btn-text").text("Delete ?");
this.ynButton.hide();
switch (Main.state) {
case Main.eOPT:
@@ -257,7 +271,7 @@ Buttons.createYnButtons= function () { var row = $("<tr>", {style: "width:100%; align:center"});
var cell = $("<td>", {style :"height:80%; width:100%", colspan:"3" });
cell.css("align","center");
- var txt_div = $("<div>", {text: "Delete ?"});
+ var txt_div = $("<div>", {text: "Delete ?", id : "yn-btn-text"});
cell.append(txt_div);
row.append(cell);
tbody.append(row);
diff --git a/smarttv-client/Javascript/Config.js b/smarttv-client/Javascript/Config.js index 0583262..08c4cf5 100755 --- a/smarttv-client/Javascript/Config.js +++ b/smarttv-client/Javascript/Config.js @@ -27,9 +27,9 @@ var Config = { recSortType : 0,
playKeyBehavior : 0,
haveYouTube : false,
+ verboseStart : false, // Debug Messages during start (before widget.conf is loaded)
deviceType : 0 // Used to differentiate between browsers and platforms
// 0: Samsung
-
};
@@ -56,12 +56,11 @@ Config.init = function () { if (this.serverUrl != "") {
// Hardcoded server URL. Done with config
Main.log ("Hardcoded server URL. Done with config");
+ Display.showPopup ("Hardcoded server URL. Done with config");
Config.fetchConfig();
return;
}
-
-// if (this.deviceType == 0)
switch (this.deviceType){
case 0:
// This is a Samsung Smart TV
@@ -71,13 +70,22 @@ Config.init = function () { }
catch (e) {
Main.log("curWidget.id does not exists. Is that really a Samsung?");
+ Display.showPopup ("curWidget.id does not exists. Is that really a Samsung?");
return;
};
var fileSystemObj = new FileSystem();
- if (fileSystemObj.isValidCommonPath(curWidget.id) == 0){
+// if (fileSystemObj.isValidCommonPath(curWidget.id) == 0){
+ if (fileSystemObj.isValidCommonPath(curWidget.id) != 1){
+// isValidCommonPath returns:
+// 0 : JS function failed
+// 1 : valid
+// 2 : invalid
+
Main.log("First Launch of the Widget");
+ if (Config.verboseStart == true)
+ Display.showPopup ("First Launch of the Widget");
// should switch to the config screen here
var res = fileSystemObj.createCommonDir(curWidget.id);
if (res == true) {
@@ -85,8 +93,8 @@ Config.init = function () { return;
}
else {
+ Display.showPopup ("WARNING: Cannot create widget folder. Ignoring and trying to configure");
Config.doFirstLaunch();
- 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);
@@ -94,17 +102,28 @@ Config.init = function () { return;
}
else {
- // ok, there should be some config info
+ // ok, there should be some config info
+ if (Config.verboseStart == true)
+ Display.showPopup ("Reading Context Now");
+
Config.readContext();
+ // async check of available VDR servers. Will continue from a different place
return; //thlo: TODO
}
break;
+ default:
+ // another TV set.
+ break;
}
+
+ //the function is likely never executed to the end. Check!
Server.notifyServer("started");
Config.fetchConfig();
};
Config.doFirstLaunch = function () {
+ if (Config.verboseStart == true)
+ Display.showPopup("OK: First Launch. Configure now");
Config.firstLaunch = true;
Main.changeState(Main.eOPT);
@@ -129,10 +148,15 @@ Config.getWidgetVersion = function () { Config.fetchConfig = function () {
+ if (Config.verboseStart == true)
+ Display.showPopup ("Fetching widget.conf...");
+
$.ajax({
url: this.serverUrl + "/widget.conf",
type : "GET",
success : function(data, status, XHR ) {
+ if (Config.verboseStart == true)
+ Display.showPopup ("Processing widget.conf...");
Main.log ("Parsing config XML now");
Main.logToServer("Parsing config XML now");
@@ -188,7 +212,7 @@ Config.fetchConfig = function () { },
error : function (XHR, status, error) {
Main.log ("Config Server Error");
- Display.showPopup("Config Server Error " + XHR.status + " " + status);
+ Display.showPopup("ERROR while fetching widget.conf " + XHR.status + " " + status);
// Display.showPopup(Lang[Lang.sel].configNoServer + " "+ XHR.status + " " + status);
Main.logToServer("Config Server Error " + XHR.status + " " + status);
@@ -209,7 +233,10 @@ Config.deletedFromContext = function(idx) { Config.updateContext = function (addr) {
Main.log("Config.updateContext with ("+addr+")");
Main.logToServer("Config.updateContext with ("+addr+")");
-
+
+ if ((Config.verboseStart == true) && (Config.firstLaunch == true))
+ Display.showPopup("Config.updateContext with ("+addr+")");
+
var found = false;
for (var i = 0; i < Config.vdrServers.serverUrlList.length; i++) {
@@ -223,27 +250,15 @@ Config.updateContext = function (addr) { // don't overwrite, if the address is already there.
Main.log("Config.updateContext: don't overwrite -> return");
Notify.showNotify("Server already included -> Ignoring", true);
-
+ if ((Config.verboseStart == true) && (Config.firstLaunch == true))
+ Display.showPopup("Config.updateContext: don't overwrite -> return");
return;
}
Config.vdrServers.serverUrlList.push(addr);
Config.writeServerUrlList();
- /*
- var fileSystemObj = new FileSystem();
- var fd = fileSystemObj.openCommonFile(Config.cfgFileName,"w");
-
-// fd.writeLine('serverAddr ' + addr); // SHould be overwritten by Options menue
- for (var i = 0; i < Config.vdrServers.serverUrlList.length; i++) {
- Main.log ("Config.updateContext itm= " + Config.vdrServers.serverUrlList[i]);
- Main.logToServer ("Config.updateContext itm= " + Config.vdrServers.serverUrlList[i]);
- fd.writeLine('serverAddr ' + Config.vdrServers.serverUrlList[i]);
- }
-
- fileSystemObj.closeCommonFile(fd);
-*/
- if (Config.serverAddr == "") {
+ if (Config.serverAddr == "") {
// only change the server, when needed.
Config.serverAddr = addr;
Config.serverUrl = "http://" + Config.serverAddr;
@@ -251,16 +266,6 @@ Config.updateContext = function (addr) { }
};
-/*
-Config.writeContext = function (addr) {
- var fileSystemObj = new FileSystem();
-
- var fd = fileSystemObj.openCommonFile(Config.cfgFileName,"w");
-
- fd.writeLine('serverAddr ' + addr); // SHould be overwritten by Options menue
- fileSystemObj.closeCommonFile(fd);
-};
-*/
Config.writeServerUrlList = function () {
var fileSystemObj = new FileSystem();
@@ -269,11 +274,15 @@ Config.writeServerUrlList = function () { for (var i = 0; i < Config.vdrServers.serverUrlList.length; i++) {
Main.log ("Config.writeServerUrlList itm= " + Config.vdrServers.serverUrlList[i]);
Main.logToServer ("Config.writeServerUrlList itm= " + Config.vdrServers.serverUrlList[i]);
+ if (Config.verboseStart == true)
+ Display.showPopup ("Config.writeServerUrlList: writing VdrServer= " + Config.vdrServers.serverUrlList[i]);
+
fd.writeLine('serverAddr ' + Config.vdrServers.serverUrlList[i]);
}
fileSystemObj.closeCommonFile(fd);
-
+ if (Config.verboseStart == true)
+ Display.showPopup ("Config.writeServerUrlList done ");
};
Config.readContext = function () {
@@ -291,7 +300,10 @@ Config.readContext = function () { if (avp.length > 1) {
Config.vdrServers.serverUrlList.push(avp[1]);
Main.log("Config.readContext avp[1]= " + avp[1]);
- Config.serverAddr = avp[1];
+ if (Config.verboseStart == true)
+ Display.showPopup ("Config.readContext: serverAddr= " + avp[1]);
+
+ Config.serverAddr = avp[1];
Config.serverUrl = "http://" + Config.serverAddr;
}
else {
@@ -306,10 +318,12 @@ Config.readContext = function () { }
catch (e) {
Main.log("Config.readContext: Error while reading: e= " +e);
+ Display.showPopup("Config.readContext: Error while reading: e= " +e);
+ Display.showPopup("Trying to create now the local config file" );
var res = fileSystemObj.createCommonDir(curWidget.id);
if (res == true) {
Main.log("WARNING: ConfigRead Error. Launching Config-Menu from here");
- // Display.showPopup ("Config Read Error: Try widget restart");
+ Display.showPopup ("Config Read Error: Try widget restart");
}
else {
@@ -318,13 +332,13 @@ Config.readContext = function () { 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();
}
-
-// Config.vdrServers.serverUrlList.push("192.168.1.142:8000");
+
+ // Now, I read at least one VDR server address from Config file
+
this.vdrServers.checkServers();
if (Config.vdrServers.serverUrlList.length > 1) {
// Now I should show the popup to select the server.
diff --git a/smarttv-client/Javascript/Display.js b/smarttv-client/Javascript/Display.js index c0b1093..b1f7d37 100755 --- a/smarttv-client/Javascript/Display.js +++ b/smarttv-client/Javascript/Display.js @@ -47,6 +47,11 @@ Display.init = function() this.popupOlHandler.init(Display.handlerShowPopup, Display.handlerHidePopup);
this.infoOlHandler.init(Display.handlerShowInfo, Display.handlerHideInfo);
this.infoOlHandler.olDelay = Config.infoTimeout;
+
+ // Different popup behavior during config phase;
+ this.popupOlHandler.olDelay = 30*1000;
+ $("#popup").css("height", "300px");
+ // end
if (!this.statusDiv) {
success = false;
@@ -168,7 +173,7 @@ Display.getNumString =function(num, fmt) { };
Display.selectItem = function (item) {
-
+// item.setAttribute("class", "style_menuItemSelected");
item.style.color = "black";
item.style.background = "white";
item.style.background = "-webkit-linear-gradient(top, rgba(246,248,249,1) 0%,rgba(229,235,238,1) 50%,rgba(215,222,227,1) 51%,rgba(245,247,249,1) 100%)";
@@ -178,6 +183,7 @@ Display.selectItem = function (item) { };
Display.unselectItem = function (item) {
+// item.setAttribute("class", "style_menuItem");
item.style.color = "white";
// item.style.backgroundColor = "transparent";
item.style.background = "transparent";
@@ -276,7 +282,7 @@ Display.tuneLeftSide = function() { res.w3 = "5%";
switch (Main.state) {
case Main.eLIVE:
- res.w1 = "5%";
+ res.w1 = "7%";
res.w2 = "25%";
res.w3 = "65%";
break;
@@ -900,9 +906,26 @@ Display.handlerHideInfo = function() { * Popup handlers
*/
Display.showPopup = function(text) {
- var oldHTML = document.getElementById("popup").innerHTML;
- Display.putInnerHTML(document.getElementById("popup"), oldHTML + "<br>" + text);
+// var oldHTML = document.getElementById("popup").innerHTML;
+// Display.putInnerHTML(document.getElementById("popup"), oldHTML + "<br>" + text);
+
+ if (text == "")
+ this.popupOlHandler.show();
+
+ var elm = $("<p>", {text: text});
+ $("#popup").append(elm);
this.popupOlHandler.show();
+
+ Display.scrollPopup ();
+};
+
+Display.scrollPopup = function () {
+ var t = $('#popup').children().last().position().top;
+ var h = $('#popup').children().last().outerHeight();
+ if ((t + h) > $("#popup").height()) {
+ $("#popup").animate ({scrollTop: $("#popup").scrollTop() + t + h - $("#popup").height()}, 200);
+ }
+
};
Display.handlerShowPopup = function() {
@@ -911,6 +934,10 @@ Display.handlerShowPopup = function() { };
Display.handlerHidePopup = function() {
+ $("#popup").css("height", "100px");
+
+ $('#popup').children().each(function() { $(this).remove(); });
+
document.getElementById("popup").style.display="none";
Display.putInnerHTML(document.getElementById("popup"), "");
};
@@ -1035,7 +1062,7 @@ OverlayHandler.prototype.checkHideCallback = function () { var now = Display.GetEpochTime();
if (now >= this.hideTime) {
- this.olDelay = 3000;
+// this.olDelay = 3000;
if (this.hideCallback) {
this.hideCallback();
}
diff --git a/smarttv-client/Javascript/Helpbar.js b/smarttv-client/Javascript/Helpbar.js index 7511e09..ccff0f9 100644 --- a/smarttv-client/Javascript/Helpbar.js +++ b/smarttv-client/Javascript/Helpbar.js @@ -4,6 +4,10 @@ var Helpbar = { Helpbar.init = function () {
if (this.isInited == false) {
+ this.helpbarOlHandler = new OverlayHandler("HelpbarHndl");
+ this.helpbarOlHandler.init(Helpbar.showHelpbarOverlay, Helpbar.hideHelpbarOverlay);
+ this.helpbarOlHandler.olDelay = 5000;
+
Helpbar.createHelpbar();
Helpbar.hide();
Helpbar.hideOptSrv();
@@ -72,4 +76,190 @@ Helpbar.addItem = function(url, msg, row) { $("<td>").append($("<img>", { src: url})).appendTo(row);
$("<td>").append($("<p>", { text: msg})).appendTo(row);
-};
\ No newline at end of file +};
+
+//--------------------------------------------------------
+
+Helpbar.showHelpbar = function () {
+ Main.log ("Helpbar.showHelpbar");
+ this.helpbarOlHandler.show();
+};
+
+Helpbar.showHelpbarOverlay = function() {
+
+ $("<div>", {id:"helpbarOverlay", class: "style_hbOverlay"}).appendTo ($("body"));
+ $("#helpbarOverlay").append($("<div>", {text: "RC Keys", style : "padding-left : 5px; padding-right: 5px;"}));
+
+
+ switch (Main.state) {
+ case Main.eMAIN:
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Page Up / Down"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Tune in / Select Group"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_back.png", "Exit"));
+
+ break;
+ case Main.eLIVE:
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_0_9.png", "Direct Channel Access"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ud.png", "Change Channel"));
+// $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ff_rw.png", "Trickplay (if supported)"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Show Progress"));
+
+
+
+ if(Player.getState() == Player.STOPPED) {
+ // Menu Key
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Tune in / Select Group"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_back.png", "Group Up / Exit"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Page Up / Down"));
+
+ }
+ else {
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_rec.png", "Start Recording"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_pause.png", "Pause (Experimental)"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_green.png", "3D"));
+// $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Next Subtitle"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_blue.png", "Next Audio Track"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_size.png", "Change Picture Size"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_info.png", "Recording Info"));
+ };
+
+ break;
+ case Main.eREC:
+ if(Player.getState() == Player.STOPPED) {
+ // Menu Key
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ud.png", "Cursor up / down"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Page Up / Down"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Start Playback / Select Folder"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_back.png", "Folder Up / Exit"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_red.png", "Recording Commands Menu"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_blue.png", "Change Sorting [by date, ...]"));
+ }
+ else {
+ // while playing
+ var num_key_text = "";
+ switch (Config.playKeyBehavior) {
+ case 1:
+ num_key_text = "<Num> * 1min";
+ break;
+ default:
+ num_key_text = "<Num>/10 * RecDuration";
+ break;
+ }
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_0_9.png", num_key_text)); // depends on config
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Skip"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ud.png", "Change Skip Duration"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ff_rw.png", "Trickplay (if supported)"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Show Progress"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_pause.png", "Pause / Play"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_size.png", "Change Picture Size"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_info.png", "Recording Info"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_green.png", "3D"));
+// $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Next Subtitle"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_blue.png", "Next Audio Track"));
+ };
+
+ break;
+ case Main.eMED:
+ if(Player.getState() == Player.STOPPED) {
+ if (ImgViewer.isActive == true) {
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Next / Prev Image"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Delete Image"));
+ }
+ else {
+ // Menu Key
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ud.png", "Cursor up / down"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Page Up / Down"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Start Playback / Select Folder"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_back.png", "Folder Up / Exit"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_red.png", "Recording Commands Menu"));
+// $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_blue.png", "Change Sorting [by date, ...]"));
+ } // else
+ }
+ else {
+ // while playing
+ var num_key_text = "";
+ switch (Config.playKeyBehavior) {
+ case 1:
+ num_key_text = "<Num> * 1min";
+ break;
+ default:
+ num_key_text = "<Num>/10 * RecDuration";
+ break;
+ }
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_0_9.png", num_key_text)); // depends on config
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_lr.png", "Skip"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ud.png", "Change Skip Duration"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_ff_rw.png", "Trickplay (if supported)"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_enter.png", "Show Progress"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_pause.png", "Pause / Play"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_size.png", "Change Picture Size"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_info.png", "Recording Info"));
+
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_green.png", "3D"));
+// $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Next Subtitle"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_blue.png", "Next Audio Track"));
+ };
+
+ break;
+ case Main.eTMR:
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_red.png", "Toggle Activation"));
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Delete Timer"));
+ break;
+ case Main.eURLS:
+ $("#helpbarOverlay").append(Helpbar.createRow("Images/helpbar/help_yellow.png", "Delete Entry"));
+ break;
+ case Main.eSRVR:
+ break;
+ case Main.eOPT:
+ break;
+ default:
+ break;
+ }
+
+ var p_width = $("body").outerWidth();
+ var p_height = $("body").outerHeight();
+
+
+ Helpbar.maxWidth = 0;
+ // I also need to find the max of the r_elms
+ $("#helpbarOverlay").find('img').each(function () {
+ if ($(this).outerWidth() > Helpbar.maxWidth)
+ Helpbar.maxWidth = $(this).outerWidth();
+ });
+ Helpbar.maxRElmWidth = 0;
+ $("#helpbarOverlay").find('.style_hbOverlayRElm').each(function () {
+ if ($(this).outerWidth() > Helpbar.maxRElmWidth)
+ Helpbar.maxRElmWidth = $(this).outerWidth();
+ });
+
+ $(".style_hbOverlayLElm").css ('width', Helpbar.maxWidth+10+"px");
+ $(".style_hbOverlayRow").css ('width', Helpbar.maxRElmWidth+Helpbar.maxWidth+40+"px");
+
+ $("#helpbarOverlay").css({"left": ((p_width - $("#helpbarOverlay").outerWidth()) -40) +"px",
+ "top": ((p_height - $("#helpbarOverlay").outerHeight()) /2) +"px"});
+
+};
+
+Helpbar.createRow = function (url, msg) {
+ var row = $("<div>", {class : "style_hbOverlayRow"});
+
+ var l_elm = $("<div>", {style : "display: inline-block;", class : "style_hbOverlayLElm"});
+ var r_elm = $("<div>", {style : "display: inline-block;", class : "style_hbOverlayRElm"});
+
+ l_elm.append($("<img>", { src: url}));
+ r_elm.append($("<div>", { text: msg}));
+
+ row.append(l_elm);
+ row.append(r_elm);
+
+ return row;
+};
+
+Helpbar.hideHelpbarOverlay = function() {
+ $("#helpbarOverlay").remove();
+};
diff --git a/smarttv-client/Javascript/ImgViewer.js b/smarttv-client/Javascript/ImgViewer.js new file mode 100644 index 0000000..af7495b --- /dev/null +++ b/smarttv-client/Javascript/ImgViewer.js @@ -0,0 +1,293 @@ +var ImgViewer = {
+ returnCallback : null
+};
+
+ImgViewer.init = function () {
+ var elem = document.getElementById('iv-anchor');
+ elem.setAttribute('onkeydown', 'ImgViewer.onInput();');
+
+ this.isActive = false;
+
+ this.eFullScreen = 0;
+ this.eMedIcons = 1;
+
+ this.screenMode = this.eFullScreen;
+
+
+ $("#imageViewer").hide();
+};
+
+ImgViewer.show = function () {
+ Display.hide();
+ this.isActive = true;
+ this.screenMode = this.eFullScreen;
+ this.imgList = [];
+ this.curImg = 0;
+
+ $("#imageViewer").show();
+
+ $("#iv-anchor").focus();
+
+ Main.log ("URL= " + Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
+
+ Spinner.show();
+ ImgViewer.createImgArray();
+
+ if (this.imgList.length == 0) {
+ Notify.showNotify("No Image Found", true);
+ ImgViewer.hide();
+ return;
+ }
+ ImgViewer.showImage();
+
+ /*
+ if (ImgViewer.isImage() == true) {
+ ImgViewer.showImage();
+ }
+ else {
+ ImgViewer.showNextImage();
+ }
+ */
+};
+
+ImgViewer.hide = function () {
+ this.isActive = false;
+ this.screenMode = this.eFullScreen;
+ Display.show();
+ $("#imageViewer").hide();
+ Spinner.hide();
+
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+
+ Main.enableKeys();
+};
+
+ImgViewer.createImgArray = function () {
+ var max = Data.getVideoCount();
+ for (var i = 0; i < Data.getVideoCount() ; i ++) {
+ if (ImgViewer.isImage( (Main.selectedVideo + i) % max) == true) {
+ this.imgList.push((Main.selectedVideo + i) % max);
+ }
+ }
+
+};
+
+ImgViewer.isImage = function(no) {
+ if ((Data.getCurrentItem().childs[no].payload.mime == "image/jpeg") ||
+ (Data.getCurrentItem().childs[no].payload.mime == "image/png"))
+ return true;
+ else
+ return false;
+};
+
+ImgViewer.isImage = function() {
+ if ((Data.getCurrentItem().childs[Main.selectedVideo].payload.mime == "image/jpeg") ||
+ (Data.getCurrentItem().childs[Main.selectedVideo].payload.mime == "image/png"))
+ return true;
+ else
+ return false;
+
+};
+
+ImgViewer.showNextImage = function () {
+ this.curImg++;
+ if (this.curImg >= this.imgList.length)
+ this.curImg = 0;
+
+ ImgViewer.showImage();
+
+ /*
+ Main.logToServer("ImgViewer.showNextImage curIdx= " +Main.selectedVideo);
+ var start_ts = new Date().getTime();
+
+ var start_idx = Main.selectedVideo;
+ var found_next = false;
+ Main.nextVideo(1) ;
+ while ( start_idx != Main.selectedVideo ) {
+ Main.logToServer ("ImgViewer.showNextImage: Main.selectedVideo increased to " + Main.selectedVideo);
+ if (ImgViewer.isImage() == true) {
+
+ Main.logToServer( "Found idx= " +Main.selectedVideo);
+ found_next = true;
+ break;
+ }
+ Main.nextVideo(1);
+
+ }
+ var now = new Date().getTime();
+ Main.logToServer ("Duration= " + (now-start_ts));
+
+ if (found_next)
+ ImgViewer.showImage();
+ else {
+ Notify.showNotify("No Image Found", true);
+ ImgViewer.hide();
+ }
+ */
+};
+
+ImgViewer.showPrevImage = function () {
+ this.curImg--;
+ if (this.curImg <0)
+ this.curImg = this.imgList.length-1;
+
+ ImgViewer.showImage();
+
+/*
+ Main.log("ImgViewer.showPrevImage curIdx= " +Main.selectedVideo);
+ var start_ts = new Date().getTime();
+
+ var start_idx = Main.selectedVideo;
+ var found_next = false;
+ Main.previousVideo(1);
+ while ( start_idx != Main.selectedVideo ) {
+ Main.log ("ImgViewer.showPrevImage: Main.selectedVideo increased to " + Main.selectedVideo);
+ if (ImgViewer.isImage() == true) {
+
+ Main.log( "Found idx= " +Main.selectedVideo);
+ found_next = true;
+ break;
+ }
+ Main.previousVideo(1);
+
+ }
+ var now = new Date().getTime();
+ Main.logToServer ("Duration= " + (now-start_ts));
+
+ if (found_next)
+ ImgViewer.showImage();
+ else {
+ Notify.showNotify("No Image Found", true);
+ ImgViewer.hide();
+ }
+ */
+};
+
+ImgViewer.showImage = function () {
+// Main.logToServer("showImage: "+ Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
+ Main.logToServer("showImage: "+ Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link);
+
+ $("#ivImage")
+ .error(function() {
+ Main.log("ERROR");
+ ImgViewer.hide();
+ Spinner.hide();
+ Notify.showNotify("Error while loading image.", true);
+ })
+ .load(function () {
+ Main.logToServer("showImage Loaded");
+ Spinner.hide();
+ if($(this).height() > $(this).width()) {
+ $(this).css({"height": "100%", "width" : "auto"});
+ }
+ else {
+ $(this).css({"width": "100%", "height" : "auto"});
+ }})
+ .attr('src', Data.getCurrentItem().childs[this.imgList[this.curImg]].payload.link +"?"+Math.random());
+// .attr('src', Data.getCurrentItem().childs[Main.selectedVideo].payload.link +"?"+Math.random());
+};
+
+function ImgLoader (url, elm) {
+ this.url = url;
+ this.elm = elm;
+
+ this.elm
+ .error(function() {
+ Main.log("ERROR");
+ ImgViewer.hide();
+ Spinner.hide();
+ Notify.showNotify("Error while loading image.", true);
+ })
+ .load(function () {
+ Main.logToServer("showImage Loaded");
+ Spinner.hide();
+ if($(this).height() > $(this).width()) {
+ $(this).css({"height": "100%", "width" : "auto"});
+ }
+ else {
+ $(this).css({"width": "100%", "height" : "auto"});
+ }})
+ .attr('src', this.url +"?"+Math.random());
+
+ };
+
+
+ImgViewer.showImageGrid = function () {
+
+};
+
+ImgViewer.showGridRow = function (no) {
+ var p_width = $("body").outerWidth();
+ var elms = p_width / no;
+
+ var row = $("<div>");
+
+ var l_elm = $("<div>", {style : "display: inline-block; ", class : "style_hbOverlayLElm"});
+ var r_elm = $("<div>", {style : "display: inline-block;"});
+
+};
+
+ImgViewer.onInput = function () {
+ var keyCode = event.keyCode;
+ Main.log(" ImgViewer key= " + keyCode);
+ switch(keyCode) {
+ case tvKey.KEY_LEFT:
+ Main.log("ImgViewer-Select Left");
+ Spinner.show();
+
+ ImgViewer.showPrevImage();
+ break;
+ case tvKey.KEY_RIGHT:
+ Main.log("ImgViewer-Select Right");
+ Spinner.show();
+
+ ImgViewer.showNextImage();
+ break;
+ case tvKey.KEY_ENTER:
+ if (this.screenMode == this.eFullScreen) {
+ this.screenMode = this.eMedIcons;
+ }
+ else {
+ this.screenMode = this.eFullScreen;
+ }
+ ;
+
+ // Buttons.ynShow();
+ // Show overlay info
+
+ break;
+ case tvKey.KEY_RETURN:
+ case tvKey.KEY_EXIT:
+ case tvKey.KEY_STOP:
+ Main.selectedVideo = this.imgList[this.curImg];
+
+ ImgViewer.hide();
+ if (this.returnCallback != null)
+ this.returnCallback();
+ break;
+ case tvKey.KEY_BLUE:
+ break;
+ case tvKey.KEY_YELLOW:
+ Main.log("Delete YE Button");
+ Buttons.ynShow();
+// Server.deleteMedFile(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
+ break;
+ case tvKey.KEY_TOOLS:
+ Helpbar.showHelpbar();
+ break;
+
+ }
+ try {
+ widgetAPI.blockNavigation(event);
+ }
+ catch (e) {
+ };
+
+};
+// In need an Image Folder on the server, similar to Media Folder
+// All jpg and JPG are found recursively and provided as a Data Structure
+// Subfolders are separated through ~
+
+// in need some plugin preceedures to handle, delete, rotate, ...
+
+// The Media Folder should actually already provide the jpgs
\ No newline at end of file diff --git a/smarttv-client/Javascript/Main.js b/smarttv-client/Javascript/Main.js index 1d62d74..55c2fa2 100755 --- a/smarttv-client/Javascript/Main.js +++ b/smarttv-client/Javascript/Main.js @@ -88,6 +88,7 @@ Main.onLoad = function() { }
catch (e) {
+ // Not a TV set. Use Config.serverAddrDefault as server address
Config.deviceType = 1;
tvKey = Main.tvKeys;
@@ -135,8 +136,13 @@ showHandler = function() { // Called by Config, when done
Main.init = function () {
Main.log("Main.init()");
+ if (Config.verboseStart == true)
+ Display.showPopup ("Config done: Main.init() now" );
if (Config.debug == true) {
+ if (Config.verboseStart == true)
+ Display.showPopup ("Main.init: widgetdebug is true. Logging to (" + Config.serverUrl + ")");
+
Main.logToServer = function (msg) {
if (Config.serverUrl == "" )
return;
@@ -191,14 +197,20 @@ Main.init = function () { Comm.init();
Timers.init();
+ ImgViewer.init();
// Timers.show();
+
+ //set popup to normal timeout duration
+ Display.popupOlHandler.olDelay = 3*1000;
+ Config.verboseStart = false;
+ Display.scrollPopup ();
+ // end
if (Config.deviceType == 0){
Main.log("ProductInfo= " + deviceapis.tv.info.getProduct());
Main.logToServer("ProductInfo= " + deviceapis.tv.info.getProduct());
- Main.logToServer("isBdPlayer= " + Main.isBdPlayer());
- Main.logToServer("TimeZone= " + deviceapis.tv.info.getTimeZone());
+ Main.logToServer("isTvSet= " + Main.isTvSet());
}
// TestHandler.showMenu(20);
@@ -221,9 +233,10 @@ Main.init = function () { }
*/
// Read widget conf. find the file to log
-/*
+
+ /*
xhttp=new XMLHttpRequest();
- xhttp.open("GET","$MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js",false);
+ xhttp.open("GET","$MANAGER_WIDGET/Common/API/TVKeyValue.js",false);
xhttp.send("");
xmlDoc=xhttp.responseText;
Main.logToServer (xmlDoc);
@@ -261,8 +274,8 @@ Main.testUrls = function () { };
-Main.isBdPlayer = function () {
- if (deviceapis.tv.info.getProduct() == 2) //deviceapis.tv.info.PRODUCT_TYPE_BD
+Main.isTvSet = function () {
+ if (deviceapis.tv.info.getProduct() == 0) //deviceapis.tv.info.PRODUCT_TYPE_TV
return true;
else
return false;
@@ -593,19 +606,23 @@ Main.playItem = function (url) { break;
case Main.eMED:
- Display.hide();
- Display.showProgress();
- Player.mFormat = Player.ePDL;
+ if (ImgViewer.isImage() == true) {
+ ImgViewer.show();
+ }
+ else {
+ Display.hide();
+ Display.showProgress();
+ Player.mFormat = Player.ePDL;
- Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
+ Main.log(" playItem: now= " + now + " start_time= " + start_time + " dur= " + duration + " (Start + Dur - now)= " + ((start_time + duration) -now));
- Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
-
- Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
- Player.playVideo(-1);
+ Display.setOlTitle(Data.getCurrentItem().childs[Main.selectedVideo].title);
- Player.guid = "unknown";
+ Player.setVideoURL( Data.getCurrentItem().childs[Main.selectedVideo].payload.link);
+ Player.playVideo(-1);
+ Player.guid = "unknown";
+ }
break;
case Main.eURLS:
Display.hide();
@@ -714,8 +731,10 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (keyCode) { // Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
// Main.logToServer(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
- switch(keyCode)
- {
+ switch(keyCode) {
+ case tvKey.KEY_TOOLS:
+ Helpbar.showHelpbar();
+ break;
case tvKey.KEY_1:
Main.log("KEY_1 pressed");
// Display.showProgress();
@@ -873,10 +892,12 @@ cPlayStateKeyHndl.prototype.handleKeyDown = function (keyCode) { case tvKey.KEY_YELLOW:
Player.nextSubtitleTrack();
break;
- case 1089:
+ case tvKey.KEY_SUB_TITLE: // (1089) BD Player Key for Green
case tvKey.KEY_3D:
case tvKey.KEY_GREEN:
Player.toggle3DEffectMode();
+ widgetAPI.blockNavigation(event);
+
break;
break;
default:
@@ -910,6 +931,10 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (keyCode) { // Main.log(this.handlerName+": Key pressed: " + Main.getKeyCode(keyCode));
switch(keyCode) {
+ case tvKey.KEY_TOOLS:
+ Helpbar.showHelpbar();
+ break;
+
case tvKey.KEY_ASPECT:
Player.toggleAspectRatio();
break;
@@ -1074,6 +1099,12 @@ cLivePlayStateKeyHndl.prototype.handleKeyDown = function (keyCode) { case tvKey.KEY_YELLOW:
Player.nextSubtitleTrack();
break;
+ case tvKey.KEY_SUB_TITLE: // BD Player Fix for Key Green (1089)
+ case tvKey.KEY_3D:
+ case tvKey.KEY_GREEN:
+ Player.toggle3DEffectMode();
+ widgetAPI.blockNavigation(event);
+ break;
default:
this.defaultKeyHandler.handleDefKeyDown(keyCode);
@@ -1095,6 +1126,10 @@ cMenuKeyHndl.prototype.handleKeyDown = function (keyCode) { // var keyCode = event.keyCode;
switch(keyCode) {
+ case tvKey.KEY_TOOLS:
+ Helpbar.showHelpbar();
+ break;
+
case tvKey.KEY_0:
if (Main.state == Main.eLIVE) {
Main.log("cMenu DirectAccess: keyCode= " + keyCode);
@@ -1157,12 +1192,18 @@ cMenuKeyHndl.prototype.handleKeyDown = function (keyCode) { break;
case tvKey.KEY_RED:
- RecCmdHandler.showMenu(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
+ if ((Main.state == Main.eLIVE) || (Main.state == Main.eREC)) {
+ RecCmdHandler.showMenu(Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
+ }
break;
case tvKey.KEY_YELLOW:
if (Main.state == Main.eURLS) {
Buttons.ynShow();
}
+ if (Main.state == Main.eMED) {
+ Main.log("Delete YE Button");
+ Buttons.ynShow();
+ }
break;
case tvKey.KEY_BLUE:
if (Main.state == Main.eREC) {
@@ -1603,11 +1644,11 @@ Main.tvKeys = { KEY_LEFT :37,
KEY_RIGHT :39,
KEY_ENTER :13,
+ KEY_RED :82,
KEY_RETURN :27,
KEY_STOP :27, // ESC
// KEY_MUTE :27,
- KEY_RED :82,
KEY_1 :49,
KEY_2 :50,
diff --git a/smarttv-client/Javascript/Network.js b/smarttv-client/Javascript/Network.js index 314dcca..23b0307 100755 --- a/smarttv-client/Javascript/Network.js +++ b/smarttv-client/Javascript/Network.js @@ -15,9 +15,6 @@ Network.init = function () { this.ownGw = this.plugin.GetGateway(nw_type);
this.ownIp = this.plugin.GetIP(nw_type);
}
- Main.log( "ownMac= " + this.ownMac);
- Main.log ("ownGw= " + this.ownGw);
- Main.log ("ownIp= " + this.ownIp);
this.isInited = true;
}
catch (e) {
diff --git a/smarttv-client/Javascript/Options.js b/smarttv-client/Javascript/Options.js index 9964a00..cf44270 100755 --- a/smarttv-client/Javascript/Options.js +++ b/smarttv-client/Javascript/Options.js @@ -59,7 +59,7 @@ Options.hide = function() { };
Options.drawServerList = function () {
- //delete all chiilds below optionsList
+ //delete all childs below optionsList
$("#optionsList").children().remove();
for (var i = 0; i < Config.vdrServers.serverUrlList.length; i++) {
@@ -182,6 +182,8 @@ Options.moveCursorRight = function() { Options.onInput = function () {
var keyCode = event.keyCode;
+ if (Config.verboseStart == true)
+ Display.showPopup("");
Main.log("Options.onInput Key= " + keyCode);
switch(keyCode) {
case tvKey.KEY_1:
@@ -385,6 +387,8 @@ Options.onInput = function () { // Done
// Options.cursorPos = Options.cursorPos +1;
// Options.deleteChar(); //
+ if (Config.verboseStart == true)
+ Display.showPopup("Options.onInput: Enter Pressed - Val= " + document.getElementById(Options.inputElm).value);
if (Options.state == Options.sSelect) {
Buttons.ynShow();
return;
@@ -398,8 +402,7 @@ Options.onInput = function () { Main.enableKeys();
Options.hide();
- Main.changeState(0);
-
+ Main.changeState(0);
Config.fetchConfig();
break;
diff --git a/smarttv-client/Javascript/Player.js b/smarttv-client/Javascript/Player.js index e6fdf59..709d367 100755 --- a/smarttv-client/Javascript/Player.js +++ b/smarttv-client/Javascript/Player.js @@ -146,7 +146,7 @@ Player.toggleAspectRatio = function () { Player.toggle3DEffectMode = function () {
Main.logToServer("Player.toggle3DEffectMode");
- if (Main.isBdPlayer() == true) {
+ if (Main.isTvSet() == false) {
if( 1 == Player.screenObj.Flag3DTVConnect() ) {
Main.logToServer("BDPlayer connected to 3D TV");
Player.setNew3DEffectMode();
diff --git a/smarttv-client/Javascript/Server.js b/smarttv-client/Javascript/Server.js index fd8959c..4213dcf 100755 --- a/smarttv-client/Javascript/Server.js +++ b/smarttv-client/Javascript/Server.js @@ -37,6 +37,7 @@ Server.fetchVideoList = function(url) { var title = $(this).find('title').text();
// var link = $(this).find('link').text();
var link = $(this).find('enclosure').attr('url');
+ var mime = $(this).find('enclosure').attr('type');
var guid = $(this).find('guid').text();
var programme = $(this).find('programme').text();
var description = $(this).find('description').text();
@@ -54,7 +55,7 @@ Server.fetchVideoList = function(url) { var title_list = title.split("~");
Data.addItem( title_list, {link : link, prog: programme, desc: description, guid : guid, start: startVal,
- dur: durVal, ispes : ispes, isnew : isnew, fps : fps, num : num});
+ dur: durVal, ispes : ispes, isnew : isnew, fps : fps, num : num, mime : mime});
}); // each
@@ -240,6 +241,7 @@ Server.getResume = function (guid) { });
};
+/*
Server.saveResume = function() {
var msg = "";
msg += "filename:" + Data.getCurrentItem().childs[Main.selectedVideo].payload.guid + "\n";
@@ -251,59 +253,7 @@ Server.saveResume = function() { };
-Server.deleteRecording = function(guid) {
- Main.log("Server.deleteRecording guid=" + guid);
- Main.logToServer("Server.deleteRecording guid=" + guid);
- Notify.handlerShowNotify("Deleting...", false);
-
- $.ajax({
- url: Config.serverUrl + "/deleteRecording.xml?id=" +guid,
- type : "POST",
- success : function(data, status, XHR ) {
- Notify.showNotify("Deleted", true);
- Data.deleteElm(Main.selectedVideo);
- if (Main.selectedVideo >= Data.getVideoCount())
- Main.selectedVideo = Data.getVideoCount() -1;
- Server.updateVdrStatus();
- Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
- Main.logToServer("Server.deleteRecording: Success" );
- },
- error : function (XHR, status, error) {
- Main.logToServer("Server.deleteRecording: Error" );
-
- // show popup
- Notify.showNotify("Error", true);
- }
- });
-};
-
-Server.deleteUrls = function (guid) {
- Main.log("Server.deleteUrls");
- Main.logToServer("Server.deleteUrls guid=" + guid);
- Notify.handlerShowNotify("Deleting...", false);
-
- $.ajax({
- url: Config.serverUrl + "/deleteYtUrl?guid=" +guid,
- type : "POST",
- success : function(data, status, XHR ) {
- Notify.showNotify("Deleted", true);
- Data.deleteElm(Main.selectedVideo);
- if (Main.selectedVideo >= Data.getVideoCount())
- Main.selectedVideo = Data.getVideoCount() -1;
- Server.updateVdrStatus();
- Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
- Main.logToServer("Server.deleteUrls: Success" );
- },
- error : function (XHR, status, error) {
- Main.logToServer("Server.deleteUrls: Error" );
- Notify.showNotify(status, true);
-
- // show popup
-// Notify.showNotify("Error", true);
- }
- });
-
-};
+*/
Server.notifyServer = function (state) {
Main.log("Server.notifyServer state="+state +"&mac=" + Network.ownMac + "&ip=" + Network.ownIp);
@@ -359,6 +309,7 @@ Server.fetchRecCmdsList = function() { });
};
+/*
Server.execRecCmd = function (cmd, guid) {
var url = Config.serverUrl + "/execreccmd?cmd="+cmd+"&guid=" + guid;
@@ -375,21 +326,96 @@ Server.execRecCmd = function (cmd, guid) { }
});
};
-
+*/
Server.getErrorText = function (status, input) {
- var errno = parseInt(input.slice(0, 3));
+// var errno_str = input.slice(0, 3);
+// var errno = parseInt(errno_str, 10);
+ var errno = Number(input.slice(0, 3));
var res = "";
+
+ Main.logToServer("Server.getErrorText status= " + status + " Errno= " + errno + " input= " + input );
switch (status) {
case 400: // Bad Request
switch (errno) {
+ case 1:
+ res = "Mandatory Line attribute not present.";
+ break;
+ case 2:
+ res= "No guid in query line";
+ break;
+ case 3:
+ res = "Entry not found. Deletion failed";
+ break;
+ case 6:
+ // set resume data
+ res = "Failed to find the recording.";
+ break;
+ case 7:
+ // get resume data
+ res = "Failed to find the recording.";
+ break;
+ case 8:
+ res = "File is new.";
+ break;
+ case 9:
+ res = "No id in query line";
+ break;
case 10:
- res = "No Timer found.";
+ res = "No Timer found.";
+ break;
+
+ case 15:
+ res = "Mandatory cmd attribute not present.";
+ break;
+ case 16:
+ res = "Command (cmd) value out of range.";
+ break;
+ case 17:
+ res = "Execreccmd disabled.";
+ break;
+ case 18:
+ res = "No such file or directory.";
+ break;
+ case 19:
+ res = "Permission Denied.";
+ break;
+ case 20:
+ res = "Is a directory.";
+ break;
+ case 21:
+ res = "Deletion failed (for some reason).";
+ break;
+
+ default:
+ res = "Unhandled Errno - Status= " + status + " Errno= "+ errno;
+ break;
+ }
+ break;
+ case 404: // File not found
+ switch (errno) {
+ case 1:
+ res = "Recording not found. Deletion failed.";
+ break;
+ case 2:
+ res = "Media Folder likely not configured.";
+ break;
+ case 3:
+ res = "File not found.";
+ break;
+ default:
+ res = "Unhandled Errno - Status= " + status + " Errno= "+ errno;
+ break;
+ };
+ case 500: // Internal Server Error
+ switch (errno) {
+ case 6:
+ res = "deletion failed!";
break;
default:
res = "Unhandled Errno - Status= " + status + " Errno= "+ errno;
break;
- }
+ };
break;
case 503: // Service unavailable
switch (errno) {
@@ -408,33 +434,425 @@ Server.getErrorText = function (status, input) { return res;
};
-var HeartbeatHandler = {
- timeoutObj : null,
- isActive : false
+Server.deleteRecording = function(guid) {
+ var obj = new execRestCmd(RestCmds.CMD_DelRec, guid);
+
+ /*
+
+ Main.log("Server.deleteRecording guid=" + guid);
+ Main.logToServer("Server.deleteRecording guid=" + guid);
+ Notify.handlerShowNotify("Deleting...", false);
+
+ $.ajax({
+ url: Config.serverUrl + "/deleteRecording.xml?id=" +guid,
+ type : "POST",
+ success : function(data, status, XHR ) {
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteRecording: Success" );
+ },
+ error : function (XHR, status, error) {
+ Main.logToServer("Server.deleteRecording: Error" );
+
+ // show popup
+ Notify.showNotify("Error", true);
+ }
+ });
+ */
};
-HeartbeatHandler.start = function(){
- if (this.isActive ==true)
- window.clearTimeout(this.timeoutObj);
-
- this.isActive = true;
- HeartbeatHandler.update();
+Server.deleteUrls = function (guid) {
+
+ var obj = new execRestCmd(RestCmds.CMD_DelYtUrl, guid);
+
+/*
+ Main.log("Server.deleteUrls");
+ Main.logToServer("Server.deleteUrls guid=" + guid);
+ Notify.handlerShowNotify("Deleting...", false);
+
+ $.ajax({
+ url: Config.serverUrl + "/deleteYtUrl?guid=" +guid,
+ type : "POST",
+ success : function(data, status, XHR ) {
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteUrls: Success" );
+ },
+ error : function (XHR, status, error) {
+ Main.logToServer("Server.deleteUrls: Error" );
+ Notify.showNotify(status, true);
+
+ // show popup
+// Notify.showNotify("Error", true);
+ }
+ });
+*/
};
-HeartbeatHandler.update = function() {
- Server.notifyServer("running");
- this.timeoutObj = window.setTimeout(function() {HeartbeatHandler.update(); }, (60*1000)); // once every 1min
+
+Server.getResume = function (guid) {
+ Main.log ("***** getResume *****");
+ var obj = new execRestCmd(RestCmds.CMD_GetResume, guid);
+/*
+ $.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 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;
+ Player.playVideo( resume_val);
+ }
+ else {
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ }
+
+ },
+ error : function (jqXHR, status, error) {
+ Main.log("**** Resome Error Response - status= " + status + " error= "+ error);
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ }
+ });
+ */
};
-HeartbeatHandler.stop = function(){
- if (this.isActive == false )
- return;
+Server.saveResume = function() {
+ var obj = new execRestCmd(RestCmds.CMD_SetResume, Data.getCurrentItem().childs[Main.selectedVideo].payload.guid);
+/*
+ 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");
+*/
+};
- window.clearTimeout(this.timeoutObj);
- this.isActive = false;
+Server.execRecCmd = function (cmd, guid) {
+ var obj = new execRestCmd(RestCmds.CMD_ExecRecCmd, guid, { cmd:cmd });
+
+};
+
+Server.deleteMedFile = function(guid) {
+ var obj = new execRestCmd(RestCmds.CMD_DelMedFile, guid);
+};
+
+var RestCmds = {
+ CMD_AddTimer : 0,
+ CMD_DelMedFile : 1,
+ CMD_DelYtUrl : 2,
+ CMD_DelRec : 3,
+ CMD_SetResume : 4,
+ CMD_GetResume : 5,
+ CMD_GetRecCmds : 6,
+ CMD_ExecRecCmd : 7,
+ CMD_ActTimer : 8,
+ CMD_DelTimer : 9
};
+
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+//----------------- execRestCmd --------------------------------------
+//--------------------------------------------------------------------
+//--------------------------------------------------------------------
+function execRestCmd(cmd, guid, parms) {
+ this.successCallback = null;
+ this.errorCallback = null;
+ this.guid = guid;
+ this.parms = parms;
+
+ this.url = "";
+ this.cmd = -1;
+ this.method = "";
+
+ switch(cmd) {
+ case RestCmds.CMD_AddTimer:
+ // add a timer
+
+ this.url =Config.serverUrl + "/addTimer.xml?guid="+this.guid;
+ this.cmd = cmd;
+ this.method = "GET";
+
+ this.successCallback = function(data, status, XHR ) {
+ Notify.showNotify("Timer added", true);
+ Main.log ("addTimer for Inst= " + this.guid +" status: " + ((status != null) ? status : "null"));
+ };
+ break;
+ case RestCmds.CMD_DelMedFile:
+ // delete a file from media folder
+
+ Main.log("Server.deleteMedFile guid=" + guid);
+ Main.logToServer("Server.deleteMedFile guid=" + guid);
+
+ this.url =Config.serverUrl + "/deleteFile?guid=" +guid;
+ this.cmd = cmd;
+ this.method = "GET";
+
+ this.successCallback = function(data, status, XHR ) {
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ };
+ break;
+ case RestCmds.CMD_DelYtUrl:
+ // delete a YouTube URL
+
+ Main.log("Server.deleteUrls");
+ Main.logToServer("Server.deleteUrls guid=" + guid);
+ Notify.handlerShowNotify("Deleting...", false);
+
+ this.url =Config.serverUrl + "/deleteYtUrl?guid=" +guid;
+ this.cmd = cmd;
+ this.method = "POST";
+
+ this.successCallback = function(data, status, XHR ) {
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteUrls: Success" );
+
+ };
+ break;
+ case RestCmds.CMD_DelRec:
+ // Delete a Recording
+
+ Main.log("Server.deleteRecording guid=" + guid);
+ Main.logToServer("Server.deleteRecording guid=" + guid);
+ Notify.handlerShowNotify("Deleting...", false);
+
+ this.url =Config.serverUrl + "/deleteRecording.xml?id=" +guid;
+ this.cmd = cmd;
+ this.method = "POST";
+
+ this.successCallback = function(data, status, XHR ) {
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteRecording: Success" );
+ };
+
+ break;
+
+ case RestCmds.CMD_SetResume :
+ // Send Resume Data
+
+ Main.log("Server.GetResume guid=" + guid);
+ Main.logToServer("Server.GetResume guid=" + guid);
+ this.url =Config.serverUrl + "/setResume.xml?guid=" +guid + "&resume=" + (Player.curPlayTime/1000);
+ this.cmd = cmd;
+ this.method = "POST";
+ this.successCallback = function(data, status, XHR ) {
+ Main.logToServer("SaveResume Status= " + XHR.status );
+ };
+
+ break;
+ case RestCmds.CMD_GetResume :
+ // Request Resume Data from VDR
+
+ Main.log("Server.GetResume guid=" + guid);
+ Main.logToServer("Server.GetResume guid=" + guid);
+
+ this.url =Config.serverUrl + "/getResume.xml?guid=" +guid;
+ this.cmd = cmd;
+ this.method = "POST";
+
+ this.successCallback = function(data, status, XHR ) {
+ Main.log("**** Resome Success Response - status= " + status + " mime= " + XHR.responseType + " data= "+ data);
+
+ 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;
+ Player.playVideo( resume_val);
+ }
+ else {
+ Main.logToServer("ERROR: No resume data in response " );
+
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ }
+ };
+
+ this.errorCallback = function() {
+ Display.hide();
+ Display.showProgress();
+ Player.playVideo(-1);
+ };
+
+
+ break;
+
+ case RestCmds.CMD_ExecRecCmd :
+ // Execute a recording command
+
+ Main.logToServer("Server.execRecCmd cmd="+parms.cmd+" guid=" + guid );
+
+ this.url = Config.serverUrl + "/execreccmd?cmd="+parms.cmd+"&guid=" + guid;
+ this.cmd = cmd;
+ this.method = "GET";
+
+ this.successCallback = function(data, status, XHR ) {
+ Main.logToServer("Server.execRecCmd OK" ) ;
+ Display.handleDescription(Main.selectedVideo);
+ };
+ break;
+
+ case RestCmds.CMD_ActTimer :
+ // Activate or Deactivate a timer
+
+ Main.logToServer("Server.ActTimer index=" + guid + " setActive= " + ((parms.setActive == true) ? "true" : "false" ));
+
+ this.url = Config.serverUrl + "/activateTimer?index=" +guid + "&activate=" + ((parms.setActive == true) ? "true" : "false"),
+ this.cmd = cmd;
+ this.method = "GET";
+
+ this.successCallback = function(data, status, XHR ) {
+ Main.logToServer("Timers.activateTimer: Success" );
+ Main.log("Timers.activateTimer: Success" );
+
+ Timers.resetView();
+ };
+ break;
+
+ case RestCmds.CMD_DelTimer :
+ // Delete a timer
+
+ Main.logToServer("Server.DelTimer index=" + guid );
+
+ this.url = Config.serverUrl + "/deleteTimer?index=" +guid,
+ this.cmd = cmd;
+ this.method = "GET";
+
+ this.successCallback = function(data, status, XHR ) {
+ Main.logToServer("Timers.deleteTimer: Success" );
+ Main.log("Timers.deleteTimer: Success" );
+
+ Timers.resetView();
+ // remove index from database
+ };
+ break;
+
+ default:
+ Main.log("execRestCmd - ERROR: CMD= " + cmd + " is not supported");
+ Main.logToServer("execRestCmd - ERROR: CMD= " + cmd + " is not supported");
+ break;
+ };
+
+ if (this.cmd > 0)
+ this.request();
+ else {
+ Main.logToServer("execRestCmd - CMD (" + cmd + ") Not found");
+ }
+
+};
+
+execRestCmd.prototype.request = function () {
+ Main.log("execRestCmd request url= " + this.url);
+
+ $.ajax({
+ url: this.url,
+ type : this.method,
+ context : this,
+ timeout : 500,
+ success : this.successCallback,
+/* function(data, status, XHR ) {
+ if (this.successCallback != null)
+ this.successCallback();
+ switch (this.cmd) {
+ case RestCmds.CMD_AddTimer:
+ Notify.showNotify("Timer added", true);
+ Main.log ("addTimer for Inst= " + this.guid +" status: " + ((status != null) ? status : "null"));
+ break;
+
+ case RestCmds.CMD_DelMedFile:
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+
+ break;
+
+ case RestCmds.CMD_DelYtUrl:
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteUrls: Success" );
+ break;
+
+ case RestCmds.CMD_DelRec:
+ Notify.showNotify("Deleted", true);
+ Data.deleteElm(Main.selectedVideo);
+ if (Main.selectedVideo >= Data.getVideoCount())
+ Main.selectedVideo = Data.getVideoCount() -1;
+ Server.updateVdrStatus();
+ Display.setVideoList(Main.selectedVideo, (Main.selectedVideo - Display.currentWindow));
+ Main.logToServer("Server.deleteRecording: Success" );
+
+ break;
+
+ default:
+ Main.logToServer("execRestCmd - Success for cmd= " + this.cmd);
+ };
+ },*/
+ error : function (XHR, status, error) {
+
+ Main.logToServer("ERROR received for guid= " + this.guid + " status= " + status);
+ if (status == "timeout") {
+ Notify.showNotify( "Timeout.", true);
+
+ }
+ else {
+ Main.log("ERROR= " + XHR.status + " text= " + XHR.responseText);
+ var res = Server.getErrorText(XHR.status, XHR.responseText);
+ Main.log ("execRestCmd for Error Inst= " + this.guid+ " res= " + res);
+ Notify.showNotify( res, true);
+
+ if (this.errorCallback != null)
+ this.errorCallback();
+
+ }
+
+ }
+ });
+
+};
+
+
+
function addTimer(guid) {
this.successCallback = null;
this.errorCallback = null;
@@ -468,4 +886,31 @@ addTimer.prototype.request = function () { };
+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;
+};
+
diff --git a/smarttv-client/Javascript/Timers.js b/smarttv-client/Javascript/Timers.js index 29db55c..c00e9e7 100644 --- a/smarttv-client/Javascript/Timers.js +++ b/smarttv-client/Javascript/Timers.js @@ -1,8 +1,11 @@ var Timers = {
timerList : [],
scrollDur : 300,
- scrollFlip : 100
-
+ scrollFlip : 100,
+ btnMode : 0
+ // 0 nothing
+ // 1: delete
+ // 2:
};
Timers.init = function() {
@@ -86,7 +89,7 @@ Timers.readTimers = function () { Main.log ("Timers: Got response");
$(data).find("timer").each(function () {
var title = $(this).find('file').text();
- var isSingleEvent = ($(data).find('issingleevent').text() == "true") ? true : false;
+ var isSingleEvent = ($(this).find('issingleevent').text() == "true") ? true : false;
var printday = $(this).find('printday').text();
var weekdays = parseInt($(this).find('weekdays').text());
@@ -119,12 +122,22 @@ Timers.createMenu= function () { var p_width = $("body").outerWidth();
var p_height = $("body").outerHeight();
- var table = $("<div>", {id : "timerTable", style :"overflow-y: scroll;margin-top:3px;margin-bottom:3px;height:100%;"});
+ var table = $("<div>", {id : "timerTable", style :"overflow-y: scroll;margin-top:3px;margin-bottom:3px; padding-right:3px; height:100%;"});
$("#timerView").append(table);
$("#timerScreen").show();
+ var cur_date = 0;
for (var i = 0; i < Timers.timerList.length; i++) {
Main.log("Timers: " + Timers.timerList[i].title);
+
+ if (Timers.timerList[i].isSingleEvent == false) {
+ cur_date = 0;
+ table.append( $("<div>", { text : ((Timers.timerList[i].day != 0) ? (Timers.getPrintDate(Timers.timerList[i].day) + " - ") : "") +Timers.getWeekdays(Timers.timerList[i].weekdays), class : "style_menuItem style_headline", style : "text-align:left;overflow-x: hidden;white-space : nowrap;"}));
+
+ }else if (cur_date != Timers.timerList[i].day) {
+ cur_date = Timers.timerList[i].day;
+ table.append( $("<div>", { text : Timers.getPrintDate(Timers.timerList[i].day) , class : "style_menuItem style_headline", style : "text-align:left;overflow-x: hidden;white-space : nowrap;"}));
+ }
table.append(Timers.createEntry(i, $("#timerTable").width()));
}
@@ -134,17 +147,44 @@ Timers.createMenu= function () { };
+Timers.getPrintDate = function (day) {
+ var d = new Date (day * 1000);
+ return d.getDate() + "." + (d.getMonth() +1) + "." + d.getFullYear();
+};
+
+Timers.getWeekdays = function (wd) {
+ var map = wd.toString(2);
+ var res = "";
+
+ res += ((map[0] == "1") ? "M" : "-");
+ res += ((map[1] == "1") ? "D" : "-");
+ res += ((map[2] == "1") ? "M" : "-");
+ res += ((map[3] == "1") ? "D" : "-");
+ res += ((map[4] == "1") ? "F" : "-");
+ res += ((map[5] == "1") ? "S" : "-");
+ res += ((map[6] == "1") ? "S" : "-");
+
+ return res;
+};
+
Timers.createEntry= function (i, w) {
Main.log("width= " +w);
+
var row = $("<div>", {id: "tmr-"+i, class : "style_menuItem", style : "text-align:left;overflow-x: hidden;white-space : nowrap;"}); //, style : "text-overflow: ellipsis;white-space : nowrap;"
// row.append($("<div>", {class : ((Timers.timerList[i].isrec ==true) ? "style_timerRec" : ""), style : "display: inline-block;"}));
- row.append($("<div>", {class : ((Timers.timerList[i].isrec ==true) ? "style_timerRec" : "style_timerNone"), style : "display: inline-block;"})); //
+
+
+ row.append($("<div>", {class : ((Timers.timerList[i].isrec ==true) ? "style_timerRec" : ((Timers.timerList[i].flags & 1) != 0) ? "style_timerAct" : "style_timerNone"), style : "display: inline-block;"}));
+
+ if ( Timers.timerList[i].isSingleEvent == true) {
+ }
+ else {
+ }
row.append($("<div>", {text : Timers.timerList[i].channelname, style : "padding-left:5px;width:12%; display: inline-block;", class : "style_overflow"}));
row.append($("<div>", {text : Timers.timerList[i].start, style : "padding-left:5px; width:9%; display: inline-block;", class : "style_overflow"}));
row.append($("<div>", {text : Timers.timerList[i].stop, style : "padding-left:5px; width:9%; display: inline-block;", class : "style_overflow"}));
row.append($("<div>", {text : Timers.timerList[i].title, style : "padding-left:5px; width:68%;display: inline-block;", class : "style_overflow"}));
-
return row;
};
@@ -165,14 +205,16 @@ Timers.resetView = function () { };
-Timers.deleteTimer = function () {
+Timers.timerCallback = function () {
// delete the current timer
Main.log("****** Delete Timer: " + Timers.timerList[this.btnSelected].title);
- var del_req = new DeleteTimerReq (Timers.timerList[this.btnSelected].index);
-// var del_req = new DeleteTimerReq (10);
+// var del_req = new DeleteTimerReq (Timers.timerList[this.btnSelected].index);
+
+ var obj = new execRestCmd(RestCmds.CMD_DelTimer, Timers.timerList[this.btnSelected].index);
+ // var del_req = new DeleteTimerReq (10);
+};
-}
Timers.selectBtnUp = function () {
var btnname = "#tmr-"+this.btnSelected;
@@ -237,6 +279,46 @@ Timers.onInput = function () { // Timers.hide();
break;
+ case tvKey.KEY_YELLOW:
+
+ Timers.timerCallback = function () {
+ // delete the current timer
+ Main.log("Timers.timerCallback: " + Timers.timerList[this.btnSelected].title);
+ var obj = new execRestCmd(RestCmds.CMD_DelTimer, Timers.timerList[this.btnSelected].index);
+ // var del_req = new DeleteTimerReq (10);
+ };
+
+ Buttons.ynShow();
+// Timers.hide();
+
+ break;
+ case tvKey.KEY_RED:
+ if ((Timers.timerList[this.btnSelected].flags & 1) != 0) {
+ // Timer is currently active
+ Buttons.ynHeadlineText ("Deactivate Timer ?");
+ Timers.timerCallback = function () {
+ Main.log("Timers.timerCallback Deactivate Timer: " + Timers.timerList[this.btnSelected].title);
+ var obj = new execRestCmd(RestCmds.CMD_ActTimer, Timers.timerList[this.btnSelected].index, {setActive : false});
+ };
+
+ }
+ else {
+ // Timer is currently deactive
+ Buttons.ynHeadlineText ("Activate Timer ?");
+ Timers.timerCallback = function () {
+ Main.log("Timers.timerCallback Activate Timer: " + Timers.timerList[this.btnSelected].title);
+ var obj = new execRestCmd(RestCmds.CMD_ActTimer, Timers.timerList[this.btnSelected].index, {setActive : true});
+ };
+ }
+
+ Buttons.ynShow();
+// Timers.hide();
+
+ break;
+ case tvKey.KEY_TOOLS:
+ Helpbar.showHelpbar();
+ break;
+
case tvKey.KEY_RETURN:
case tvKey.KEY_EXIT:
Timers.hide();
@@ -254,7 +336,7 @@ Timers.onInput = function () { };
-
+/*
function DeleteTimerReq (idx) {
this.index = idx;
this.exec();
@@ -287,3 +369,4 @@ DeleteTimerReq.prototype.exec = function () { });
};
+*/
\ No newline at end of file diff --git a/smarttv-client/config.xml b/smarttv-client/config.xml index 85c7537..6f34c49 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.95.0827</ver>
+ <ver>0.95.0914</ver>
<mgrver></mgrver>
<fullwidget>y</fullwidget>
<movie>y</movie>
diff --git a/smarttv-client/index.html b/smarttv-client/index.html index 8575cd8..6760353 100755 --- a/smarttv-client/index.html +++ b/smarttv-client/index.html @@ -41,6 +41,7 @@ <script language="javascript" type="text/javascript" src="Javascript/Comm.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/OverlayMenu.js"></script>
<script language="javascript" type="text/javascript" src="Javascript/SelectScreen.js"></script>
+ <script language="javascript" type="text/javascript" src="Javascript/ImgViewer.js"></script>
<!-- Style sheets -->
<link rel="stylesheet" href="CSS/Main.css" type="text/css">
@@ -212,9 +213,13 @@ </div>
<div id="timerScreen">
<a href='javascript:void(0);' id='timerScreen-anchor'></a>
+ <div id="timerView"></div>
+ </div>
- <div id="timerView"></div>
- </div>
-
+ <div id="imageViewer">
+ <a href='javascript:void(0);' id='iv-anchor'></a>
+ <img id="ivImage"></div>
+ <div id="ivOverlay"></div>
+ </div>
</body>
</html>
|