window.onkeydown = onKeyDown; function onLoad() { is = toi.informationService; ss = toi.schedulerService; aos = toi.audioOutputService; vos = toi.videoOutputService; fps = toi.frontPanelService; ams = toi.assetManagerService; GetSettings(); createPlayer(); createEitCache(); if(pipPlayer){ addPipVideoplane(); createPip(); } if(PipSwitchGuide){ createPip(); } embedTeletextPlugin(); aos.setVolume(AudioOut, StartVolume); aos.setMuteState(AudioOut, false); showDisplay(currChan.toString(), false, 100, 0 ); play(channels[currChan]); if (EPGMode) { eitCache.setFilterMode(eitCache.FILTER_MODE_PF_AND_SCHEDULE); } else { eitCache.setFilterMode(eitCache.FILTER_MODE_PF_ONLY); } eitCache.addEventListener(eitCache.ON_CACHE_UPDATED, onCacheUpdated); mediaPlayer.addEventListener(mediaPlayer.ON_DATA_AVAILABLE,onDataAvailableEvent); mediaPlayer.addEventListener(mediaPlayer.ON_STATE_CHANGED, MPD); if (is.getObject("var.capabilities.dvr") == "FALSE") { mediaRecorder = 0; // No harddisk, no recorder functions possible } if (is.getObject("config.architecture.target") !== "vip1903" && fullupdate !== 2) { fullupdate = 0; // No 19x3 so better turn fullupdate EPG off } if (mediaRecorder) { createRecorder(); mediaRecorder.addEventListener(mediaRecorder.ON_STATE_CHANGED, onRecorderStateChanged); om = toi.assetManagerService.getAssetOperationManager(); //toi.OperationManager; rma = om.createOperation("Remove Asset"); } is.addEventListener(is.ON_OBJECTS_CHANGED, onEvent); is.subscribeObject(onEvent, "var.io.state", true); ss.addEventListener(ss.ON_SCHEDULED_START, onScheduledStart); ss.addEventListener(ss.ON_SCHEDULED_STOP, onScheduledStop); ss.setCategorySubscription(onScheduledStart, "*"); ss.setCategorySubscription(onScheduledStop, "*"); setOSDscale(); setOSDtimer(); showOSD(); videoplane.subtitles = Boolean(ShowSubs); colorkeys.innerHTML = " " + NN[4] + " " + NN[1] + " " + NN[2] + " " + NN[5] + " "; medialist.innerHTML = "
\n" + Lang[90] +"\n\n"; // Non free channel message switchtimer.style.opacity = 1; CAdelayID = setTimeout("switchtimer.style.opacity = 0;",ShowSetTimer); } } } function startTimeshiftBuffering() { // check that media player is working if (mediaPlayer.getState() != mediaPlayer.STATE_PLAYING ) { alert("Media Player must be playing when starting timeshift buffering!"); return; } mediaPlayer.startTimeshiftBuffering(600); } function FullScreen() { videoplane.style.width = "100%"; videoplane.style.height = "100%"; videoplane.style.left = "0px"; videoplane.style.top = "0px"; if(PipSwitchGuide){ if (pipPlayer.getState() != pipPlayer.STATE_IDLE) { pipPlayer.close(); } } } function onKeyDown(event) { //show key info, needed when a 'new' remote is used //alert( "keyIdentifier : " + event.keyIdentifier +"\n"+"ctrlKey : " + event.ctrlKey +"\n"+"altKey : " + event.altKey +"\n"+"shiftKey : " + event.shiftKey +"\n"+"RAW : " + event ); if(isVisible) { onKeyTeletext(event.keyIdentifier); } else if(isSetupMenu) { onKeyMenu(event.keyIdentifier); } else if(isMediaMenu) { onKeyMedia(event.keyIdentifier); } else { switch(event.keyIdentifier) { case "ChannelUp": case "Up": if(isFullscreen) { count = 0; Change = 0; prevChan = currChan; do { incChan(1); } while (!channels[currChan]); play(channels[currChan]); } else { // swap up <> down in guide mode count = 0; Change = 0; do { decChan(1); } while (!channels[currChan]); preview(channels[currChan]); } break; case "ChannelDown": case "Down": if(isFullscreen) { count = 0; Change = 0; prevChan = currChan; do { decChan(1); } while (!channels[currChan]); play(channels[currChan]); } else { // swap up <> down in guide mode count = 0; Change = 0; do { incChan(1); } while (!channels[currChan]); preview(channels[currChan]); } break; case "Left": count = 0; Change = 0; if(isFullscreen) { defChan[ChanGroup] = currChan; do { do ChanGroup -= 1; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup < 0) { ChanGroup = 9; } } while (!minChan[ChanGroup]); currChan = defChan[ChanGroup]; play(channels[currChan]); } else { prevChan = currChan; if (currChan > (minChan[ChanGroup] + 8)) { decChan(9); } else { currChan = baseChn[ChanGroup] + (maxChan[ChanGroup] - currChan); } do { decChan(1); } while (!channels[currChan]); preview(channels[currChan]); } break; case "Right": count = 0; Change = 0; if(isFullscreen) { defChan[ChanGroup] = currChan; do { do ChanGroup += 1; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup > 9) { ChanGroup = 0; } } while (!minChan[ChanGroup]); currChan = defChan[ChanGroup]; play(channels[currChan]); } else { prevChan = currChan; if (currChan < (maxChan[ChanGroup] - 9 )) { incChan(9); } else { currChan = baseChn[ChanGroup] + (maxChan[ChanGroup] - currChan); } do { incChan(1); } while (!channels[currChan]); 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(isSchedule == 0){ if(NowNext) { settimer(EPG[1][2][currChan],EPG[1][1][currChan],0,1,"",(EPG[1][4][currChan] + EPG[1][5][currChan]),EPG[1][6][currChan].toString()); } } break; case "Green": if(isFullscreen) { if(!epgactive) { if (audio_dyn < (lang_prio_dyn.length -1)) { audio_dyn += 1} else { audio_dyn = 0 } if (lang_prio_dyn.length > 1) { is.setObject("cfg.media.audio.languagepriority",lang_prio_dyn[audio_dyn] + "," + lang_prio[audio],is.STORAGE_PERMANENT); osdlang.style.opacity = 1; osdlang.innerHTML = " " + lang_prio_dyn[audio_dyn] + " "; setTimeout("osdlang.style.opacity = 0; ", 3000); } } } else if(isSchedule == 0 && !epgactive){ colorkeys.innerHTML = " " + NN[3 + NowNext] + " " + NN[NowNext] + " " + NN[2] + " " + NN[5] + " "; NowNext = 1 - NowNext; showChannelList(); } if(epgactive) { NowNext = 1 - NowNext; osdepginfo.style.opacity = 1 - osdepginfo.style.opacity ; osdepginfonext.style.opacity = 1 - osdepginfo.style.opacity; } break; case "Yellow": if(isFullscreen) { if(epgactive) { osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0; epgactive = 0; } medialist.style.opacity = 0.9; set_yellow_key = 1; setTimeout("getSchedule(currChan);LoadMediaSettings();",100); } else { GetSchedule(currChan,15); schedule.style.opacity = 1 - schedule.style.opacity; isSchedule = schedule.style.opacity; if(isSchedule == 1){ colorkeys.innerHTML = " " + NN[4] + " " + NN[4] + " " + NN[6] + " " + NN[4] + " "; } else { colorkeys.innerHTML = " " + NN[3 + (1 - NowNext)] + " " + NN[1 - NowNext] + " " + NN[2] + " " + NN[5] + " "; } } break; case "Info": case "Blue": case KEY_EPG: // if(isFullscreen) { // RestartPortal(); // } else if(isSchedule == 0) { if(!epgactive) { updateOSDtime(currChan); SetOsdInfo(); if(isFullscreen) { NowNext = 0;} if (NowNext) { osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 1; } else { 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); } break; case "BrowserBack": if(count) { count = 0; osdmain.style.opacity = 0; if(isFullscreen) { showDisplay(currChan.toString(), false, 100, 0 ); } Change = 0; } else { if(isSchedule) { isSchedule = 0; schedule.style.opacity = 0; colorkeys.innerHTML = " " + NN[3 + (1 - NowNext)] + " " + NN[1 - NowNext] + " " + NN[2] + " " + NN[5] + " "; break; } 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){ osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0; epgactive = 0; isFullscreen = 1; FullScreen(); currChan = preChan; ChanGroup = preGrp; } } break; case "Enter": // OK key on frontpanel if (experimental) { RestartPortal(); } case KEY_OK: if(isFullscreen) { // fullscreen if (osdmain.style.opacity !== 0) {opacity = 0; OSD(opacity);} if(count == 0) { if (osdtimeout) { clearTimeout(osdtimeout); osdtimeout = 0; opacity = 0; OSD(opacity); break; } osdepg.innerHTML = ""; showOSD(); GetEPG(currChan); updateOSDtime(currChan); osdepg.innerHTML = "
" + EPG[0][7][currChan] + "
\n" + EPG[1][7][currChan] + "
"; // 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(); if(isSchedule) { isSchedule = 0; schedule.style.opacity = 0; } play(channels[currChan]); } } break; case "Menu": if(isFullscreen) { if(count) { count = 0; osdmain.style.opacity = 0; showDisplay(currChan.toString(), false, 100, 0 ); Change = 0; } osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0; isSetupMenu = 1; mainmenu.style.opacity = 0.8; menu = 0; InitMenu(menu); } break; case KEY_FAV: case "Scroll": if(isFullscreen) { GuideView_start(); } else { GuideView_end(); } break; case "TV": case "RADIO": if(isFullscreen) { if(ChanGroup !== 9) { //Radio defChan[ChanGroup] = currChan; ChanGroup = 9; currChan = defChan[9]; } else { //TV defChan[ChanGroup] = currChan; ChanGroup = 0; currChan = defChan[0]; } isSetupMenu = 0; mainmenu.style.opacity = 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 KEY_A:// |> key on old long kpn 1710/1760 remote break; case KEY_B:// hh key on old long kpn 1710/1760 remote if (prevChan !== currChan) { currChan = [prevChan, prevChan = currChan][0]; count = 0; play(channels[currChan]); } break; case KEY_C:// @ key on old long kpn 1710/1760 remote if(isFullscreen && Fav_max_channel !== 0 && ChanGroup !== Fav_group) { timerID = (defChan[Fav_group] - Fav_base - 1); if (timerID < 0) { timerID = 0;} maxTimers = Fav_max_channel; GotoFav(defChan[Fav_group]); } else if(isFullscreen && ChanGroup == Fav_group) { timerID = (currChan - Fav_base - 1); } if(isFullscreen && Fav_max_channel !== 0) { if(count) { count = 0; osdmain.style.opacity = 0; showDisplay(currChan.toString(), false, 100, 0 ); Change = 0; } osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0; isSetupMenu = 1; mainmenu.style.opacity = 0.8; menu = 10; InitMenu(menu); } break; case KEY_D:// >@ key on old long kpn 1710/1760 remote if (protChn[ChanGroup] !== 1 && ChanGroup !== Fav_group) { AddtoFav(); } break; case "Teletext": if(isFullscreen) { ClearScreen(); isVisible = 1; setVisible(isVisible); } break; case "VolumeMute": VolumeMute(); break; case "VolumeUp": VolumeUp(); break; case "VolumeDown": VolumeDown(); break; case "MediaRewind": if(isFullscreen) { mediaPlayer.play(mediaPlayer.PACE_REWIND); } else { count = 0; Change = 0; defChan[ChanGroup] = currChan; do { do ChanGroup -= 1; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup < 0) { ChanGroup = 9; } } while (!minChan[ChanGroup]); currChan = defChan[ChanGroup]; preview(channels[currChan]); } break; case "MediaForward": if(isFullscreen) { mediaPlayer.play(mediaPlayer.PACE_FASTFORWARD); } else { count = 0; Change = 0; defChan[ChanGroup] = currChan; do{ do ChanGroup += 1; while (protChn[ChanGroup] == 1 && ShowProtectedChannels == 1) if (ChanGroup > 9) { ChanGroup = 0; } } while (!minChan[ChanGroup]); currChan = defChan[ChanGroup]; preview(channels[currChan]); } break; case "MediaPlayPause": if(isFullscreen && PauseOnServer) { if(mediaPlayer.getState() == mediaPlayer.STATE_PLAYING) { isPause = 1; ServerPause(); SetLed(1,1,10); // setTimeout("mediaPlayer.play(0);",5000); mediaPlayer.play(0); break; } if(mediaPlayer.getState() == mediaPlayer.STATE_PAUSED || mediaPlayer.getState() == mediaPlayer.STATE_FASTFORWARDING || mediaPlayer.getState() == mediaPlayer.STATE_REWINDING) { SetLed(1,1,0); mediaPlayer.play(mediaPlayer.PACE_PLAY); break; } } if(TimeShift){ if(mediaPlayer.getState() == mediaPlayer.STATE_PAUSED || mediaPlayer.getState() == mediaPlayer.STATE_FASTFORWARDING || mediaPlayer.getState() == mediaPlayer.STATE_REWINDING) { SetLed(1,1,0); mediaPlayer.play(mediaPlayer.PACE_PLAY); break; } if(mediaPlayer.getState() == mediaPlayer.STATE_PLAYING) { SetLed(1,1,10); mediaPlayer.play(0); break; } } break; case "MediaStop": try { SetLed(1,1,0); if(TimeShift){ mediaPlayer.playFromPosition(mediaPlayer.POSITION_LIVE,mediaPlayer.PACE_PLAY); } } catch(e) { alert(e); } break; case KEY_REC: case KEY_REC2: if(isSchedule == 0) { if(epgactive) { ServerTimer(channels[currChan],EPG[NowNext][6][currChan]); settimer(EPG[NowNext][2][currChan],EPG[NowNext][1][currChan],(EPG[NowNext][3][currChan]*60),2); } else { ServerRecordStart(); } } // if(isFullscreen && !epgactive) { // ServerRecordStart(); // } else if(isSchedule == 0){ // if(NowNext) { // } else { // // make timer for recording // ServerTimer(channels[currChan],EPG[NowNext][6][currChan]); // settimer(EPG[NowNext][2][currChan],EPG[NowNext][1][currChan],(EPG[NowNext][3][currChan]*60),2); // } else { // ServerRecordStart(); // } // } break; case KEY_OPNAMES: case KEY_FILM: case KEY_DVR: if (smartTVplugin) { // jump to recordings menu. if(isFullscreen) { if(count) { count = 0; osdmain.style.opacity = 0; showDisplay(currChan.toString(), false, 100, 0 ); Change = 0; } osdepginfo.style.opacity = 0; osdepginfonext.style.opacity = 0; medialist.style.opacity = 0.9; mainmenu.style.opacity = 0; recPath = "/recordings.xml"; setTimeout("getRecList();LoadMediaSettings();",100); } break; } default: break; } } } function GotoFav(ChanID) { count = 0; Change = 0; prevChan = ""; Fav_key1 = ""; defChan[ChanGroup] = currChan; ChanGroup = Fav_group; currChan = ChanID; play(channels[currChan]); } function AddtoFav() { Fav_max_channel += 1; maxChan[Fav_group] = Fav_base + Fav_max_channel; channelsnames[(Fav_base + Fav_max_channel)] = channelsnames[currChan]; channels[(Fav_base + Fav_max_channel)] = channels[currChan]; is.setObject(("vip.channelsnames." + Fav_max_channel),channelsnames[currChan],is.STORAGE_PERMANENT) is.setObject(("vip.channels." + Fav_max_channel),channels[currChan],is.STORAGE_PERMANENT) is.setObject("vip.fav_max_channel",Fav_max_channel.toString(),is.STORAGE_PERMANENT) settimer(0,channels[currChan],Fav_max_channel ,2); } function Read_Fav() { Fav_max_channel = Number(is.getObject("vip.fav_max_channel")); maxChan[Fav_group] = Fav_base + Fav_max_channel; for (var i=1; i<=Fav_max_channel; i++) { channelsnames[(i+Fav_base)] = is.getObject(("vip.channelsnames." + i)); channels[(i+Fav_base)] = is.getObject(("vip.channels." + i)); } } function Makedigit() { if (TimedChangeID != -1) { clearTimeout(TimedChangeID); TimedChangeID = -1; } prevChan = currChan; Change = (Change*10) + digit; count += 1; osdmain.style.opacity = isFullscreen; OSDchannr(Change); if(isFullscreen) { showDisplay((Change.toString()), false, 100, 0 ); } if (count>channeldigits) { CheckChannel(Change); count = 0; } else { TimedChangeID = setTimeout("TimedChange();",ChangeTime); } if(ChangeOK) { if(isFullscreen) { play(channels[currChan]); } else { preview(channels[currChan]); } ChangeOK = 0; } } function CheckChannel(CheckThis) { // function to check if channel exists CheckThis = baseChn[ChanGroup] + CheckThis; if(channels[CheckThis]) { ChangeOK = 1; currChan = CheckThis; } else { ChangeOK = 0; } if(prevChan == currChan) { ChangeOK = 0 ; } osdmain.style.opacity = 0; if(isFullscreen) { showDisplay(currChan.toString(), false, 100, 0 ); } Change = 0; } function TimedChange() { if (count && ChangeTime) { CheckChannel(Change); count = 0; if(ChangeOK) { if(isFullscreen) { play(channels[currChan]); } else { preview(channels[currChan]); } ChangeOK = 0; } } } function showDisplay(showtxt,colonState,intensity,currentMode) { if(!showClock){ if (Number(showtxt) > 8999 && Number(showtxt) < 10000) { showtxt = "R" + Right(showtxt,3); } if (Number(showtxt) > 9999 && Number(showtxt) < 20000) { showtxt = "F" + Right(showtxt,3); } showtxt = Right(showtxt,4); try { fps.setSegmentDisplayState(toi.statics.ToiFrontPanelServiceSegmentDisplayState.create(showtxt,colonState,intensity,currentMode)); } catch (e) { // Display error, maybe no display... } } } function SetLed(NumLed,color,blinkfreq){ var state = toi.statics.ToiFrontPanelServiceLedState.create(color, blinkfreq); fps.setLedState(NumLed, state); } function showOSD() { if (osdtimeout) { clearTimeout(osdtimeout); } SetOsdInfo(); opacity = 0.8; OSD(opacity); osdtimeout = setTimeout("fadeOut(); osdtimeout = 0;", ShowOsdTime); } function showVolume() { if (osdVolumetimeout) { clearTimeout(osdVolumetimeout); } osdvolume.innerHTML = Lang[1] + " : " + Volume + "% \n\uE007" + (new Array(Volume)).join("\uE008") + (new Array(100 - Volume)).join("\uE009") + "\uE00A"; osdvolume.style.opacity = 1; osdVolumetimeout = setTimeout("osdvolume.style.opacity = 0;", ShowOsdTime); } function OSD(opacity) { osdmain.style.opacity = opacity; } function SetOsdInfo() { OSDchannr(currChan); date_time(); OSDhtml(); return; } function onCacheUpdated() { GetEPG(currChan); if (osdtimeout) { SetOsdInfo(); } } function OSDchannr(channr) { // Show logo's if (experimental) { // osdnr.innerHTML = ""; } osdnr.innerHTML = "" + Right(channr,3) + ""; alert(cssres[css_nr][Set_Res]); } function OSDhtml(){ osdtime.innerHTML = result; if (ShowSource == 1) { osdname.innerHTML = channels[currChan].split("-")[0] + "\uE003" + Left(channelsnames[currChan],30); } else { osdname.innerHTML = Left(channelsnames[currChan],30); } osdepg.innerHTML = "" + EPG[0][7][currChan] + "
\n" + EPG[1][7][currChan] + "
"; osdepginfo.innerHTML = "" + currChan + "\uE003" + channelsnames[currChan] + "
" + AvInfo[currChan] + "
" + EPG[0][7][currChan] + EPG[0][9][currChan] + EPG[0][8][currChan] + "
\n" + EPG[0][4][currChan] + "
\n" + Left(EPG[0][5][currChan],750) + "
"; osdepginfonext.innerHTML = "" + currChan + "\uE003" + channelsnames[currChan] + "
" + EPG[1][7][currChan] + EPG[1][9][currChan] + EPG[1][8][currChan] + "
\n" + EPG[1][4][currChan] + "
\n" + Left(EPG[1][5][currChan],750) + "
"; } function updateOSDtime(timchan) { tijd = EPG[0][2][timchan]; 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); if (EPGminutes > 1440) { EPGminutes = 0; // Duration is >24h, maybe current time isn't right. } var tm = tijd.getMinutes(); var th = tijd.getHours(); th=addzero(th); tm=addzero(tm); EPG[0][7][timchan] = th + ":" + tm + " (" + EPGminutes + " / " + ((EPG[0][3][timchan])-EPGminutes).toFixed(0) + ")" + " " + EPG[0][1][timchan] + " "; if (!EPG[0][2][timchan] || ((EPG[0][3][timchan]-EPGminutes) < 0)) { EPG[0][7][timchan] = " "; } } function settimer(ProgTime,ProgName,ProgDura,SwitchTimer,BackGroundColor,ProgDesc,ProgEvID) { if (!BackGroundColor) { BackGroundColor = color_default;} // 1 - switchonly, 2 - record on server (display info only), 3 - record local if(SwitchTimer == 1) { try { var x = ss.schedule("SwitchOnly","notification", ProgTime , ProgDura); ss.setParameter(x, "Channel", currChan.toString() ); ss.setParameter(x, "Title", ProgName ); ss.setParameter(x, "Info", ProgDesc); ss.setParameter(x, "active", "False"); ss.setParameter(x, "Type", "\uE00C"); //Timer Symbol ss.setParameter(x, "resume", "0"); ss.setParameter(x, "Eventid", ProgEvID); } catch (e) { ProgName = "ERROR" ; BackGroundColor = "color_error"; } } else if(SwitchTimer == 3) { ProgTime -= preRecTime; ProgDura = Number(ProgDura) + (afterRecTime + preRecTime); var y = (new Date().getTime()/1000).toFixed(0); if(ProgTime < y) { ProgDura = ProgDura - (y - ProgTime); ProgTime = y; } try { var x = ss.schedule("RecLocal","record_hd_from_ip", ProgTime , ProgDura); if (x != 0) { ss.setParameter(x, "Channel", currChan.toString() ); ss.setParameter(x, "Title", ProgName ); ss.setParameter(x, "Info", ProgDesc); ss.setParameter(x, "active", "False"); ss.setParameter(x, "Type", "\uE00C"); //Timer Symbol ss.setParameter(x, "resume", "0"); ss.setParameter(x, "Eventid", ProgEvID); } else { ProgName = "ERROR" ; BackGroundColor = "color_error"; } } catch (e) { alert(e); } } if ( ProgTime == 0 && SwitchTimer == 2 && ProgDura !== 0 ) { var x = Lang[3] + ProgDura + ""; } else if ( ProgTime == 0 && SwitchTimer == 2) { var x = ""; } else { tijd = ProgTime; date = new Date(tijd*1000); tijd = date.toUTCString(); tijd = new Date(tijd); var tm = tijd.getMinutes(); var th = tijd.getHours(); th=addzero(th); tm=addzero(tm); var x = Lang[4] + th + ":" + tm + ""; } // switchtimer.style.background = BackGroundColor; switchtimer.innerHTML = "" + Lang[2] + Left(ProgName,30) + "\n" + Lang[3] + channelsnames[currChan] + "\n" + x + ""; setOSDtimer(); switchtimer.style.opacity = 1; setTimeout("switchtimer.style.opacity = 0;", ShowSetTimer); } function setOSDtimer() { // Only for type "SwitchOnly" var today = new Date; today = today / 1000; var x = ss.getBookingIds("SwitchOnly", today, 0) if (x.length !== 0) { tijd = ss.getNextStartTime("SwitchOnly"); date = new Date(tijd*1000); tijd = date.toUTCString(); tijd = new Date(tijd); var tm = tijd.getMinutes(); var th = tijd.getHours(); th=addzero(th); tm=addzero(tm); osdtimer.innerHTML = "
" + th + ":" + tm + "
"; SetLed(0,2,1); switchicon = "\uE00C"; osdca.innerHTML = CAicon + switchicon + RECicon; } else { osdtimer.innerHTML = " "; SetLed(0,0,0); switchicon = '\uE003'; osdca.innerHTML = CAicon + switchicon + RECicon; } } // Left n characters of str function Left(str, n){ if (n <= 0) return ""; else if (n > String(str).length) return str; else return String(str).substring(0,n); } // Right n characters of str 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.5; 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(); m = date.getMinutes(); h=addzero(h); m=addzero(m); result = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m; return; } function date_time_rec() { date = new Date(Number(recStrt[currMed])*1000); year = date.getFullYear(); month = date.getMonth(); month = addzero(month + 1); d = date.getDate(); d = addzero(d); day = date.getDay(); h = date.getHours(); m = date.getMinutes(); h = addzero(h); m = addzero(m); if (year!==1970) { result = ' ' + d + '-' + month + '-' + year + ' ' + h + ':' + m; } else { result = ""; } return; } // EPG Section function GetEPG(epgchan) { EPG[0][7][epgchan] = ""; EPGShortnow = ""; EPGExtnow = ""; EPG[1][7][epgchan] = ""; EPGShortnext = ""; EPGExtnext = ""; SI=""; try { eitCache.clearServices(); StreamInfo(epgchan); eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]); eitCache.addService(eitService); event = eitCache.getPresentEvent(eitService); if(event.freeCaMode){ CAicon = "\uE00D"; } else { CAicon = Radioicon; } osdca.innerHTML = CAicon + switchicon + RECicon; if (event.name) { events = eitCache.getEvents(eitService, (Math.round(new Date().getTime()/1000.0)), 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] = ""; EPG[0][6][epgchan] = event.eventId; if (event.parentalRating) { EPG[0][8][epgchan] = "\n\n\n" + Lang[0] + "\n\n\n" ; setTimeout("ShowTimerInfo();",100); } if (menu == 7) { // Show more info Current SearchTimer osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; osdepginfo.innerHTML = "
\n\n\n" + Lang[0] + ""; DeleteTimers(); setTimeout("LoadTimersServer();InitMenu(menu);",100); } else if (menu == 10) { channels[(timerID + Fav_base + 1)]=""; channelsnames[(timerID + Fav_base + 1)]=""; is.setObject(("vip.channelsnames." + (timerID + 1)),"",is.STORAGE_PERMANENT) is.setObject(("vip.channels." + (timerID + 1)),"",is.STORAGE_PERMANENT) if (Fav_max_channel == (timerID + 1)) { Fav_max_channel = timerID; maxTimers = Fav_max_channel; is.setObject("vip.fav_max_channel",Fav_max_channel.toString(),is.STORAGE_PERMANENT) timerID -= 1; if (timerID < 0) {timerID = 0;} } setTimeout("InitMenu(menu);",100); } break; case "Green": if (menu == 1) { Set_Res = Set_Res + 1; if (Set_Res > (VideoOutputModes.length-1)) { Set_Res = 0;} // save the info is.setObject("vip.resolution",Set_Res.toString(),is.STORAGE_PERMANENT) VideoOutput(); InitMenu(menu); } else if (menu == 2 && mediaRecorder) { var x = ss.getBookingIds("*", 0, 0); if (ss.getBooking(x[timerID-1]).category == "RecLocal") { ss.reschedule(x[timerID-1],"SwitchOnly","notification",ss.getBooking(x[timerID-1]).start,ss.getBooking(x[timerID-1]).duration) } else if (ss.getBooking(x[timerID-1]).category == "SwitchOnly") { ss.reschedule(x[timerID-1],"RecLocal","record_hd_from_ip",ss.getBooking(x[timerID-1]).start,ss.getBooking(x[timerID-1]).duration) } LoadTimers(); InitMenu(menu); } else if (menu == 5 && smartTVplugin) { activate_timers(timerID); InitMenu(menu); } else if (menu == 10) { //move up if (timerID !== 0) { x = timerID + Fav_base + 1; x1 = channels[x]; y1 = channelsnames[x]; x2 = channels[(x - 1)]; y2 = channelsnames[(x - 1)]; is.setObject(("vip.channelsnames." + (timerID + 1)),y2,is.STORAGE_PERMANENT) is.setObject(("vip.channels." + (timerID + 1)),x2,is.STORAGE_PERMANENT) is.setObject(("vip.channelsnames." + timerID),y1,is.STORAGE_PERMANENT) is.setObject(("vip.channels." + timerID),x1,is.STORAGE_PERMANENT) channelsnames[x] = y2; channels[x] = x2; channelsnames[(x - 1)] = y1; channels[(x - 1)] = x1; timerID -= 1; setTimeout("InitMenu(menu);",100); } } break; case "Yellow": if (menu == MainMenu) { menu = 4; // INFO menu InitMenu(menu); } else if (menu == 1) { menu = 9; // INFO2 menu InitMenu(menu); } else if (menu == 10) { //move down if (timerID !== (maxTimers - 1)) { x = timerID + Fav_base + 1; x1 = channels[x]; y1 = channelsnames[x]; x2 = channels[(x + 1)]; y2 = channelsnames[(x + 1)]; is.setObject(("vip.channelsnames." + (timerID + 1)),y2,is.STORAGE_PERMANENT) is.setObject(("vip.channels." + (timerID + 1)),x2,is.STORAGE_PERMANENT) is.setObject(("vip.channelsnames." + (timerID + 2)),y1,is.STORAGE_PERMANENT) is.setObject(("vip.channels." + (timerID + 2)),x1,is.STORAGE_PERMANENT) channelsnames[x] = y2; channels[x] = x2; channelsnames[(x + 1)] = y1; channels[(x + 1)] = x1; timerID += 1; setTimeout("InitMenu(menu);",100); } } break; case "Blue": if (menu == 0) { RestartPortal(); } else if (menu == 1) { css_nr += 1; if (css_nr > (cssfile.length - 1)) { css_nr = 0;} loadcss(cssfile[css_nr]); alert(css_nr); alert(cssfile[css_nr]); is.setObject("vip.css_nr",css_nr.toString(),is.STORAGE_PERMANENT) setTimeout("InitMenu(menu);",100); } else if (menu == 2) { // Show Info local timer/ recording var x = ss.getBookingIds("*", 0, 0); var y = Number(ss.getParameter(x[timerID-1], "Channel")); osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; osdepginfo.innerHTML = "
" + ss.getParameter(x[timerID-1], "Title") + "\n " + "\n" + y + " - " + channelsnames[y] + "(" + ss.getParameter(x[timerID-1], "Eventid") + ")" + "\n
" + ss.getParameter(x[timerID-1], "Info") + "
" ; } else if (menu == 5) { // Show EPG info Timer osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; osdepginfo.innerHTML = "\n\n\n" + Lang[0] + "\n\n\n" ; setTimeout("ShowTimerInfo();",100); } else if (menu == 7) { // Show info SearchTimers osdepginfo.innerHTML = SearchTimer[timerID] ; osdepginfo.style.opacity = 1 - osdepginfo.style.opacity; } else if (menu == 10) { if (protChn[ChanGroup] !== 1 && ChanGroup !== Fav_group) { AddtoFav(); } } break; case "MediaRewind": if (menu == 1) { if (experimental) { // mute output 0 (analog out), keep output 3 'decoder output' unmuted aos.setVolume(0, 0); } } break; case "MediaForward": if (menu == 1) { if (experimental) { aos.setVolume(0, 100); } } break; case "MediaStop": if (menu == 1) { //set sleep timer. SleepTimer += 15; if (SleepTimerID != -1) { clearTimeout(SleepTimerID); SleepTimerID = -1; } if (SleepTimer > 90) { SleepTimer = 0; } else { SleepTimerID = setTimeout("SleepTimer = 0;toi.platformService.setStandby(true);", (SleepTimer * 60 * 1000)); } } else if (menu == 2) { var x = ss.getBookingIds("*", 0, 0); var y = Number((new Date().getTime()/1000).toFixed(0)) + 2; //stop current recording after 2 sec. ss.reschedule(x[timerID-1],"RecLocal","record_hd_from_ip", y , 0) ss.setParameter(x[timerID-1], "Type", "\uE01C"); LoadTimers(); } InitMenu(menu); break; case "Teletext": break; case "TV": break; case KEY_1: if (menu == MainMenu) { menu = 1; } else if (menu == 1) { ShowSubs = 1 - ShowSubs; videoplane.subtitles = Boolean(ShowSubs); // Enable subtitles or Disable subtitles is.setObject("vip.showsubs",ShowSubs.toString(),is.STORAGE_PERMANENT); } else if (menu == 8) { SetGroup(1); } InitMenu(menu); break; case KEY_2: if (menu == MainMenu) { LoadTimers(); timerID = 1; //if (timer.length !== 0) { do { timerID += 1; } while (!timer[timerID] && (timerID < timer.length)) } menu = 2; } if (menu == 1) { if(subsmode == 0 ) { is.setObject("cfg.media.subtitling.modepriority","Teletext,DVB",is.STORAGE_PERMANENT); subsmode = 1; } else { is.setObject("cfg.media.subtitling.modepriority","DVB,Teletext",is.STORAGE_PERMANENT); subsmode = 0; } } if (menu == 8) { SetGroup(2); } InitMenu(menu); break; case KEY_3: if (menu == 0) { isSetupMenu = 0; medialist.style.opacity = 0.9; mainmenu.style.opacity = 0; setTimeout("getSchedule(currChan);LoadMediaSettings();",100); } else if (menu == 1) { if (audio < (lang_prio.length -1)) { audio += 1} else { audio = 0 } is.setObject("vip.languagepriority",audio.toString(),is.STORAGE_PERMANENT); is.setObject("cfg.media.audio.languagepriority",lang_prio[audio],is.STORAGE_PERMANENT); InitMenu(menu); } else if (menu == 8) { SetGroup(3); InitMenu(menu); } break; case KEY_4: if (menu == 0) { isSetupMenu = 0; medialist.style.opacity = 0.9; mainmenu.style.opacity = 0; recPath = "/recordings.xml"; setTimeout("getRecList();LoadMediaSettings();",100); } else if (menu == 1) { //Init here. menu = 0 don't need init! menu = 8; InitMenu(menu); } else if (menu == 8) { SetGroup(4); InitMenu(menu); } break; case KEY_5: if (menu == MainMenu && (Restfulapiplugin || smartTVplugin)) { mainmenu.innerHTML = "
\n\n\n" + Lang[0] + ""; timerID = 0; menu = 5; setTimeout("LoadTimersServer();InitMenu(menu);",200); } if (menu == 1) { var x = is.getObject("vip.serveraddress"); x = Number(x); if (x < (server_ip_array.length -1)) { x += 1} else { x = 0 } is.setObject("vip.serveraddress",x.toString(),is.STORAGE_PERMANENT); server_ip = server_ip_array[x]; for (var i=0;i<10;i++) { if (ServerAdres[i] !== "FullURL" && ServerAdres[i] !== "MultiCast") {ServerAdres[i] = server_ip + StreamPort;} } InitMenu(menu); } if (menu == 8) { SetGroup(5); InitMenu(menu); } break; case KEY_6: if (menu == 0 && Restfulapiplugin) { isSetupMenu = 0; medialist.style.opacity = 0.9; mainmenu.style.opacity = 0; setTimeout("getServerSchedule();LoadMediaSettings();",100); } if (menu == 1) { if(showClock == 0 ) { showDisplay("", true, 80, 1 ); showClock = 1; } else if(showClock == 1 ) { showClock = 0; showDisplay(currChan.toString(), false, 100, 0 ); } InitMenu(menu); } if (menu == 8) { SetGroup(6); InitMenu(menu); } break; case KEY_7: if (menu == 0 && smartTVplugin) { isSetupMenu = 0; medialist.style.opacity = 0.9; mainmenu.style.opacity = 0; recPath = "/media.xml"; setTimeout("getRecList();LoadMediaSettings();",100); } if (menu == 1) { ShowProtectedChannels = 1 - ShowProtectedChannels; if (ProtectID) { clearTimeout(ProtectID); } if (ShowProtectedChannels == 0 && ProtectTimeOut !== 0 ) { ProtectID = setTimeout("ShowProtectedChannels = 1; if (protChn[ChanGroup] == 1) {ChanGroup = 0; currChan = defChan[ChanGroup]; play(currChan); }",ProtectTimeOut); } if (ShowProtectedChannels == 1 && protChn[ChanGroup] == 1) { ChanGroup = 0; currChan = defChan[ChanGroup]; play(currChan); } isSetupMenu = 0; mainmenu.style.opacity = 0; } if (menu == 8) { SetGroup(7); InitMenu(menu); } break; case KEY_8: if (menu == MainMenu && Restfulapiplugin) { mainmenu.innerHTML = "
\n\n\n" + Lang[0] + ""; timerID = 0; menu = 7; setTimeout("LoadSearchTimersServer();InitMenu(menu);",200); } if (menu == 1) { if(SwitchGuide == 0 ) { SwitchGuide = 1; } else if(SwitchGuide == 1 ) { SwitchGuide = 0; } InitMenu(menu); } if (menu == 8) { SetGroup(8); InitMenu(menu); } break; case KEY_9: if ((menu == 0 || menu == 3) && ShowMPD) { menu = 3; playMPD(server_ip + MPDAddress); } else if (menu == 1) { if (lang_nr < (OSDLang.length -1)) { lang_nr += 1} else { lang_nr = 0 } is.setObject("vip.OSDlanguage",lang_nr.toString(),is.STORAGE_PERMANENT); loadjs(langfile[lang_nr]); setTimeout("InitMenu(menu);",100); } else if (menu == 8) { SetGroup(9); } InitMenu(menu); break; case KEY_0: if (menu !== MainMenu && menu !== 8 ) { if (menu == 3 ) { isFullscreen = 0; play(channels[currChan]); isFullscreen = 1; MPDListener = 0;} menu = MainMenu; InitMenu(menu); } else if (menu == 8) { SetGroup(0); InitMenu(menu); } else if (menu == 0) { timerID = 0; maxTimers = Fav_max_channel; menu = 10; if (ChanGroup !== Fav_group) { Fav_key1 = Lang[86]; } InitMenu(menu); } break; case "VolumeMute": VolumeMute(); break; case "VolumeUp": VolumeUp(); break; case "VolumeDown": VolumeDown(); break; case KEY_A:// |> key on old long kpn 1710/1760 remote break; case KEY_B:// hh key on old long kpn 1710/1760 remote break; case KEY_C:// @ key on old long kpn 1710/1760 remote if (menu == 10 ) { isSetupMenu = 0; mainmenu.style.opacity = 0; osdepginfo.style.opacity = 0; } break; case KEY_D:// >@ key on old long kpn 1710/1760 remote break; default: break; } } function InitMenu(menu) { // 0 = Main Menu // 1 = settings menu // 2 = Timers menu // 3 = MPD Menu // 4 = INFO Menu // 5 = Timers from Server // 6 = Main Menu (when watching recording) // 7 = SearchTimers from Server // 8 = ChannelGroups enable/disable // 9 = INFO2 menu // 10 = Favorite Edit menu osdepginfo.style.opacity = 0; if(menu == 0) { // Main Menu MainMenu = 0; var htmltext = "
1 -" + Lang[10] + "\n 2 -" + Lang[7] + "\n 3 -" + Lang[11]; htmltext += "\n 4 -" + Lang[12]; if (Restfulapiplugin) { htmltext += "\n 5 -" + Lang[13]; } else { htmltext += "" + "\n 5 -" + Lang[13] + "" ; } if (Restfulapiplugin) { htmltext += "\n 6 -" + Lang[14]; } else { htmltext += "" + "\n 6 -" + Lang[14] + "" ; } if (smartTVplugin) { htmltext += "\n 7 -" + Lang[15]; } else { htmltext += "" + "\n 7 -" + Lang[15] + "" ; } if (Restfulapiplugin) { htmltext += "\n 8 -" + Lang[16]; } else { htmltext += "" + "\n 8 -" + Lang[16] + "" ; } if (ShowMPD) { htmltext += "\n 9 -" + Lang[17]; } else { htmltext += "" + "\n 9 -" + Lang[17] + "" ; } htmltext += "\n 0 - " + Lang[83] + "\n\n \u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + "\u25CF -" + Lang[35] + " \u25CF -" + Lang[18] + ""; mainmenu.innerHTML = htmltext; } if(menu == 6) { // Main Menu when watching recording MainMenu = 6; mainmenu.innerHTML = "
1 -" + Lang[10] + "\n 2 -" + Lang[7] + "\n\n\n 5 -" + Lang[13] + "\n\n\n 8 -" + Lang[16] + "\n\n\n\n \u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + "\u25CF -" + Lang[35] + " \u25CF -" + Lang[19] + ""; } if(menu == 1) { // settings menu var htmltext = "
1 - "; if (ShowSubs) { htmltext += "\uE017"; } else { htmltext += "\uE016"; } htmltext += Lang[20] + ": " + (is.getObject("cfg.media.subtitling.languagepriority")); if (subs_prio_dyn.length > 0) { htmltext += " (" + (subs_dyn + 1 ) + "/" + subs_prio_dyn.length + ") "; } htmltext += "\n 2 - \uE003" + Lang[22] + (is.getObject("cfg.media.subtitling.modepriority")); htmltext += "\n 3 - \uE003" + Lang[24] + (is.getObject("cfg.media.audio.languagepriority")); htmltext += "\n 4 - " + Lang[82] + "\n 5 - VDR : " + server_ip + "\n 6 - "; if (showClock) { htmltext += "\uE017"; } else { htmltext += "\uE016"; } htmltext += Lang[25] + "\n 7 - "; if (ShowProtectedChannels) { htmltext += "\uE017"; } else { htmltext += "\uE016"; } htmltext += Lang[26] + "\n 8 - "; if (SwitchGuide) { htmltext += "\uE017"; } else { htmltext += "\uE016"; } htmltext += Lang[27] + "\n 9 -" + Lang[23] + OSDLang[lang_nr] + "\n \u25AA -" + Lang[29]; if (SleepTimer) { htmltext += SleepTimer + Lang[30]; } else { htmltext += Lang[31]; } htmltext += "\n\n \u25CF -" + Lang[20]; htmltext += "\u25CF - " + VideoOutputModes_txt[VideoOutputModes[Set_Res]] + " "; htmltext += "\u25CF -" + Lang[35]; htmltext += "\u25CF - " + Left(cssfile[css_nr].split(".")[0],8) +""; // htmltext += "\n 0 -" + Lang[9] +""; mainmenu.innerHTML = htmltext; } if(menu == 2) { // Timers menu booking = ""; var x = timerID - 2; var y = ss.getBookingIds("*", 0, 0); if (y.length !== 0) { for (var i=0;i<10;i++) { if (timer.length !== 0) { do { x += 1; } while (!timer[x] && (x < timer.length)) } if (i == 0) { booking += ""; } else if (i == 1) { booking += ""; } if (timer.length > x) { try { if (ss.getParameter(y[x], "assetURI")) { // test if there is a file with the timer if so more info is added if (Number(ss.getParameter(y[x], "resume")) == 0 ) { booking += "\uE003\uE010"; } else { booking += "\uE003\uE003"; } } } catch(e) { booking += "\uE003\uE003"; } booking += ss.getParameter(y[x], "Type"); booking += timer[x]; } else { booking += "\n"; } } } if (mediaRecorder) { var x = NN[3]; } else { var x = Lang[19]; } mainmenu.innerHTML = "
\n 0 -" + Lang[9] + "\n" + booking + " \u25CF -" + Lang[48] + "\u25CF - " + x + " \u25CF -" + Lang[19] + "\u25CF - " + NN[5] + ""; } if(menu == 3) { // MPD Menu mainmenu.innerHTML = "
" + Lang[34] + "\n 0 -" + Lang[9] + ""; } if(menu == 4) { // INFO Menu var htmltext = "
"; try { htmltext += "\n Product name: " + is.getObject("config.productdisplayname"); htmltext += "\n Build date : " + is.getObject("config.build.date"); htmltext += "\n\n IP address : " + is.getObject("config.ipaddress"); var x = is.getObject("cfg.ip.eth0.mode"); if (x == "DHCP") { htmltext += "\n \uE003\uE017 "; } else { htmltext += "\n \uE003\uE016 "; } htmltext += "DHCP"; var x = is.getObject("var.capabilities.dvr"); if (x !== "FALSE") { htmltext += "\n \uE003\uE017 "; } else { htmltext += "\n \uE003\uE016 "; } htmltext += "DVR \n"; htmltext += "\n VDR address : " + server_ip; htmltext += "\n Vip Client\uE003\uE003\uE003: " + Version; htmltext += "\n Channel list\uE003: " + Chan_Ver; } catch(e) { alert("Error : " + e); } htmltext += "\n\n 0 -" + Lang[9] + ""; mainmenu.innerHTML = htmltext; } if(menu == 5) { // Timers from Server if (timerOK) { // booking = "
\n" + booking + "\n \u25CF -" + Lang[48] + "\u25CF -" + Lang[49] + "\u25CF -" + Lang[19] + " \u25CF -" + Lang[28] + ""; } else { mainmenu.innerHTML = "
\n" + booking + "\n \u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + " \u25CF -" + Lang[28] + ""; } } } if(menu == 7) { // SearchTimers from Server if (timerOK) { // booking = "
\n" + booking + "\n \u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + "\u25CF -" + Lang[19] + " \u25CF -" + Lang[28] + ""; } } if(menu == 8) { // ChannelGroups enable/disable var htmltext = "
\n";
for (var i=0;i<10;i++) {
if (maxChan[i]) { } else { htmltext += ""; }
htmltext += "\uE003" + i + "\uE003-\uE003";
if (is.getObject(("vip.group." + i)) == "1") { htmltext += "\uE017"; } else { htmltext += "\uE016"; }
htmltext += "\uE003" + Lang[81] + i + "\n";
if (maxChan[i]) { } else { htmltext += ""; }
}
htmltext += "
";
mainmenu.innerHTML = htmltext;
}
if(menu == 9) { // INFO2 Menu
var htmltext = ""; try { if (fullupdate !== 0) { htmltext += "\n \uE017 "; } else { htmltext += "\n \uE016 "; } htmltext += "Full EPG Update "; experimental = Number(is.getObject("vip.testing")); if (experimental) { htmltext += "\n \uE017 "; } else { htmltext += "\n \uE016 "; } htmltext += "Experimental"; if (Number(is.getObject("vip.testing2"))) { htmltext += "\n \uE017 "; } else { htmltext += "\n \uE016 "; } htmltext += "Experimental 2 (Info box 'not in package')"; if (Restfulapiplugin) { htmltext += "\n \uE017 "; } else { htmltext += "\n \uE016 "; } htmltext += "Has Restfulapiplugin" if (smartTVplugin) { htmltext += "\n \uE017 "; } else { htmltext += "\n \uE016 "; } htmltext += "Has smartTVplugin" htmltext += "\n gettimers from"; if (get_timer == 1) { htmltext += " smarttvweb "; } else { htmltext += " restfulapi "; } htmltext += "\n getmarks from"; if (get_marks == 1) { htmltext += " smarttvweb "; } else { htmltext += " restfulapi "; } htmltext += "\n getrecordings from"; if (get_recordings == 1) { htmltext += " smarttvweb "; } else if (get_recordings == 0) { htmltext += " restfulapi "; } else { htmltext += " streamdev "; } htmltext += "\n EPGMode : " if (EPGMode) { htmltext += "Full EPG"; } else { htmltext += "Now/Next Only"; } } catch(e) { alert("Error : " + e); } htmltext += "\n\n 0 -" + Lang[9] + ""; mainmenu.innerHTML = htmltext; } if(menu == 10) { // Favorite edit Menu var htmltext = "
\n" htmltext += ""; var x = timerID; for (var i=0;i<10;i++) { if (maxTimers !== 0) { x += 1;} if (maxTimers >= x && x !== 0) { htmltext += " \u0003\u0003 " + x + " \u0003\u0003 " + channelsnames[(x + Fav_base)] + " \u0003\u0003\u0003 \n"; } else { htmltext += "\n"; } if (i == 0) { htmltext += ""; } } htmltext += "\n \u25CF -" + Lang[87]; htmltext += "\u25CF -" if (timerID == 0) { htmltext += Lang[19] } else { htmltext += Lang[84] } //no move up htmltext += "\u25CF -" if (timerID == (maxTimers - 1) || x == 0) { htmltext += Lang[19] } else { htmltext += Lang[85] } //no move down htmltext += "\u25CF -" + Fav_key1 + ""; mainmenu.innerHTML = htmltext; } } // end of initmenu function SetGroup(isgroup) { is.setObject("vip.group." + isgroup,(1 - is.getObject("vip.group." + isgroup)).toString(),is.STORAGE_PERMANENT); if (is.getObject("vip.group." + isgroup) == "0") { minChan[isgroup] = "";} else {minChan[isgroup] = minchan[isgroup];} } function LoadTimers() { timer.length = 0; var booking = ""; var x = ss.getBookingIds("*", 0, 0); for (var i=0;i
\n " + Lang[36] + ": \n " + server_ip + ""; } } function DeleteTimers() { if (get_timer==1) { try { xmlhttp=new XMLHttpRequest(); // // SmartTVWeb // xmlhttp.open("GET",(server_ip + recServ + "/deleteTimer?guid=" + timersChan[timerID] + "&dy=" + timersDay[timerID] // + "&st=" + timersStrt[timerID] + "&sp=" + timersStop[timerID] + "&" + new Date().getTime()),false); xmlhttp.open("GET",(server_ip + recServ + "/deleteTimer?index=" + timersID[timerID] + "&" + new Date().getTime()),false); xmlhttp.send(); } catch(e) { alert("Deleting Timers problem: " + e); } } } function activate_timers(){ if (get_timer==1) { // (De)activate timers. try { xmlhttp=new XMLHttpRequest(); if (timersFlag[timerID] == "0") { xmlhttp.open("GET",(server_ip + recServ + "/activateTimer?index=" + timersID[timerID] + "&activate=true&" + new Date().getTime()),false); } else { xmlhttp.open("GET",(server_ip + recServ + "/activateTimer?index=" + timersID[timerID] + "&activate=false&" + new Date().getTime()),false); } xmlhttp.send(); if (timersFlag[timerID] == "0") { timers[timerID] = timers[timerID].substr(0, 1) + "\uE00C" + timers[timerID].substr(2); timersFlag[timerID] = "1" } else { timers[timerID] = timers[timerID].substr(0, 1) + "\uE003" + timers[timerID].substr(2); timersFlag[timerID] = "0" } } catch(e) { alert("(De)Activate Timers problem: " + e); } } } function ShowTimerInfo() { if (osdepginfo.style.opacity == 1) { //Like Show EPG Info //setup some dummy vars var info1 = ""; var info2 = ""; var info3 = ""; var info4=""; if (timersEvnt[timerID] > 0) { try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + RestFulAPI + "/events/" + timersChan[timerID] + "/" + timersEvnt[timerID] + ".xml?" + new Date().getTime()),false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("event"); // x[0].getElementsByTagName("param")[1].childNodes[0].nodeValue --> Title // x[0].getElementsByTagName("param")[2].childNodes[0].nodeValue --> Short_text // x[0].getElementsByTagName("param")[3].childNodes[0].nodeValue --> Description // x[0].getElementsByTagName("param")[5].childNodes[0].nodeValue --> ChannelsName info1 = x[0].getElementsByTagName("param")[1].childNodes[0].nodeValue; info2 = x[0].getElementsByTagName("param")[5].childNodes[0].nodeValue; info4 = x[0].getElementsByTagName("param")[3].childNodes[0].nodeValue; info3 = x[0].getElementsByTagName("param")[2].childNodes[0].nodeValue + "
"; } catch(e) { alert("Get EPG problem: " + e); } } else { info3 = Lang[37]; } osdepginfo.innerHTML = "
" + Left(info1,60) + "\n " + timersDays[timerID] + " " + timersStrt[timerID] + " - " + timersStop[timerID] + "\n" + info2 + "\n
" + info3 + Left(info4,750) + "
" ; } } function LoadSearchTimersServer() { try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + RestFulAPI + "/searchtimers.xml?" + new Date().getTime()),false); //"),false); // xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("searchtimer"); maxTimers = x.length; searchtimers.length = 0; // clear timers[i] tries to clear crap if current x.length < previous x.length if (x.length > 0) { for (var i=0;i"; if ((x[i].getElementsByTagName("use_as_searchtimer")[0].childNodes[0].nodeValue) == 0) { SearchTimer[i] += "\uE003\uE016\uE003" + Lang[40] + "\n"; } else { SearchTimer[i] += "\uE003\uE017\uE003" + Lang[40] + "\n"; } SearchTimer[i] = SearchTimer[i] + "\uE003\uE003\uE003Mode :\uE003" + (searchmode[x[i].getElementsByTagName("mode")[0].childNodes[0].nodeValue]) + "\n"; if ((x[i].getElementsByTagName("use_time")[0].childNodes[0].nodeValue) == 1) { SearchTimer[i] += "\uE003\uE017\uE003" + Lang[41] + "\uE003" + x[i].getElementsByTagName("start_time")[0].childNodes[0].nodeValue + "\uE003-\uE003" + x[i].getElementsByTagName("stop_time")[0].childNodes[0].nodeValue + "\n"; } else { SearchTimer[i] += "\uE003\uE016\uE003" + Lang[41] + "\uE003" + "\n"; } if ((x[i].getElementsByTagName("use_dayofweek")[0].childNodes[0].nodeValue) == 0) { SearchTimer[i] += "\uE003\uE016\uE003" + Lang[47] + "\uE003" + "\n"; } else { //bit is used for dayofweek. var dowx = x[i].getElementsByTagName("dayofweek")[0].childNodes[0].nodeValue; var dow = ""; if (dowx > 0) { var y = 1;} else { var y = 0;} dowx = Math.abs(dowx); for (var dowi=0; dowi<7; dowi++) { var mask = 1 << dowi; if ((dowx & mask) != 0) { dow += days[(dowi+y)] + "\uE003";} } SearchTimer[i] += "\uE003\uE017\uE003" + Lang[47] + "\uE003:\uE003" + dow + "\n"; } if ((x[i].getElementsByTagName("use_channel")[0].childNodes[0].nodeValue) == 0) { SearchTimer[i] += "\uE003\uE016\uE003" + Lang[42] + "\uE003" + "\n"; } else { SearchTimer[i] += "\uE003\uE017\uE003" + Lang[42] + "\uE003:\uE003" + searchchan[(x[i].getElementsByTagName("use_channel")[0].childNodes[0].nodeValue)] + "\uE003" + x[i].getElementsByTagName("channels")[0].childNodes[0].nodeValue + "\n"; } SearchTimer[i] += "\n"; // End of Extended INFO searchtimers[i] += searchtimersSearch[i] + "\uE003\uE003\n" ; } timerOK = 1; } } catch(e) { timerOK = 0; alert("Get SearchTimers problem: " + e); mainmenu.innerHTML = "
\n " + Lang[43] + ": \n " + server_ip + RestFulAPI + ""; } } function ShowSearchTimerInfo() { // info about a search timer. //Like Show EPG Info //setup some dummy vars var info1 = ""; var info2 = ""; try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + RestFulAPI + "/searchtimers/search/" + searchtimersID[timerID] + ".xml?" + new Date().getTime()),false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("event"); var maxinfo = x.length; if (maxinfo > 15) { maxinfo = 15;} for (var i=0;i
" + info1 + "" ; } // End of Menu section // MPD Section function MPD(ev) { // alert("Media player state changed: " + ev); // alert("Media player state changed: state=" + ev.state + ", reason=" + ev.reason + ", code=" + ev.code); // alert("Media player error :" + mediaPlayer.getError().details); if (MPDListener == 0) { if (ev.state == 6 ) { if (ev.reason == "CommandClose" && ErrorAgain == 0) { setTimeout("mediaPlayer.open(URL);mediaPlayer.play(1000);GetEPG(currChan);ExtraStuff();",500); ErrorAgain = 1; } else { ErrorAgain = 0; alert("Media player state changed: state=" + ev.state + ", reason=" + ev.reason + ", code=" + ev.code); showDisplay("ERRR", false, 100, 0 ); if (experimental) { settimer(0,ev.reason,0,2,color_error); } else { settimer(0,Lang[67],0,2,color_error); } } } } else { if ( ev.state == 6 && ev.reason == "HostUnreachable" ) { showDisplay("ERRR", false, 100, 0 ); mainmenu.innerHTML = "
" + Lang[34] + "\n 0 -" + Lang[9] + "\n 9 -" + Lang[61] + "\n\n"; } else if ( ev.state == 2 ) { // && ev.reason == "PositionEnd" ) { showDisplay("STOP", false, 100, 0 ); mainmenu.innerHTML = "" + Lang[62] + ": \n" + server_ip + MPDAddress + "
" + Lang[34] + "\n 0 -" + Lang[9] + "\n 9 -" + Lang[63] + "\n\n"; } else if ( ev.state == 3 && ev.reason == "CommandPlay" ) { showDisplay("MPD", false, 100, 0 ); mainmenu.innerHTML = "" + Lang[64] + ": \n" + server_ip + MPDAddress + "\n" + Lang[65] + "
" + Lang[34] + "\n 0 -" + Lang[9] + "\n\n\n"; } else { showDisplay("ERRR", false, 100, 0 ); mainmenu.innerHTML = "" + Lang[64] + ": \n" + server_ip + MPDAddress + "
" + Lang[34] + "\n 0 -" + Lang[9] + "\n 9 -" + Lang[63] + "\n\n"; } } } function playMPD(uri) { try { if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { mediaPlayer.close(); } MPDListener = 1; mediaPlayer.open(uri); mediaPlayer.play(1000); } catch (e) { alert("Failed opening recording: " + e); return; } } // End of MPD Section // Media Player Section function LoadMediaSettings() { subgroup = 0; subsubgroup = 0; isMediaMenu = 1; isFullscreen = 0; if (getRecOK !== 2) { showDisplay("STOP", false, 100, 0 ); } currMed = 0; if (getRecOK) { showMediaList();} mediaPlayer.addEventListener(mediaPlayer.ON_POSITION_CHANGED, ShowMediaOSD); mediaPlayer.addEventListener(mediaPlayer.ON_STATE_CHANGED, onStateChanged); } function UnloadMediaSettings() { mediaPlayer.removeEventListener(mediaPlayer.ON_POSITION_CHANGED, ShowMediaOSD); mediaPlayer.removeEventListener(mediaPlayer.ON_STATE_CHANGED, onStateChanged); medialist.style.opacity = 0; osdmedia.style.opacity = 0; osdmediatime.style.opacity = 0; osdepginfo.style.opacity = 0; medialist.innerHTML = "Error : " + ev.state + "\n" + Lang[66] + ": " + ev.reason + "
\n\n\n" + Lang[37] + ""; } } catch(e) { alert("Get Recordings problem: " + e); getRecOK = 0; medialist.innerHTML = "
\n\n\n" + Lang[39] + "
" + Lang[44] +"\n" + Lang[45] + "\n\n " + Left(recTitl[currMed],30) + ""; // Recording Name DelisOK = 1 } catch(e) { alert("Delete Recordings problem: " + e); } } function DelRec2() { if (get_recordings == 1) { try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST",(server_ip + recServ + "/deleteRecording.xml?id=" + recGUID[currMed] ),false); xmlhttp.send(); recList[currMed] = ""; recGroup[currMed] = -1; recProt[currMed] = 0; } catch(e) { alert("Delete Recordings problem: " + e); } } else if (get_recordings == 0) { // try { // xmlhttp=new XMLHttpRequest(); // xmlhttp.open("DELETE",(server_ip + RestFulAPI + "/recordings/" + recGUID[currMed] ),true); // xmlhttp.send(); // recList[currMed] = ""; // recGroup[currMed] = -1; // recProt[currMed] = 0; // } catch(e) { // alert("Delete Recordings problem: " + e); // } // } } function MakeRecList() { //old style list var x = ""; var xx = ""; for (var i=0;i
"; if (subgroup) { htmlstring = "" + Group_Header[Number(recGroup[currMed])] + "
"; if (MaxInGroup < 14){ MaxMed = MaxInGroup; } else {MaxMed = 14; } } if (!subgroup) { for(var i=0; i<=nrMedia; i++) { if (recList[i]) { MaxMed += 1;} } } } else { if (nrMedia < 14) {MaxMed = nrMedia; } else {MaxMed = 14; } var htmlstring = "" + Lang[11] + channelsnames[currChan] + "
"; } if (MaxMed > 14) { MaxMed = 14; } if (MaxMed < 0 ) { MaxMed = 0; } for(var i=currMed; i<=currMed + MaxMed; i++) { if (listMed>=nrMedia) { listMed= -1; } if (listMed<-1) { listMed=nrMedia - 1; } // if (listMed>nrMedia) { listMed= -1; } do { listMed += 1; } while (!recList[listMed] && (listMed<=nrMedia)); if (listMed > nrMedia) { recList[listMed] = ""; } if (recList[listMed]) { //Solves empty string at the end. if ( listMed == currMed) { htmlstring += ""; } htmlstring += "\uE003" + Left(recList[listMed],60) + "\uE003\uE003\n"; if ( listMed == currMed) { htmlstring += "";} } } medialist.innerHTML = htmlstring + "
"; //ShowInfo(); } function getServerSchedule() { try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + RestFulAPI + "/events/" + channels[currChan] + ".xml?timespan=" + serverEPGdays + "&" + new Date().getTime()),false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("event"); nrMedia = x.length - 1; for (var i=0;i// 1 516 // 2 Thuis // 3 // 4 Soapserie (BE). // 5 S19.2E-53-1105-4016 // 6 BVN (S) // 7 1365608700 // 8 1500 // 9 78 // 10 7 // 11 0 // 12 0 // 13 0 // 14 // // // 15 // 16 // 17 // 18 false // 19 false // 20 // */ recTitl[i] = x[i].getElementsByTagName("param")[1].childNodes[0].nodeValue; try { recDesc[i] = x[i].getElementsByTagName("param")[3].childNodes[0].nodeValue; } catch(e) { recDesc[i] = ""; } recDura[i] = x[i].getElementsByTagName("param")[7].childNodes[0].nodeValue; recStrt[i] = x[i].getElementsByTagName("param")[6].childNodes[0].nodeValue; recChan[i] = currChan + "\uE003-\uE003" + channelsnames[currChan]; recGUID[i] = x[i].getElementsByTagName("param")[0].childNodes[0].nodeValue; date = new Date(Number(recStrt[i])*1000); year = date.getFullYear(); month = date.getMonth(); d = date.getDate(); day = date.getDay(); h = date.getHours(); m = date.getMinutes(); h=addzero(h); m=addzero(m); recList[i] = ''+days[day]+' '+d+' '+months[month]+' '+year+' '+h+':'+m + " " + recTitl[i]; } getRecOK = 2; } catch(e) { alert("Get EPG problem: " + e); getRecOK = 0; medialist.innerHTML = " " + Lang[50] + "
"; } } function getSchedule(schchan){ SI = ""; recTitl.length = 0; nrMedia = 0; try { StreamInfo(schchan); eitService = toi.statics.ToiDvbEitCacheServiceItem.create(SI[1],SI[2],SI[3]); eitCache.addService(eitService); event = eitCache.getPresentEvent(eitService); events = eitCache.getEvents(eitService, (Math.round(new Date().getTime()/1000.0)), 2000000000); if (event.name) { if (events.more) { var t = eitCache.getEvents(eitService, (Math.round(new Date().getTime()/1000.0)), 2000000000); events.infoSequence.concat(t.infoSequence); events.more = t.more; } nrMedia = events.infoSequence.length - 1; for (var i = 0; i < events.infoSequence.length; i++) { // Double info or scrollbar twice on the screen if nrMedia < 14 while ((i > 0) && (events.infoSequence[i].eventId == events.infoSequence[(i-1)].eventId) && (nrMedia > 14)) { recList[i] = ""; i += 1; } recTitl[i] = events.infoSequence[i].name; recDesc[i] = eitCache.getExtendedEventInfo(eitService,events.infoSequence[i].eventId).extendedInfo; if (recDesc[i] == "" ) { recDesc[i] = eitCache.getExtendedEventInfo(eitService,events.infoSequence[i].eventId).shortInfo;} recDura[i] = events.infoSequence[i].duration; recStrt[i] = events.infoSequence[i].time; recChan[i] = schchan + "\uE003-\uE003" + channelsnames[schchan]; recGUID[i] = events.infoSequence[i].eventId; date = new Date(Number(recStrt[i])*1000); year = date.getFullYear(); month = date.getMonth(); d = date.getDate(); day = date.getDay(); h = date.getHours(); m = date.getMinutes(); h=addzero(h); m=addzero(m); recList[i] = ' ' + days[day] + ' ' + d + ' ' + months[month] + ' ' + year + " " + h + ":" + m + " (" + (recDura[i]/60).toFixed(0) + ") " + Left(recTitl[i],30); } getRecOK = 2; } else { getRecOK = 0; medialist.innerHTML = "\n\n\n" + Lang[51] + "" + Lang[11] + "
"; if (experimental) { medialist.innerHTML += ""; } } } catch(e) { getRecOK = 0; medialist.innerHTML = "\n\n\n" + Lang[52] + "" + Lang[11] + "
"; } } function incMed(step) { currMed += step; if (currMed > nrMedia ) { currMed = 0; } } function decMed(step) { currMed -= step; if (currMed < 0) { currMed = nrMedia; } } function playRec(uri,posrec) { try { if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { mediaPlayer.close(); } if (osdepginfo.style.opacity == 1) {osdepginfo.style.opacity = 0;} mediaPlayer.open(uri); if (posrec) { mediaPlayer.playFromPosition(posrec,1000); } else { mediaPlayer.play(1000); } showDisplay("PLAY", false, 100, 0 ); } catch (e) { alert("Failed opening recording: " + e); return; } } function pauseRec(uri) { try { if (mediaPlayer.getState() != mediaPlayer.STATE_IDLE) { mediaPlayer.close(); } if (osdepginfo.style.opacity == 1) {osdepginfo.style.opacity = 0;} mediaPlayer.open(uri); mediaPlayer.play(0); showDisplay("PAUS", false, 100, 0 ); } catch (e) { alert("Failed opening recording: " + e); return; } } function createNewAsset() { try { assetId = ams.createAsset(ams.ASSET_PVR); // alert("Created " + assetId); } catch(e) { alert("Couldn't create asset: " + e); } } function onStateChanged(ev) { // alert("Media player state changed: state=" + ev.state + ", reason=" + ev.reason + ", code=" + ev.code); if ( ( ev.state == 6 && ev.reason == "HostUnreachable" ) || ( ev.state == 2 && ev.reason == "PositionEnd" )) { BackToTV(); } } // Start recording/ timeshift function ServerRecordStart() { //Record current program try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + recServ + "/addTimer?guid=" + channels[currChan] + "&" + new Date().getTime() ),false); xmlhttp.send(); if (xmlhttp.responseXML == null) { //settimer(EPG[NowNext][2][currChan],Lang[55],0,2); //Timer not set, try direct recording ServerRecord(); settimer(0,Lang[57],0,2); } else { settimer(EPG[NowNext][2][currChan],EPG[NowNext][1][currChan],0,2); } } catch(e) { alert("Sending Timers to server problem: " + e); settimer(0,Lang[55],0,2,color_error); } } function ServerRecord() { //Instant record on server try { xmlhttp=new XMLHttpRequest(); //switch server to current channel xmlhttp.open("POST",(server_ip + RestFulAPI + "/remote/switch/" + channels[currChan]),true); xmlhttp.send(); //start recording setTimeout("xmlhttp.open('POST',(server_ip + RestFulAPI + '/remote/Record'),false);xmlhttp.send();",5000); } catch(e) { alert("Sending key to server problem: " + e); settimer(0,Lang[55],0,2,color_error); } //end of function } function ServerPause() { //Instant pause on server ServerRecord(); settimer(EPG[NowNext][2][currChan],Lang[70],0,2); setTimeout("getPauseFile();",6000); //end of function } function getPauseFile() { try { xmlhttp=new XMLHttpRequest(); xmlhttp.open("GET",(server_ip + RestFulAPI + "/recordings.xml?" + new Date().getTime()),false); xmlhttp.send(); xmlDoc=xmlhttp.responseXML; var x=xmlDoc.getElementsByTagName("recording"); nrMedia = x.length - 1; for (var i=0;i\n\n\n" + Lang[53] + "100) {pos2 = 100;} // in case of viewing while still recording. if (pos>recMark[posMark] && recMark.length-1>posMark) { posMark += 1;} pos2 = ((pos2 * 140) / 100).toFixed(0); // make it 40% bigger var pos5 = "\uE007" + new Array(pos2 - 1).join("\uE008") + new Array(140 - pos2).join("\uE009") + "\uE00A" var pos4 = ""; var pos6 = pos5; var fontc = color_progress1; var x = 0; for (var i=0; i " + color_progress2) { fontc = "" + color_progress1; } else { fontc = "" + color_progress2;} x = pos3; pos6 = Right(pos5,140 - pos3); } pos4 += "" + color_progress1 + pos6 + ""; var x = (Number(recDura[currMed])/60).toFixed(0); if (pos/60 > x) { x = (pos/60).toFixed(0);} date_time(); osdmediatime.innerHTML = result; date_time_rec(); osdmedia.innerHTML = " \n " + (pos/60).toFixed(0) + " / " + x + " " + Left(recTitl[currMed],40) + "\n " + pos4 + "\n " + result + ""; } else if ( get_recordings == 2) { var pos = position + (mediaPlayer.getPosition()/1000); date_time(); osdmediatime.innerHTML = result; osdmedia.innerHTML = "\n " + (pos/60).toFixed(0) + " \n " + Left(recTitl[currMed],40) + "\n \n " + recStrt[currMed] + ""; } } function ShowInfo() { //Like Show EPG Info if ( medialist.style.opacity == 0 ) { updateStreamInfo(currMed);} else { AvInfo[currMed] = "";} if (get_recordings == 2) { result = recStrt[currMed] osdepginfo.innerHTML = "" + Left(recTitl[currMed],60) + "\n
" + AvInfo[currMed] + "
" + result + "\n " + "???" + Lang[54] + "
Sorry STREAMDEV-plugin : " + Lang[37] + "
"; } else { date = new Date(Number(recStrt[currMed])*1000); year = date.getFullYear(); month = date.getMonth(); d = date.getDate(); day = date.getDay(); h = date.getHours(); m = date.getMinutes(); h = addzero(h); m = addzero(m); result = '' + days[day] + ' ' + d + ' ' + months[month] + ' ' + year + ' ' + h + ':' + m; if (year!==1970) { osdepginfo.innerHTML = "" + Left(recTitl[currMed],60) + "
" + AvInfo[currMed] + "
" + result + "\n " + (recDura[currMed] / 60).toFixed(0) + Lang[54] + "\n " + recChan[currMed] + " " + "\n
" + Left(recDesc[currMed],750) + "
"; } else { //info for non-vdr recordings osdepginfo.innerHTML = "" + Left(recTitl[currMed],60) + "\n
" + AvInfo[currMed] + " " + "\n \n
"; } } } function onScheduledStart(event) { // event is of type ToiSchedulerServiceBooking, see docs var timertype = event.booking.category; if ( timertype == "SwitchOnly") { ClearScreen(); isFullscreen = 1; FullScreen(); isVisible = 0; setVisible(isVisible); //Switch from recordings if (isMediaMenu) { if (medialist.style.opacity == 0) {setResume();} // No mediamenu on screen so set resume. UnloadMediaSettings(); } prevChan = currChan; currChan = Number(ss.getParameter(event.booking.id, "Channel")); ChanGroup = Number(Left((currChan / 1000),1)); // check if Group isn't protected if ((protChn[ChanGroup] == 1) && (ShowProtectedChannels == 1)) { currChan = prevChan; ChanGroup = Number(Left((currChan / 1000),1)); } // switch only if not already on that channel. if (currChan !== prevChan) { play(channels[currChan]); } ss.remove(event.booking.id); setOSDtimer(); } else { try { createNewAsset(); var recChannr = Number(ss.getParameter(event.booking.id, "Channel")); var recGroup = Number(Left((recChannr / 1000),1)); var recChan = 0; if (ServerAdres[recGroup] == "MultiCast" ) { SI=channels[recChannr].split("-"); recChan = SI[4]; } else { recChan = ServerAdres[recGroup] + channels[recChannr]; } mediaRecorder.open(recChan, assetId); var propList = new Array(ams.PROPERTY_SYSTEM_PLAYBACKURI); var properties = ams.getProperties(assetId, propList); var assetURI = properties[0].value; // save the assetId in the booking ss.setParameter(event.booking.id, "assetURI", assetURI); ss.setParameter(event.booking.id, "assetId", assetId); ss.setParameter(event.booking.id, "active", "True"); ss.setParameter(event.booking.id, "Type", "\uE00B"); mediaRecorder.record(); // alert("Recording to " + assetURI); } catch (e) { alert(e); } } } function onScheduledStop(event) { var timertype = event.booking.category; if ( timertype == "SwitchOnly") { ss.remove(event.booking.id); setOSDtimer(); } else { try { ss.setParameter(event.booking.id, "active", "False"); ss.setParameter(event.booking.id, "Type", "\uE01C"); mediaRecorder.close(); } catch (e) { alert(e); } } } function ClearScreen() { isSchedule = 0; schedule.style.opacity = 0; isSetupMenu = 0; epgactive = 0; osdepginfonext.style.opacity = 0; osdepginfo.style.opacity = 0; mainmenu.style.opacity = 0; }