1 // store all objects here
5 // parsing values from xml-element
6 //debug('init EPGList'+xml);
8 this.xmlitems = xml.getElementsByTagName("e2eventlist").item(0).getElementsByTagName("e2event");
9 } catch (e) { debug("EPGList parsing Error");}
11 this.getArray = function(sortbytime){
12 debug("sort EPGList by time "+sortbytime);
13 if (sortbytime = true){
14 var sort1 = new Array();
15 for(var i=0;i<this.xmlitems.length;i++){
16 var xv = new EPGEvent(this.xmlitems.item(i));
17 sort1.push(new Array(xv.startTime,xv));
19 sort1.sort(this.sortFunction);
20 var sort2 = new Array();
21 for(var i=0;i<sort1.length;i++){
22 sort2.push(sort1[i][1]);
26 var listxy = new Array();
27 for (var i=0;i<this.xmlitems.length;i++){
28 var xv = new EPGEvent(this.xmlitems.item(i));
34 this.sortFunction = function(a,b){
40 //START class EPGEvent
41 function EPGEvent(xml){
42 // parsing values from xml-element
44 this.eventID = xml.getElementsByTagName('e2eventid').item(0).firstChild.data;
45 this.startTime = xml.getElementsByTagName('e2eventstart').item(0).firstChild.data;
46 this.duration = xml.getElementsByTagName('e2eventduration').item(0).firstChild.data;
47 this.title = xml.getElementsByTagName('e2eventtitle').item(0).firstChild.data;
48 this.serviceRef = xml.getElementsByTagName('e2eventservicereference').item(0).firstChild.data;
49 this.serviceName = xml.getElementsByTagName('e2eventservicename').item(0).firstChild.data;
51 //debug("EPGEvent parsing Error");
54 this.description = xml.getElementsByTagName('e2eventdescription').item(0).firstChild.data;
55 } catch (e) { this.description= 'N/A'; }
58 this.descriptionE = xml.getElementsByTagName('e2eventdescriptionextended').item(0).firstChild.data;
59 } catch (e) { this.descriptionE = 'N/A'; }
62 this.getEventId = function ()
66 this.getTimeStart = function ()
68 var date = new Date(parseInt(this.startTime)*1000);
71 this.getTimeStartString = function ()
73 var h = this.getTimeStart().getHours();
74 var m = this.getTimeStart().getMinutes();
80 this.getTimeDay = function ()
82 var Wochentag = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
83 var wday = Wochentag[this.getTimeStart().getDay()];
84 var day = this.getTimeStart().getDate();
85 var month = this.getTimeStart().getMonth()+1;
86 var year = this.getTimeStart().getFullYear();
88 return wday+". "+day+"."+month+"."+year;
90 this.getTimeBegin = function(){
91 return this.timebegin;
93 this.getTimeEnd = function ()
95 var date = new Date((parseInt(this.startTime)+parseInt(this.duration))*1000);
98 this.getTimeEndString = function ()
100 var h = this.getTimeEnd().getHours();
101 var m = this.getTimeEnd().getMinutes();
107 this.getDuration = function ()
109 return new Date(parseInt(this.duration)*1000);
111 this.getTitle = function ()
115 this.getDescription = function ()
117 return this.description;
119 this.getDescriptionExtended = function ()
121 return this.descriptionE;
123 this.getServiceReference = function ()
125 return encodeURIComponent(this.serviceRef);
127 this.getServiceName = function ()
129 return this.serviceName.replace(" "," ");
134 //START class Service
135 function ServiceReference(xml){
136 // parsing values from xml-element
137 //debug('init ServiceReference'+xml);
139 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
140 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
143 //debug("Service parsing Error "+e);
146 this.getServiceReference = function(){
147 return encodeURIComponent(this.servicereference);
150 this.getServiceName = function(){
151 return this.servicename.replace('"', '"');
157 //START class ServiceList
158 function ServiceList(xml){
159 // parsing values from xml-element
160 //debug('init ServiceList'+xml);
162 this.xmlitems = xml.getElementsByTagName("e2servicelist").item(0).getElementsByTagName("e2service");
164 //debug("Service parsing Error");
166 this.getArray = function(){
167 var listxy = new Array();
168 for (var i=0;i<this.xmlitems.length;i++){
169 var xv = new ServiceReference(this.xmlitems.item(i));
175 //END class ServiceList
178 //START class MovieList
179 function MovieList(xml){
180 // parsing values from xml-element
181 debug('init MovieList'+xml);
183 this.xmlitems = xml.getElementsByTagName("e2movielist").item(0).getElementsByTagName("e2movie");
185 debug("MovieList parsing Error");
187 this.getArray = function(){
188 var listxy = new Array();
189 for(var i=0;i<this.xmlitems.length;i++){
190 //debug("parsing movie "+i+" of "+this.xmlitems.length);
191 var xv = new Movie(this.xmlitems.item(i));
197 //END class MovieList
201 // parsing values from xml-element
202 //debug('init Movie');
204 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
206 this.servicereference = "N/A";
209 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
211 this.servicename = "N/A";
214 this.title = xml.getElementsByTagName('e2title').item(0).firstChild.data;
219 this.descriptionextended = xml.getElementsByTagName('e2descriptionextended').item(0).firstChild.data;
221 this.descriptionextended = "N/A";
224 this.description = xml.getElementsByTagName('e2description').item(0).firstChild.data;
226 this.description = "N/A";
229 this.tags = xml.getElementsByTagName('e2tags').item(0).firstChild.data;
231 this.tags = "no tags"; // no whitespaces... tags will be splittet later
234 this.filename = xml.getElementsByTagName('e2filename').item(0).firstChild.data;
236 this.filename = "n/a";
238 this.getServiceReference = function(){
239 return encodeURIComponent(this.servicereference);
241 this.getServiceName = function(){
242 return this.servicename.replace('"', '"');
244 this.getTitle = function(){
247 this.getDescription = function(){
248 return this.description;
250 this.getDescriptionExtended = function(){
251 return this.descriptionextended;
253 this.getTags = function(){
254 return this.tags.split(" ");
256 this.getFilename = function(){
257 return encodeURIComponent(this.filename);
263 //START class TimerList
264 function TimerList(xml){
265 // parsing values from xml-element
266 debug('init TimerList'+xml);
268 this.xmlitems = xml.getElementsByTagName("e2timerlist").item(0).getElementsByTagName("e2timer");
270 debug("TimerList parsing Error");
272 this.getArray = function(){
273 var listxy = new Array();
274 for(var i=0;i<this.xmlitems.length;i++){
275 //debug("parsing timer "+i+" of "+this.xmlitems.length);
276 var xv = new Timer(this.xmlitems.item(i));
282 //END class TimerList
286 // parsing values from xml-element
287 //debug('init Timer');
289 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
291 this.servicereference = "N/A";
294 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
296 this.servicename = "N/A";
299 this.eventid = xml.getElementsByTagName('e2eit').item(0).firstChild.data;
301 this.eventid = "N/A";
304 this.name = xml.getElementsByTagName('e2name').item(0).firstChild.data;
309 this.description = xml.getElementsByTagName('e2description').item(0).firstChild.data;
311 this.description = "N/A";
314 this.descriptionextended = xml.getElementsByTagName('e2descriptionextended').item(0).firstChild.data;
316 this.descriptionextended = "N/A";
319 this.disabled = xml.getElementsByTagName('e2disabled').item(0).firstChild.data;
324 this.timebegin = xml.getElementsByTagName('e2timebegin').item(0).firstChild.data;
326 this.timebegin = "N/A";
329 this.timeend = xml.getElementsByTagName('e2timeend').item(0).firstChild.data;
331 this.timeend = "N/A";
334 this.duration = xml.getElementsByTagName('e2duration').item(0).firstChild.data;
339 this.startprepare = xml.getElementsByTagName('e2startprepare').item(0).firstChild.data;
341 this.startprepare = "N/A";
344 this.justplay = xml.getElementsByTagName('e2justplay').item(0).firstChild.data;
349 this.afterevent = xml.getElementsByTagName('e2afterevent').item(0).firstChild.data;
351 this.afterevent = "0";
354 this.logentries = xml.getElementsByTagName('e2logentries').item(0).firstChild.data;
356 this.logentries = "N/A";
359 this.tfilename = xml.getElementsByTagName('e2filename').item(0).firstChild.data;
361 this.tfilename = "N/A";
364 this.backoff = xml.getElementsByTagName('e2backoff').item(0).firstChild.data;
366 this.backoff = "N/A";
369 this.nextactivation = xml.getElementsByTagName('e2nextactivation').item(0).firstChild.data;
371 this.nextactivation = "N/A";
374 this.firsttryprepare = xml.getElementsByTagName('e2firsttryprepare').item(0).firstChild.data;
376 this.firsttryprepare = "N/A";
379 this.state = xml.getElementsByTagName('e2state').item(0).firstChild.data;
384 this.repeated = xml.getElementsByTagName('e2repeated').item(0).firstChild.data;
389 this.dontsave = xml.getElementsByTagName('e2dontsave').item(0).firstChild.data;
391 this.dontsave = "N/A";
394 this.cancled = xml.getElementsByTagName('e2cancled').item(0).firstChild.data;
396 this.cancled = "N/A";
399 this.getServiceReference = function(){
400 return encodeURIComponent(this.servicereference);
402 this.getServiceName = function(){
403 return this.servicename.replace('"', '"');
405 this.getEventID = function(){
408 this.getName = function(){
411 this.getDescription = function(){
412 return this.description;
414 this.getDescriptionExtended = function(){
415 return this.descriptionextended;
417 this.getDisabled = function(){
418 return this.disabled;
420 this.getTimeBegin = function(){
421 return this.timebegin;
423 this.getTimeEnd = function(){
426 this.getDuration = function(){
427 return parseInt(this.duration);
429 this.getStartPrepare = function(){
430 return this.startprepare;
432 this.getJustplay = function(){
433 return this.justplay;
435 this.getAfterevent = function(){
436 return this.afterevent;
438 this.getLogentries = function(){
439 return this.logentries;
441 this.getFilename = function(){
442 return this.tfilename;
444 this.getBackoff = function(){
447 this.getNextActivation = function(){
448 return this.nextactivation;
450 this.getFirsttryprepare = function(){
451 return this.firsttryprepare;
453 this.getState = function(){
456 this.getRepeated = function(){
457 return this.repeated;
459 this.getDontSave = function(){
460 return this.dontsave;
462 this.isCancled = function(){
466 // START TimerAddResult
467 function TimerAddResult(xml){
468 // parsing values from xml-element
469 debug('init TimerAddResult'+xml);
471 this.xmlitems = xml.getElementsByTagName("e2timeraddresult").item(0);
473 debug("TimerAddResult parsing e2timeraddresult"+e);
476 this.state = this.xmlitems.getElementsByTagName("e2state").item(0).firstChild.data;
478 debug("TimerAddResult parsing e2state"+e);
481 this.statetext = this.xmlitems.getElementsByTagName("e2statetext").item(0).firstChild.data;
483 debug("TimerAddResult parsing e2statetext"+e);
486 this.getState = function(){
487 if(this.state == 'True'){
493 this.getStateText = function(){
494 return this.statetext;
497 // END TimerAddResult
499 //START class Settings
500 function Settings(xml){
501 // parsing values from xml-element
502 //debug('init ServiceList'+xml);
504 this.xmlitems = xml.getElementsByTagName("e2settings").item(0).getElementsByTagName("e2setting");
505 debug(this.xmlitems);
507 //debug("Service parsing Error");
509 this.getArray = function(){
510 var listxy = new Array();
511 for (var i=0;i<this.xmlitems.length;i++){
512 var xv = new Setting(this.xmlitems.item(i));
520 //START class Setting
521 function Setting(xml){
522 // parsing values from xml-element
523 //debug('init ServiceReference'+xml);
525 this.settingvalue = xml.getElementsByTagName('e2settingvalue').item(0).firstChild.data;
526 this.settingname = xml.getElementsByTagName('e2settingname').item(0).firstChild.data;
529 //debug("Service parsing Error "+e);
532 this.getSettingValue = function(){
533 return this.settingvalue;
536 this.getSettingName = function(){
537 return this.settingname;