From 80ca2d8916bfb689f00e274a95004a781b2c65b8 Mon Sep 17 00:00:00 2001 From: "M. Voerman" Date: Thu, 17 Jan 2013 23:05:34 +0100 Subject: Added function to view Timers on the server --- History | 3 ++ index.html | 145 ++++++++++++++++++++++++++++++++++++++++++++++++++---------- settings.js | 10 +++++ 3 files changed, 134 insertions(+), 24 deletions(-) diff --git a/History b/History index f2b5a5d..d712de0 100644 --- a/History +++ b/History @@ -6,6 +6,9 @@ Standby now stops the stream, getting back from standby reconnects to server & sets display Added initial support for MPD -> client plays stream from MPD-httpd Recordings Menu now show maps. + Use of restfulapi + Read Timers from Server + Delete recording // if you want to Delete a recording, change in restfulapi/recordings.ccp line 46 DELETE by POST 0.10 Added sub Listinges for use as Radio list / Protected List / SD/HD list etc (Use for Multicast Channels keyword MultiCast in Serveradres) diff --git a/index.html b/index.html index f4b53af..7e4f467 100644 --- a/index.html +++ b/index.html @@ -595,6 +595,8 @@ function onKeyDown(event) { case "Menu": if(isFullscreen) { + osdepginfo.style.opacity = 0; + osdepginfonext.style.opacity = 0; isSetupMenu = 1; mainmenu.style.opacity = 0.8; menu = 0; @@ -1465,21 +1467,23 @@ function onKeyMenu(keyCode) { if (menu == 2) { timerID = timerID - 1; var x = toi.schedulerService.getBookingIds("*", 0, 0); - if (timerID < x[0]) { - timerID = x[0]; - } - InitMenu(menu); + if (timerID < x[0]) { timerID = x[0]; } + } else if (menu == 5) { + timerID = timerID - 1; + if (timerID < 0) { timerID = 0; } } + InitMenu(menu); break; case "Down": if (menu == 2) { timerID = timerID + 1; var x = toi.schedulerService.getBookingIds("*", 0, 0); - if (timerID > x[x.length-1] ) { - timerID = x[x.length-1]; - } - InitMenu(menu); + if (timerID > x[x.length-1] ) { timerID = x[x.length-1]; } + } else if (menu == 5) { + timerID = timerID + 1; + if (timerID > (maxTimers - 1) ) { timerID = maxTimers - 1; } } + InitMenu(menu); break; case "Accept": if (menu == 2) { @@ -1491,6 +1495,10 @@ function onKeyMenu(keyCode) { setOSDtimer(); InitMenu(menu); } + } else if (menu == 5) { + timersFlag[timerID] = 1 - timersFlag[timerID]; + SwitchActiveTimers(); + InitMenu(menu); } break; case "Red": @@ -1561,7 +1569,12 @@ function onKeyMenu(keyCode) { InitMenu(menu); break; case KEY_4: - if (menu == 1) { + if (menu == 0) { + mainmenu.innerHTML = "

Timers

\n\n\n
PLEASE WAIT
"; + timerID = 0; + menu = 5; + setTimeout("LoadTimersServer();InitMenu(menu);",100); + } else if (menu == 1) { audiotype = audiotype + 1; is = toi.informationService; if(audiotype == 1) { @@ -1572,8 +1585,8 @@ function onKeyMenu(keyCode) { is.setObject("cfg.media.audio.typepriority","visually_impaired",is.STORAGE_VOLATILE); audiotype = 0; } + InitMenu(menu); } - InitMenu(menu); break; case KEY_5: if (menu == 1) { @@ -1669,7 +1682,7 @@ function onKeyMenu(keyCode) { function InitMenu(menu) { if(menu == 0) { // Main Menu - mainmenu.innerHTML = "

MainMenu \n ( " + Version + " )

   1 - SettingsMenu \n   2 - Recordings \n   3 - TimersMenu\n\n\n\n\n\n   9 - MPD Server Connection\n\n   BLUE - Restart Portal 
"; + mainmenu.innerHTML = "

MainMenu \n ( " + Version + " )

   1 - Settings \n   2 - Recordings \n   3 - Timers\n   4 - Timers from Server\n\n\n\n\n   9 - MPD Server Connection\n\n   BLUE - Restart Portal 
"; } if(menu == 1) { // settings menu @@ -1741,6 +1754,20 @@ if(menu == 4) { // INFO Menu } +if(menu == 5) { // Timers from Server + if (timerOK) { + booking = ""; + var x = timerID - 1; + for (var i=0;i<10;i++) { + if (timer.length !== 0) { do { x = x + 1; } while (!timer[x] && (x < timer.length)) } + if (timer.length > x) { booking = booking + timer[x]; } else { booking = booking +"\n"; } + if (i == 0) { booking = booking + ""; } + } + + mainmenu.innerHTML = "

Timers

\n" + booking + "
"; + } +} + } // end of initmenu @@ -1749,7 +1776,7 @@ function LoadTimers() { var x = toi.schedulerService.getBookingIds("*", 0, 0); for (var i=0;i Timers
\n ERROR Getting Timers from : \n " + RestFulAPI + "
"; + } +} // End of Menu section @@ -1846,6 +1930,8 @@ if (DelisOK) { switch(keyCode) { case "Accept": DelRec2(); + getRecList(); + showMediaList(); default: switchtimer.style.opacity = 0; DelisOK = 0; @@ -1854,11 +1940,12 @@ if (DelisOK) { } else { switch(keyCode) { case "BrowserBack": - if (mediaList.style.opacity == 0) { + if (mediaList.style.opacity !== 0 && osdepginfo.style.opacity == 1) { osdepginfo.style.opacity = 0; break; } + if (mediaList.style.opacity == 0) { ShowInfo(); osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; break; - } + } case "TV": if (mediaList.style.opacity == 0) { play(channels[currChan]);} UnloadMediaSettings(); @@ -1955,6 +2042,16 @@ if (DelisOK) { audio = 0; } break; + case "Yellow": + if (mediaList.style.opacity != 0) { + } + case "Blue": + ShowInfo(); + osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; + break; + case "Menu": + break; + case KEY_REC: case "MediaRecord": recordStart(recLink[currMed]); @@ -2109,9 +2206,9 @@ try { function DelRec2() { try { xmlhttp=new XMLHttpRequest(); - xmlhttp.open("DELETE",(RestFulAPI + "/recordings/" + currMed ),false); + xmlhttp.open("POST",(RestFulAPI + "/recordings/" + currMed ),false); xmlhttp.send(); - alert(xmlhttp.responseText); + recList[currMed] = ""; } catch(e) { alert("Delete Recordings problem: " + e); } @@ -2167,6 +2264,7 @@ function showMediaList() { htmlstring = htmlstring + "\uE003\uE003" + Left(recList[listMed],60) + ""; } mediaList.innerHTML = htmlstring + ""; + ShowInfo(); } @@ -2295,7 +2393,7 @@ function ShowInfo() { result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m; - osdepginfo.innerHTML = "
" + Left(recTitl[currMed],60) + "\n Date : " + result + "\n Length : " + (recDura[currMed] / 60).toFixed(0) + " Minutes \n

" + recDesc[currMed] + "

"; + osdepginfo.innerHTML = "
" + Left(recTitl[currMed],60) + "\n " + result + "\n " + (recDura[currMed] / 60).toFixed(0) + " Minutes \n

" + Left(recDesc[currMed],750) + "

"; } @@ -2384,7 +2482,7 @@ function onScheduledStop(event) {
Volume :
-
+
@@ -2393,18 +2491,17 @@ function onScheduledStop(event) {
-
-
- -
+ +
- +
+
diff --git a/settings.js b/settings.js index cb719a7..760009c 100644 --- a/settings.js +++ b/settings.js @@ -216,6 +216,16 @@ var recStrt = new Array(); var recList = new Array(); var recMap = 0; +var timersID = new Array(); +var timersFlag = new Array(); +var timersStrt = new Array(); +var timersStop = new Array(); +var timersDays = new Array(); +var timersName = new Array(); +var timersFile = new Array(); +var maxTimers = 0; +var timerOK = 0; + var getRecOK = 0; var position = 0; -- cgit v1.2.3