summaryrefslogtreecommitdiff
path: root/index.html
diff options
context:
space:
mode:
authorM. Voerman <rekordc@gmail.com>2012-12-19 01:30:56 +0100
committerM. Voerman <rekordc@gmail.com>2012-12-19 01:30:56 +0100
commitbbdb260084ac88f3e944671249ab528fd2e252c4 (patch)
treece9a24a86c139a3c32257d7a583a10b585da354e /index.html
parent020fe0a4d0613a7f34b1af30508334c50fa323a3 (diff)
downloadvdr-vipclient-bbdb260084ac88f3e944671249ab528fd2e252c4.tar.gz
vdr-vipclient-bbdb260084ac88f3e944671249ab528fd2e252c4.tar.bz2
changed map to merge into master
Diffstat (limited to 'index.html')
-rw-r--r--index.html1436
1 files changed, 1436 insertions, 0 deletions
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..055c9f2
--- /dev/null
+++ b/index.html
@@ -0,0 +1,1436 @@
+<html>
+ <head>
+ <script type="text/javascript" src="settings.js" />
+ <script type="text/javascript" src="settings2.js" />
+ <script type="text/javascript" src="channels.js" />
+ <script type="text/javascript" src="recordings.js" />
+ </head>
+<script language="Javascript">
+
+//
+// Javascript VDR client for Motorola VIP19x0 & VIP19x3
+//
+// Martin Voerman Rekordc@gmail.com
+//
+// TODO
+//
+// Sound mapping for AC3
+// auto epg switch language for EIT Cache
+//
+// make VDR connection
+// get/set/create/edit timers
+// make/view recordings
+//
+// Mainmenu
+// set/save changes to cfg.custom.xxx
+// change IP server
+//
+
+var Version = "0.04 2012/12/xx"
+var nrChannels = channels.length;
+var nrMedia = recording.length - 1;
+
+window.onkeydown = onKeyDown;
+
+function onLoad() {
+ createPlayer();
+ embedTeletextPlugin();
+ toi.audioOutputService.setVolume(AudioOut, StartVolume);
+ toi.audioOutputService.setMuteState(AudioOut, false);
+ showDisplay((currChan.toString()), false, 100, 0 );
+ play(channels[currChan]);
+ eitCache = toi.dvbEitService.createInstance();
+ eitCache.setFilterMode(eitCache.FILTER_MODE_PF_AND_SCHEDULE);
+// eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY);
+ eitCache.addEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated);
+ showOSD();
+}
+
+
+function onUnload() {
+ try {
+ mediaPlayer.close();
+ mediaPlayer.releaseInstance();
+ } catch(e) {
+ alert(e);
+ }
+}
+
+function incChan(step) {
+ currChan = currChan + step;
+ if (currChan == nrChannels) {
+ currChan = 1;
+ }
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(currChan);
+}
+
+function decChan(step) {
+ currChan = currChan - step;
+ if (currChan == 0) {
+ currChan = nrChannels - 1;
+ }
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(currChan);
+}
+
+function createPlayer() {
+ try {
+ mediaPlayer = toi.mediaService.createPlayerInstance();
+ } catch(e) {
+ alert("Failed creating player: " + e);
+ }
+}
+
+function play(uri) {
+ try {
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ mediaPlayer.close();
+ }
+ uri = ServerAdres + uri;
+ mediaPlayer.open(uri);
+ mediaPlayer.play(1000);
+ if(isFullscreen) {
+ showOSD();
+ }
+ showDisplay((currChan.toString()), false, 100, 0 );
+ GetEPG(currChan);
+ } catch (e) {
+ alert("Failed opening stream: " + e);
+ return;
+ }
+}
+
+function preview(urip) {
+ if(SwitchGuide) {
+ play(urip);
+ }
+ showChannelList();
+ if (isSchedule) {
+ GetSchedule(currChan,10);
+ }
+}
+
+
+function FullScreen() {
+ videoplane.style.width = "100%";
+ videoplane.style.height = "100%";
+ videoplane.style.left = "0px";
+ videoplane.style.top = "0px";
+}
+
+
+function onKeyDown(event) {
+ if(isVisible) {
+ onKeyTeletext(event.keyIdentifier);
+ } else if(isMediaMenu) {
+ onKeyMedia(event.keyIdentifier);
+ } else if(isSetupMenu) {
+ onKeyMenu(event.keyIdentifier);
+ } else {
+
+ switch(event.keyIdentifier) {
+ case "Up":
+ if(isFullscreen) {
+ count = 0;
+ prevChan = currChan;
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ play(channels[currChan]);
+ } else {
+ // swap up <> down in guide mode
+ count = 0;
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ preview(channels[currChan]);
+ }
+ break;
+ case "Down":
+ if(isFullscreen) {
+ count = 0;
+ prevChan = currChan;
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ play(channels[currChan]);
+ } else {
+ // swap up <> down in guide mode
+ count = 0;
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ preview(channels[currChan]);
+ }
+ break;
+ case "Left":
+ count = 0;
+ prevChan = currChan;
+ if (currChan > 9) {
+ decChan(9);
+ } else {
+ currChan = nrChannels - currChan;
+ }
+ do
+ {
+ decChan(1);
+ }
+ while (!channels[currChan]);
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ break;
+ case "Right":
+ count = 0;
+ prevChan = currChan;
+ if (currChan < (nrChannels - 9 )) {
+ incChan(9);
+ } else {
+ currChan = nrChannels - currChan;
+ }
+ do
+ {
+ incChan(1);
+ }
+ while (!channels[currChan]);
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ break;
+ case "Red":
+ if(isFullscreen) {
+ if(showClock == 0 ) {
+ showDisplay("", true, 80, 1 );
+ showClock = 1;
+ } else if(showClock == 1 ) {
+ showClock = 0;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ } else {
+ if(NowNext) {
+ settimer();
+ switchtimer.style.opacity = 1;
+ setTimeout("switchtimer.style.opacity = 0; ", 2000);
+// } else {
+// switchtimer.innerHTML = "<font color=black size=4><center> Program is running use OK to switch </center></font>";
+// switchtimer.style.opacity = 1;
+// setTimeout("switchtimer.style.opacity = 0; ", 2000);
+ }
+ }
+ break;
+ case "Green":
+ if(isFullscreen) {
+ if(!epgactive) {
+ audio = audio + 1;
+ is = toi.informationService;
+ if(audio == 1) {
+ is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>Nederlands</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ } else if(audio == 2) {
+ is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>Deutsch</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ } else if(audio == 3) {
+ is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>English</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ audio = 0;
+ }
+ } else {
+ osdepginfo.style.opacity = 1 - osdepginfo.style.opacity ;
+ osdepginfonext.style.opacity = 1 - osdepginfo.style.opacity;
+ }
+ } else {
+ colorkeys.innerHTML = "<font color=red size=3>" + NN[3 + NowNext] + "</font><font color=green size=3>" + NN[NowNext] + "</font><font color=yellow size=3> Schedule </font><font color=blue size=3> INFO </font>";
+ NowNext = 1 - NowNext;
+ showChannelList();
+ }
+
+ break;
+ case "Yellow":
+ if(isFullscreen) {
+ if(!epgactive) {
+ if(!isSchedule) {
+ schedule.style.zIndex = 505;
+ schedule.style.opacity = 1;
+ schedule.style.height = "75%";
+ GetSchedule(currChan,15);
+ isSchedule = 1;
+ } else {
+ isSchedule = 0;
+ schedule.style.zIndex = 450;
+ schedule.style.opacity = 0;
+ schedule.style.height = "45%";
+ }
+// setTimeout("schedule.style.opacity = 0;schedule.style.height = '45%';schedule.style.zIndex = 450;", 3000);
+ }
+ } else {
+ GetSchedule(currChan,10);
+ schedule.style.opacity = 1 - schedule.style.opacity;
+ channelList.style.opacity = 1 - schedule.style.opacity;
+ schedkeys.style.opacity = schedule.style.opacity;
+ colorkeys.style.opacity = 1 - schedule.style.opacity;
+ isSchedule = schedule.style.opacity;
+ }
+ break;
+ case "Blue":
+ if(isFullscreen) {
+ RestartPortal();
+ } else {
+ SetOsdInfo();
+ osdepginfo.style.opacity = 1 - NowNext;
+ osdepginfonext.style.opacity = NowNext;
+ setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000);
+ }
+ break;
+ case "BrowserBack":
+ if(count) {
+ count = 0;
+ osdnr.style.opacity = 0;
+ if(isFullscreen) {
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ Change = 0;
+ } else {
+ if(isFullscreen) {
+ //SHOW epg info
+ if(!epgactive){
+ SetOsdInfo();
+ osdepginfo.style.opacity = 1;
+ osdepginfonext.style.opacity = 0;
+ epgactive = 1;
+ } else {
+ osdepginfo.style.opacity = 0;
+ osdepginfonext.style.opacity = 0;
+ epgactive = 0;
+ }
+// setTimeout("epgactive = 0; osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0;", 5000);
+ } else if(!isFullscreen){
+ isFullscreen = 1;
+ FullScreen();
+ currChan = preChan;
+ }
+ }
+ break;
+
+ case "Enter":
+ // OK key on frontpanel
+ case "Accept":
+ if(isFullscreen) {
+ // fullscreen
+ if(!count) {
+ showOSD();
+ } else {
+ CheckChannel(Change);
+ count = 0;
+ if(ChangeOK) {
+ play(channels[currChan]);
+ ChangeOK = 0;
+ }
+ }
+ } else {
+ // if not fullscreen
+ if(count){
+ CheckChannel(Change);
+ count = 0;
+ if(ChangeOK) {
+ preview(channels[currChan]);
+ ChangeOK = 0;
+ }
+ } else {
+ isFullscreen = 1;
+ FullScreen();
+ play(channels[currChan]);
+ }
+ }
+ break;
+
+ case "Menu":
+ if(isFullscreen) {
+ isSetupMenu = 1;
+ mainmenu.style.opacity = 1;
+ InitMenu();
+ }
+ break;
+ case "Scroll":
+ if(isFullscreen) {
+ NowNext = 0;
+ videoplane.style.width = "320px";
+ videoplane.style.height = "240px";
+ videoplane.style.left = "380px";
+ videoplane.style.top = "300px";
+ showChannelList();
+ isFullscreen = 0;
+ if(!SwitchGuide) {
+ preChan = currChan;
+ }
+ } else {
+ isFullscreen = 1;
+ FullScreen();
+ if(!SwitchGuide) {
+ currChan = preChan;
+ }
+ }
+ break;
+ case "TV":
+ currChan = prevChan;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ play(channels[currChan]);
+ break;
+
+ case KEY_0:
+ digit = 0;
+ Makedigit();
+ break;
+ case KEY_1:
+ digit = 1;
+ Makedigit();
+ break;
+ case KEY_2:
+ digit = 2;
+ Makedigit();
+ break;
+ case KEY_3:
+ digit = 3;
+ Makedigit();
+ break;
+ case KEY_4:
+ digit = 4;
+ Makedigit();
+ break;
+ case KEY_5:
+ digit = 5;
+ Makedigit();
+ break;
+ case KEY_6:
+ digit = 6;
+ Makedigit();
+ break;
+ case KEY_7:
+ digit = 7;
+ Makedigit();
+ break;
+ case KEY_8:
+ digit = 8;
+ Makedigit();
+ break;
+ case KEY_9:
+ digit = 9;
+ Makedigit();
+ break;
+ case "Teletext":
+ if(isFullscreen) {
+ isVisible = 1;
+ setVisible(isVisible);
+ }
+ break;
+ case "VolumeMute":
+ state = toi.audioOutputService.getMuteState(AudioOut);
+ toi.audioOutputService.setMuteState(AudioOut, !state);
+ mute = 1 - state;
+ osdmute.style.opacity = mute;
+ break;
+ case "VolumeUp":
+ Volume = Volume + 10;
+ if (Volume > 100) {
+ Volume = 100;
+ }
+ toi.audioOutputService.setVolume(AudioOut, Volume);
+ showVolume();
+ break;
+ case "VolumeDown":
+ Volume = Volume - 10;
+ if (Volume < 0) {
+ Volume = 0;
+ }
+ toi.audioOutputService.setVolume(AudioOut, Volume);
+ showVolume();
+ break;
+
+ case "MediaRewind":
+ break;
+ case "MediaForward":
+ break;
+ case "MediaPlayPause":
+ break;
+ case "MediaStop":
+ mediaList.style.opacity = 0.8;
+ isMediaMenu = 1;
+ showDisplay("STOP", false, 100, 0 );
+ currMed = 0;
+ showMediaList();
+ break;
+ case "MediaRecord":
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+function Makedigit() {
+ prevChan = currChan;
+ Change = (Change*10) + digit;
+ count = count + 1;
+ osdnr.style.opacity = isFullscreen;
+ OSDchannr(Change);
+ if(isFullscreen) {
+ showDisplay((Change.toString()), false, 100, 0 );
+ }
+
+ if (count>2) {
+ CheckChannel(Change);
+ count = 0;
+ }
+ if(ChangeOK) {
+ if(isFullscreen) {
+ play(channels[currChan]);
+ } else {
+ preview(channels[currChan]);
+ }
+ ChangeOK = 0;
+ }
+}
+
+function CheckChannel(CheckThis) {
+// function to check if channel exists
+ if(channels[CheckThis]) {
+ ChangeOK = 1;
+ currChan = CheckThis;
+ } else {
+ ChangeOK = 0;
+ }
+ if(prevChan == currChan) {
+ ChangeOK = 0 ;
+ }
+ osdnr.style.opacity = 0;
+ if(isFullscreen) {
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ Change = 0;
+
+}
+
+
+function showDisplay(showtxt,colonState,intensity,currentMode) {
+ if(!showClock){
+ toi.frontPanelService.setSegmentDisplayState(toi.statics.ToiFrontPanelServiceSegmentDisplayState.create(showtxt,colonState,intensity,currentMode));
+ }
+}
+
+function SetLed(NumLed,color,blinkfreq){
+ var fps = toi.frontPanelService;
+ var state = toi.statics.ToiFrontPanelServiceLedState.create(color, blinkfreq);
+ fps.setLedState(NumLed, state);
+}
+
+
+function showOSD() {
+ if (osdtimeout) {
+ clearTimeout(osdtimeout);
+ }
+ SetOsdInfo();
+ opacity = 1;
+ OSD(opacity);
+ osdtimeout = setTimeout("fadeOut()", 3000);
+}
+
+function showVolume() {
+ if (osdVolumetimeout) {
+ clearTimeout(osdVolumetimeout);
+ }
+ osdvolume.innerHTML = "<font color=green size=3>VOLUME : \uE007" + (new Array(Volume)).join("\uE008") + (new Array(100 - Volume)).join("\uE009") + "\uE00A</font>";
+ osdvolume.style.opacity = 1;
+ osdVolumetimeout = setTimeout("osdvolume.style.opacity = 0;", 3000);
+}
+
+
+function OSD(opacity) {
+ osdmain.style.opacity = opacity;
+ osdnr.style.opacity = opacity;
+ osdtime.style.opacity = opacity;
+ osdname.style.opacity = opacity;
+ osdepg.style.opacity = opacity;
+ osdca.style.opacity = opacity;
+ osdtimer.style.opacity = opacity;
+}
+
+
+function SetOsdInfo() {
+ OSDchannr(currChan);
+ date_time();
+// GetEPG(currChan);
+ OSDhtml();
+ return;
+}
+
+function onCacheUpdated() {
+ GetEPG(currChan);
+ if (osdtimeout) {
+// GetEPG(currChan);
+ SetOsdInfo();
+ }
+// if (!isFullscreen) {
+// showChannelList();
+// }
+ if (isSchedule) {
+ GetSchedule(currChan,10);
+ }
+
+}
+
+function OSDchannr(channr) {
+ osdnr.innerHTML = "<center><font color=black size=6>" + channr + "</font></center>";
+}
+
+function OSDhtml(){
+ osdtime.innerHTML = "<font color=white size=2>" + result +"</font>";
+ osdname.innerHTML = "<font color=black size=5>" + Left(channelsnames[currChan],30) + "</font>";
+ osdepg.innerHTML = "<font color=white size=4><p>" + EPG[0][7][currChan] + "</p>\n<p>" + EPG[1][7][currChan] + "</p></font>";
+ osdepginfo.innerHTML = "<center><font color=white size=4><p>" + EPG[0][7][currChan] + "</p>\n<p>" + EPG[0][4][currChan] + "</p>\n<p>" + Left(EPG[0][5][currChan],750) + "</p></font></center>";
+ osdepginfonext.innerHTML = "<center><font color=white size=4><p>" + EPG[1][7][currChan] + "</p>\n<p>" + EPG[1][4][currChan] + "</p>\n<p>" + Left(EPG[1][5][currChan],750) + "</p></font></center>";
+}
+
+
+
+function settimer() {
+ if(SwitchTimer) {
+ tijd = EPG[NowNext][2][currChan];
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10) {
+ th = "0"+th;
+ }
+ if(tm<10) {
+ tm = "0"+tm;
+ }
+ dateCurrent = new Date();
+ var StartTime = Math.floor((date.getTime() - dateCurrent.getTime()));
+ timerChan = currChan;
+ TimerActions = "isVisible = 0; isFullscreen = 1; FullScreen(); setVisible(isVisible); currChan = timerChan; play(timerChan); osdtimer.innerHTML = '';SetLed(0,0,0);"
+ // only 1 switch timer possible
+ if(switchtimerID) {
+ clearTimeout(switchtimerID);
+ }
+ switchtimerID = setTimeout(TimerActions, StartTime);
+ switchtimer.innerHTML = "<font color=black size=4><p> Name : " + EPG[NowNext][1][currChan] + "</p><p> channel : " + channelsnames[currChan] + "</p><p> Starttime : " + th + ":" + tm + "</p></font>";
+ osdtimer.innerHTML = "<font color=black size=3><p>" + th + ":" + tm + "</p></font>";
+ SetLed(0,2,1);
+ } else {
+ //
+ // No Switch timer so send timer info to Server
+ //
+ }
+}
+
+// linker n tekens van string
+function Left(str, n){
+ if (n <= 0)
+ return "";
+ else if (n > String(str).length)
+ return str;
+ else
+ return String(str).substring(0,n);
+}
+
+// rechter n tekens van string
+function Right(str, n){
+ if (n <= 0)
+ return "";
+ else if (n > String(str).length)
+ return str;
+ else {
+ var iLen = String(str).length;
+ return String(str).substring(iLen, iLen - n);
+ }
+}
+
+function fadeIn() {
+ opacity += 0.2;
+ OSD(opcity);
+ if (opacity >= 1) {
+ setTimeout("fadeOut()", 200);
+ return;
+ }
+ setTimeout("fadeIn()", 100);
+}
+
+function fadeOut() {
+ opacity -= 0.2;
+ OSD(opacity);
+ if (opacity <= 0) {
+ return;
+ }
+ setTimeout("fadeOut()", 100);
+}
+
+function RestartPortal(){
+
+ try {
+ ids = toi.applicationService.getApplicationIds();
+ for ( i = 0; i < ids.length; ++i ){
+ info = toi.applicationService.getInfo(ids[i]);
+ if (info.applicationName == "WebKit Portal"){
+ dump("Killing app " + ids[i] + ": " + info.applicationName);
+ toi.applicationService.kill(ids[i]);
+ }
+ }
+ }
+ catch(e) { dump(e) };
+}
+
+function date_time()
+{
+ date = new Date;
+ year = date.getFullYear();
+ month = date.getMonth();
+ d = date.getDate();
+ day = date.getDay();
+ h = date.getHours();
+ if(h<10)
+ {
+ h = "0"+h;
+ }
+ m = date.getMinutes();
+ if(m<10)
+ {
+ m = "0"+m;
+ }
+ s = date.getSeconds();
+ if(s<10)
+ {
+ s = "0"+s;
+ }
+ result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m;
+ return;
+}
+
+// EPG Section
+
+function GetEPG(epgchan)
+{
+ EPG[0][7][epgchan] = "";
+ EPGShortnow = "";
+ EPGExtnow = "";
+ EPG[1][7][epgchan] = "";
+ EPGShortnext = "";
+ EPGExtnext = "";
+ cds = 0;
+ try {
+ // streaminfo
+ // SI[x] 0-sat,1-NID,2-TID,3-SID
+ SI=channels[epgchan].split("-");
+ is = toi.informationService;
+ is.setObject("cfg.locale.ui","ger",is.STORAGE_VOLATILE);
+ if(SI[0]=="S28.2E") {
+ is.setObject("cfg.locale.ui","eng",is.STORAGE_VOLATILE);
+ }
+ if((SI[0]=="S23.5E" && SI[1]=="3") || SI[2]=="1026" || SI[2]=="1097" || SI[2]=="1105" || SI[2]=="1119") {
+ is.setObject("cfg.locale.ui","dut",is.STORAGE_VOLATILE);
+ cds = 1;
+ }
+
+ eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]);
+ eitCache.addService(eitService);
+ event = eitCache.getPresentEvent(eitService);
+ if(event.freeCaMode){
+ osdca.innerHTML = "<font color=black size=6>\uE00D</font>";
+ } else {
+ osdca.innerHTML = "<font color=black size=6>\uE00F</font>";
+ }
+
+ if (event.name) {
+ events = eitCache.getEvents(eitService, 1000000000, 2000000000);
+ extEventsnow = eitCache.getExtendedEventInfo(eitService, events.infoSequence[0].eventId);
+ EPGShortnow = extEventsnow.shortInfo;
+ EPGExtnow = extEventsnow.extendedInfo;
+ Extok = 1;
+ } else { Extok = 0; }
+
+ EPG[0][1][epgchan] = event.name;
+ EPG[0][2][epgchan] = event.time;
+ EPG[0][3][epgchan] = (event.duration/60);
+ EPG[0][4][epgchan] = "";
+ EPG[0][5][epgchan] = "";
+
+ if(EPGShortnow) {
+ EPG[0][4][epgchan] = EPGShortnow;
+ } else {
+ EPG[0][4][epgchan] = "";
+ }
+ if(EPGExtnow) {
+ EPG[0][5][epgchan] = EPGExtnow;
+ } else {
+ EPG[0][5][epgchan] = "";
+ }
+ tijd = event.time;
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ dateCurrent = new Date();
+ var EPGminutes = Math.floor((dateCurrent.getTime() - date.getTime()) /1000/60);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10)
+ {
+ th = "0"+th;
+ }
+ if(tm<10)
+ {
+ tm = "0"+tm;
+ }
+ if(cds){
+ // CDS has short info, other providers, a little longer.
+ EPG[0][7][epgchan] = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes).toFixed(0) + ")" + " " + event.name + " " + EPGShortnow;
+ } else {
+ EPG[0][7][epgchan] = th + ":" + tm + " (" + EPGminutes + " / " + ((event.duration/60)-EPGminutes).toFixed(0) + ")" + " " + event.name + " ";
+ }
+ if (!event.time)
+ {
+ EPG[0][7][epgchan] = " ";
+ }
+
+
+ event = eitCache.getFollowingEvent(eitService);
+ if (Extok) {
+ for (var i = 0; i < events.infoSequence.length && i < 4; i++) {
+ extEvents = eitCache.getExtendedEventInfo(eitService, events.infoSequence[i].eventId);
+ if (extEvents.eventId == event.eventId) {
+ EPGShortnext = extEvents.shortInfo;
+ EPGExtnext = extEvents.extendedInfo;
+ }
+ }
+ }
+
+ EPG[1][1][epgchan] = event.name;
+ EPG[1][2][epgchan] = event.time;
+ EPG[1][3][epgchan] = (event.duration/60);
+ EPG[1][4][epgchan] = "";
+ EPG[1][5][epgchan] = "";
+
+
+
+ if(EPGShortnext) {
+ EPG[1][4][epgchan] = EPGShortnext;
+ } else {
+ EPG[1][4][epgchan] = "";
+ }
+ if(EPGExtnext) {
+ EPG[1][5][epgchan] = EPGExtnext;
+ } else {
+ EPG[1][5][epgchan] = "";
+ }
+ tijd = event.time;
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10)
+ {
+ th = "0"+th;
+ }
+ if(tm<10)
+ {
+ tm = "0"+tm;
+ }
+
+ if(cds){
+ // CDS has short info, other providers, a little longer.
+ EPG[1][7][epgchan] = th + ":" + tm + " (" + (event.duration/60).toFixed(0) + ")" + " " + event.name + " " + EPGShortnext;
+ } else {
+ EPG[1][7][epgchan] = th + ":" + tm + " (" + (event.duration/60).toFixed(0) + ")" + " " + event.name + " ";
+ }
+ if (!event.time)
+ {
+ EPG[1][7][epgchan] = " ";
+ }
+
+
+ } catch(e) {
+ alert("Get EPG problem: " + e);
+ }
+}
+
+
+
+function GetSchedule(schchan,tablelength){
+ try {
+ SI=channels[schchan].split("-");
+ is = toi.informationService;
+ is.setObject("cfg.locale.ui","ger",is.STORAGE_VOLATILE);
+ if(SI[0]=="S28.2E") {
+ is.setObject("cfg.locale.ui","eng",is.STORAGE_VOLATILE);
+ }
+ if((SI[0]=="S23.5E" && SI[1]=="3") || SI[2]=="1026" || SI[2]=="1097" || SI[2]=="1105" || SI[2]=="1119") {
+ is.setObject("cfg.locale.ui","dut",is.STORAGE_VOLATILE);
+ cds = 1;
+ }
+
+ eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]);
+ eitCache.addService(eitService);
+ event = eitCache.getPresentEvent(eitService);
+ events = eitCache.getEvents(eitService, 1000000000, 2000000000);
+
+ if (event.name) {
+ if (events.more) {
+ var t = eitCache.getEvents(eitService, 1000000000, 2000000000);
+ events.infoSequence.concat(t.infoSequence);
+ events.more = t.more;
+ }
+
+ var txt = "<table><tr>";
+ var i = 0;
+ for (i = 0; i < events.infoSequence.length && i < tablelength; i++) {
+
+ while ((i > 0) && (events.infoSequence[i].eventId == events.infoSequence[(i-1)].eventId)) {
+ i = i +1;
+ }
+
+ tijd = events.infoSequence[i].time;
+ date = new Date(tijd*1000);
+ tijd = date.toUTCString();
+ tijd = new Date(tijd);
+ var tm = tijd.getMinutes();
+ var th = tijd.getHours();
+ if(th<10)
+ {
+ th = "0"+th;
+ }
+ if(tm<10)
+ {
+ tm = "0"+tm;
+ }
+
+ txt = txt + "<td>" + th + ":" + tm + " (" + events.infoSequence[i].duration/60 + ") " + events.infoSequence[i].name + "</td></tr>";
+ }
+ txt = txt + "</table>";
+ schedule.innerHTML = "<font size=+3>" + schchan + "\uE003" + channelsnames[schchan] + "</font>" + txt;
+ } else {
+ schedule.innerHTML = "<p>" + channelsnames[schchan] + "</p> ";
+ }
+
+ } catch(e) {
+ alert("Get EPG problem: " + e);
+ schedule.innerHTML = "<p>" + channelsnames[schchan] + "</p><p> NO EPG </p>";
+ }
+
+}
+
+// End of EPG section
+
+
+
+// Channelslist / EPG Guide
+//
+// show currchan - 5
+// highlite currchan
+// show currchan + 5
+//
+// check if chan is OK
+//
+function showChannelList() {
+ var liststyle = "";
+ var htmlstring = "<table border='0'><tr>";
+ listChan = currChan-5;
+ for(var i=currChan-5; i<=currChan+5; i++) {
+ if (listChan<1) {
+ listChan=nrChannels-2;
+ }
+ if (listChan>nrChannels-2) {
+ listChan=0;
+ }
+ do
+ {
+ listChan = listChan + 1;
+ }
+ while (!channels[listChan] && (listChan<nrChannels));
+ GetEPG(listChan);
+ if ( listChan == currChan) {
+ liststyle = " style='background:#fc5;'";
+ } else {
+ liststyle = "";
+ }
+ EpgInfo[0] = EPG[0][7][listChan];
+ EpgInfo[1] = EPG[1][7][listChan];
+ htmlstring = htmlstring + "<td" + liststyle + ">" + listChan + "</td><td" +liststyle + ">" + Left(channelsnames[listChan],15) + "</td><td" +liststyle + ">" + Left(EpgInfo[NowNext],64) + "</td></tr>";
+ }
+ htmlstring = htmlstring + "</table>";
+ channelList.innerHTML = htmlstring;
+ chanlistepg.innerHTML = "<center><font color=black size=4><p>" + EPG[NowNext][1][currChan] + "</p></font><font color=black size=3><p>" + Left(EPG[NowNext][4][currChan],250) + "</p></font></center>" ;
+
+}
+
+// END of Channelslist / EPG Guide
+
+// TeleTXT section
+
+function embedTeletextPlugin() {
+ teletext = document.createElement("embed");
+ teletext.id = "teletext";
+ teletext.type = "application/motorola-teletext-plugin";
+ teletext.style.position = "absolute";
+ teletext.style.width = "100%";
+ teletext.style.height = "100%";
+ teletext.style.top = "10px"; // has to be 1 rather than 0
+ teletext.style.left = "10px"; // has to be 1 rather than 0
+ teletext.style.zIndex = "501";
+ return teletext;
+}
+
+
+function setVisible(isVisible) {
+ if (isVisible) {
+ videoplane.style.width = "50%";
+ videoplane.style.left = "50%";
+ document.body.appendChild(teletext);
+ teletext.style.width = "50%";
+ teletext.style.visibility = "visible";
+ channelList.style.visibility = "hidden";
+ colorkeys.style.visibility = "hidden";
+ } else {
+ teletext.style.visibility = "hidden";
+ channelList.style.visibility = "visible";
+ colorkeys.style.visibility = "visible";
+ }
+}
+
+
+function onKeyTeletext(keyCode) {
+ switch(keyCode) {
+ case "Left":
+ teletext.api.gotoNextPage();
+ break;
+ case "Right":
+ teletext.api.gotoPreviousPage();
+ break;
+ case "Red":
+ teletext.api.inputRedKey();
+ break;
+ case "Green":
+ teletext.api.inputGreenKey();
+ break;
+ case "Yellow":
+ teletext.api.inputYellowKey();
+ break;
+ case "Blue":
+ teletext.api.inputCyanKey();
+ break;
+ case "MediaRewind":
+ teletext.api.gotoPreviousSubpage();
+ break;
+ case "MediaForward":
+ teletext.api.gotoNextSubpage();
+ break;
+ case "MediaStop":
+ teletext.style.width = "100%";
+ teletext.api.transparent = !teletext.api.transparent;
+ FullScreen();
+ break;
+ case "BrowserBack":
+ case "Teletext":
+ isVisible = 0;
+ FullScreen();
+ setVisible(isVisible);
+ break;
+
+ case "TV":
+ teletext.api.gotoIndexPage();
+ break;
+
+ case KEY_0:
+ teletext.api.inputDigit(0);
+ break;
+ case KEY_1:
+ teletext.api.inputDigit(1);
+ break;
+ case KEY_2:
+ teletext.api.inputDigit(2);
+ break;
+ case KEY_3:
+ teletext.api.inputDigit(3);
+ break;
+ case KEY_4:
+ teletext.api.inputDigit(4);
+ break;
+ case KEY_5:
+ teletext.api.inputDigit(5);
+ break;
+ case KEY_6:
+ teletext.api.inputDigit(6);
+ break;
+ case KEY_7:
+ teletext.api.inputDigit(7);
+ break;
+ case KEY_8:
+ teletext.api.inputDigit(8);
+ break;
+ case KEY_9:
+ teletext.api.inputDigit(9);
+ break;
+
+
+
+ }
+}
+
+// end of TeleTXT section
+
+
+// Menu section
+
+function onKeyMenu(keyCode) {
+ switch(keyCode) {
+ case "Menu":
+ case "BrowserBack":
+ isSetupMenu = 0;
+ mainmenu.style.opacity = 0;
+ break;
+ case "Left":
+ break;
+ case "Right":
+ break;
+ case "Red":
+ if(showClock == 0 ) {
+ showDisplay("", true, 80, 1 );
+ showClock = 1;
+ } else if(showClock == 1 ) {
+ showClock = 0;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ }
+ InitMenu();
+ break;
+ case "Green":
+ audio = audio + 1;
+ is = toi.informationService;
+ if(audio == 1) {
+ is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE);
+ } else if(audio == 2) {
+ is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE);
+ } else if(audio == 3) {
+ is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE);
+ audio = 0;
+ }
+ InitMenu();
+ break;
+ case "Yellow":
+ clearTimeout(switchtimerID);
+ switchtimerID = 0;
+ InitMenu();
+ osdtimer.innerHTML = "";
+ SetLed(0,0,0);
+ break;
+ case "Blue":
+ if(SwitchGuide == 0 ) {
+ SwitchGuide = 1;
+ } else if(SwitchGuide == 1 ) {
+ SwitchGuide = 0;
+ }
+ InitMenu();
+ break;
+ case "MediaRewind":
+ break;
+ case "MediaForward":
+ break;
+ case "MediaStop":
+ break;
+ case "Teletext":
+ break;
+ case "TV":
+ break;
+ case KEY_0:
+ break;
+ case KEY_1:
+ break;
+ case KEY_2:
+ break;
+ case KEY_3:
+ break;
+ case KEY_4:
+ break;
+ case KEY_5:
+ break;
+ case KEY_6:
+ break;
+ case KEY_7:
+ break;
+ case KEY_8:
+ break;
+ case KEY_9:
+ break;
+ }
+}
+
+function InitMenu() {
+ mainmenu.innerHTML = "<center><font size=7 color=white><p> SETTINGS </p><font color=red size=5><p>Frontdisplay Clock : " + showClock + "</p></font><font color=green size=5><p>Prio audio track : " + (toi.informationService.getObject("cfg.media.audio.languagepriority")) + "</p></font><font color=yellow size=5><p>Switch timer : " + Boolean(switchtimerID) + "</p></font><font color=blue size=5><p>Preview guide : " + SwitchGuide + "</p></font></center>";
+}
+
+// End of Menu section
+
+// Media Player Section
+
+function onKeyMedia(keyCode) {
+ switch(keyCode) {
+ case "BrowserBack":
+ case "TV":
+ mediaList.style.opacity = 0;
+ showDisplay((currChan.toString()), false, 100, 0 );
+ isMediaMenu = 0;
+ play(channels[currChan]);
+ break;
+ break;
+ case "Down":
+ if (mediaList.style.opacity != 0) {
+ do
+ {
+ incMed(1);
+ }
+ while (!recording[currMed]);
+ showMediaList();
+ } else {
+ speed = 0;
+ mediaPlayer.play(0);
+ showDisplay("PAUS", false, 100, 0 );
+ }
+ break;
+ case "Up":
+ if (mediaList.style.opacity != 0) {
+ do
+ {
+ decMed(1);
+ }
+ while (!recording[currMed]);
+ showMediaList();
+ } else {
+ speed = 1000;
+ mediaPlayer.play(1000);
+ showDisplay("PLAY", false, 100, 0 );
+ }
+ break;
+ case "Accept":
+ if (mediaList.style.opacity != 0) {
+ mediaList.style.opacity = 0;
+ speed = 1000;
+ playRec(recording[currMed]);
+ } else {
+ osdmedia.style.opacity = 1 - osdmedia.style.opacity;
+ ShowMediaOSD();
+// mediaPlayer.playFromPosition(60000,1000);
+ }
+ break;
+ case "Green":
+ audio = audio + 1;
+ is = toi.informationService;
+ if(audio == 1) {
+ is.setObject("cfg.media.audio.languagepriority","dut,eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>Nederlands</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ } else if(audio == 2) {
+ is.setObject("cfg.media.audio.languagepriority","ger,deu,eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>Deutsch</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ } else if(audio == 3) {
+ is.setObject("cfg.media.audio.languagepriority","eng",is.STORAGE_VOLATILE);
+ osdlang.style.opacity = 1;
+ osdlang.innerHTML = "<img src='unmute.png'><font color=white size=3>English</font>"
+ setTimeout("osdlang.style.opacity = 0; ", 3000);
+ audio = 0;
+ }
+ break;
+ case "MediaRewind":
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ speed = speed - 1000;
+ if (speed < -9000) {
+ speed = -9000;
+ }
+ mediaPlayer.play(speed);
+ showDisplay("PL" + ((speed/1000).toString()), false, 100, 0 );
+ }
+ break;
+ case "MediaForward":
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ speed = speed + 1000;
+ if (speed > 9000) {
+ speed = 9000;
+ }
+ mediaPlayer.play(speed);
+ showDisplay("PL" + ((speed/1000).toString()), false, 100, 0 );
+ }
+ break;
+ case "MediaStop":
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ mediaPlayer.close();
+ }
+ speed = 1000;
+ mediaList.style.opacity = 0.8;
+ showDisplay("STOP", false, 100, 0 );
+ showMediaList();
+ break;
+ case "MediaPlayPause":
+ if (mediaPlayer.getState() != mediaPlayer.STATE_PAUSED) {
+ mediaPlayer.play(0);
+ showDisplay("PAUS", false, 100, 0 );
+ } else {
+ speed = 1000;
+ mediaPlayer.play(1000);
+ showDisplay("PLAY", false, 100, 0 );
+ }
+ break;
+ case "VolumeMute":
+ state = toi.audioOutputService.getMuteState(AudioOut);
+ toi.audioOutputService.setMuteState(AudioOut, !state);
+ mute = 1 - state;
+ osdmute.style.opacity = mute;
+ break;
+ case "VolumeUp":
+ Volume = Volume + 10;
+ if (Volume > 100) {
+ Volume = 100;
+ }
+ toi.audioOutputService.setVolume(AudioOut, Volume);
+ showVolume();
+ break;
+ case "VolumeDown":
+ Volume = Volume - 10;
+ if (Volume < 0) {
+ Volume = 0;
+ }
+ toi.audioOutputService.setVolume(AudioOut, Volume);
+ showVolume();
+ break;
+ default:
+ break;
+ }
+}
+
+function showMediaList() {
+ var liststyle = "";
+ var htmlstring = "<p><center><font size=4>RECORDINGS</font></center></p><table border='0'><tr>";
+ listMed = currMed-7;
+ for(var i=currMed-7; i<=currMed+7; i++) {
+ if (listMed<0) {
+ listMed=nrMedia-2;
+ }
+ if (listMed>nrMedia-1) {
+ listMed= -1;
+ }
+ do
+ {
+ listMed = listMed + 1;
+ }
+ while (!recording[listMed] && (listMed<nrMedia));
+ if ( listMed == currMed) {
+ liststyle = " style='background:#fc5;'";
+ } else {
+ liststyle = "";
+ }
+ htmlstring = htmlstring + "<td" + liststyle + ">\uE003\uE003" + Left(recording[listMed],60) + "</td></tr>";
+ }
+ htmlstring = htmlstring + "</table>";
+ mediaList.innerHTML = htmlstring;
+}
+
+
+function incMed(step) {
+ currMed = currMed + step;
+ if (currMed == nrMedia + 1) {
+ currMed = 0;
+ }
+}
+
+function decMed(step) {
+ currMed = currMed - step;
+ if (currMed < 0) {
+ currMed = nrMedia;
+ }
+}
+
+function playRec(uri) {
+ try {
+ if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) {
+ mediaPlayer.close();
+ }
+ uri = "file://" + uri;
+ mediaPlayer.open(uri);
+ mediaPlayer.play(1000);
+ showDisplay("PLAY", false, 100, 0 );
+ } catch (e) {
+ alert("Failed opening recording: " + e);
+ return;
+ }
+}
+
+
+function ShowMediaOSD() {
+// Display Name/ length
+ osdmedia.innerHTML = "<font size=4> Elapsed time : " + mediaPlayer.getPosition() + "</font>";
+}
+
+
+</script>
+
+
+ <body style="background:#ccc;" onload="onLoad()" onunload="onUnload()">
+ <embed type="application/x-motorola-toi" hidden="true">
+
+ <div id="channelList" style="background:#bbb; width:100%; height:45%; position:absolute; left:50px; top:25px;"></div>
+ <div id="schedule" style="background:#bbb; width:100%; height:45%; position:absolute; left:50px; top:25px;opacity:0;z-index:450;"></div>
+
+ <div id="colorkeys" style="width:100%; position:absolute; left:75px; top:485px;"><font color=red size=3> ----- </font><font color=green size=3> Next </font><font color=yellow size=3> Schedule </font><font color=blue size=3> INFO </font></div>
+
+
+ <div id="schedkeys" style="width:100%; position:absolute; left:75px; top:485px;opacity:0;"><font color=red size=3>-----</font><font color=green size=3>----</font><font color=yellow size=3> GUIDE </font><font color=blue size=3> ---- </font></div>
+
+ <div id="chanlistepg" style="width:300; position:absolute; left:50px; top:290px;"> </div>
+ <div id="switchtimer" style="background:#3366ff;width:300; position:absolute; left:150px; top:150px;z-index:10;opacity:0;"></div>
+
+
+ <videoplane id='videoplane' style='position:absolute; left:0px; top:0px; height: 100%; width: 100%; z-index:500;'></videoplane>
+
+ <div id="osdvolume" style="width:450px; position:absolute; left:150px; top:500px;z-index:501;fontFamily:VDRSymbolsSans;opacity:0;">Volume : </div>
+ <div id="osdmedia" style="width:450px; position:absolute; left:150px; top:400px;z-index:505;fontFamily:VDRSymbolsSans;opacity:0;"></div>
+
+ <div id="osdmain" style="background:#3366ff;width:550px; position:absolute; left:75px; top:350px; bottom:50px;z-index:505;"></div>
+ <div id="osdtime" style="width:300px; position:absolute; left:375px; top:360px;z-index:505;"></div>
+ <div id="osdname" style="width:500px;height:25px; position:absolute; left:85px; top:375px;z-index:505;"></div>
+ <div id="osdepg" style="width:450px; position:absolute; left:150px; top:400px;z-index:505;"></div>
+ <div id="osdtimer" style="width:50px; position:absolute; left:85px; top:400px;z-index:505;"></div>
+ <div id="osdca" style="width:25px; position:absolute; left:575px; top:385px;z-index:505;fontFamily:VDRSymbolsSans;"></div>
+
+ <div id="osdnr" style="background:red;width:75px;height:50px; position:absolute; left:85px; top:320px;z-index:505;opacity:0;"></div>
+
+ <div id="osdepginfo" style="background:#3366ff;width:550px; position:absolute; left:100px; top:100px;z-index:510;opacity:0;"></div>
+ <div id="osdepginfonext" style="background:#3366ff;width:550px; position:absolute; left:100px; top:100px;z-index:510;opacity:0;"></div>
+
+ <div id="osdmute" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"><img src="mute.png"></div>
+ <div id="osdlang" style="width:50px; position:absolute; left:550px; top:50px;z-index:515;opacity:0;"></div>
+ <div id="mainmenu" style="background:#3366ff;width:550px; position:absolute; left:75px; top:50px; bottom:50px;z-index:520;opacity:0;"></div>
+ <div id="mediaList" style="background:#bbb; width:80%; height:75%; position:absolute; left:10%; top:10%;z-index:520;opacity:0;"></div>
+
+</body>
+</html>
+
+