2 // store all objects here
6 // parsing values from xml-element
7 //debug('init EPGList'+xml);
9 this.xmlitems = xml.getElementsByTagName("e2eventlist").item(0).getElementsByTagName("e2event");
10 } catch (e) { debug("EPGList parsing Error");}
12 this.getArray = function(sortbytime){
13 debug("sort EPGList by time "+sortbytime);
14 if (sortbytime = true){
15 var sort1 = new Array();
16 for(var i=0;i<this.xmlitems.length;i++){
17 var xv = new EPGEvent(this.xmlitems.item(i));
18 sort1.push(new Array(xv.startTime,xv));
20 sort1.sort(this.sortFunction);
21 var sort2 = new Array();
22 for(var i=0;i<sort1.length;i++){
23 sort2.push(sort1[i][1]);
27 var listxy = new Array();
28 for (var i=0;i<this.xmlitems.length;i++){
29 var xv = new EPGEvent(this.xmlitems.item(i));
35 this.sortFunction = function(a,b){
41 //START class EPGEvent
42 function EPGEvent(xml){
43 // parsing values from xml-element
45 this.eventID = xml.getElementsByTagName('e2eventid').item(0).firstChild.data;
46 this.startTime = xml.getElementsByTagName('e2eventstart').item(0).firstChild.data;
47 this.duration = xml.getElementsByTagName('e2eventduration').item(0).firstChild.data;
48 this.title = xml.getElementsByTagName('e2eventtitle').item(0).firstChild.data;
49 this.serviceRef = xml.getElementsByTagName('e2eventservicereference').item(0).firstChild.data;
50 this.serviceName = xml.getElementsByTagName('e2eventservicename').item(0).firstChild.data;
51 this.fileName = xml.getElementsByTagName('e2filename').item(0).firstChild.data;
53 //debug("EPGEvent parsing Error");
56 this.description = xml.getElementsByTagName('e2eventdescription').item(0).firstChild.data;
57 } catch (e) { this.description= 'N/A'; }
60 this.descriptionE = xml.getElementsByTagName('e2eventdescriptionextended').item(0).firstChild.data;
61 } catch (e) { this.descriptionE = 'N/A'; }
63 this.getFilename = function ()
67 this.getEventId = function ()
71 this.getTimeStart = function ()
73 var date = new Date(parseInt(this.startTime)*1000);
76 this.getTimeStartString = function ()
78 var h = this.getTimeStart().getHours();
79 var m = this.getTimeStart().getMinutes();
85 this.getTimeDay = function ()
87 var Wochentag = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
88 var wday = Wochentag[this.getTimeStart().getDay()];
89 var day = this.getTimeStart().getDate();
90 var month = this.getTimeStart().getMonth()+1;
91 var year = this.getTimeStart().getFullYear();
93 return wday+". "+day+"."+month+"."+year;
95 this.getTimeBegin = function(){
96 return this.getTimeStart().getTime()/1000
98 this.getTimeEnd = function ()
100 var date = new Date((parseInt(this.startTime)+parseInt(this.duration))*1000);
101 return date.getTime()/1000
103 this.getTimeEndString = function ()
105 var date = new Date((parseInt(this.startTime)+parseInt(this.duration))*1000);
106 var h = date.getHours();
107 var m = date.getMinutes();
113 this.getDuration = function ()
115 return new Date(parseInt(this.duration)*1000);
117 this.getTitle = function ()
121 this.getDescription = function ()
123 return this.description;
125 this.getDescriptionExtended = function ()
127 return this.descriptionE;
129 this.getServiceReference = function ()
131 return encodeURIComponent(this.serviceRef);
133 this.getServiceName = function ()
135 return this.serviceName.replace(" "," ");
140 //START class Service
141 function ServiceReference(xml){
142 // parsing values from xml-element
143 //debug('init ServiceReference'+xml);
145 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
146 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
148 //debug("Service parsing Error "+e);
151 this.getServiceReference = function(){
152 return encodeURIComponent(this.servicereference);
154 this.getClearServiceReference = function(){
155 return this.servicereference;
158 this.getServiceName = function(){
159 return this.servicename.replace('"', '"');
161 this.setServiceReference = function(toInsert){
162 this.servicereference = toInsert;
165 this.setServiceName = function(toInsert){
166 this.servicename = toInsert.replace('"', '"');
171 //START class ServiceList
172 function ServiceList(xml){
173 // parsing values from xml-element
174 //debug('init ServiceList'+xml);
176 this.xmlitems = xml.getElementsByTagName("e2servicelist").item(0).getElementsByTagName("e2service");
178 //debug("Service parsing Error");
180 this.getArray = function(){
181 var listxy = new Array();
183 for (var i=0;i<this.xmlitems.length;i++){
184 var xv = new ServiceReference(this.xmlitems.item(i));
192 //END class ServiceList
194 //START class MovieList
195 function MovieList(xml){
196 // parsing values from xml-element
197 debug('init MovieList'+xml);
199 this.xmlitems = xml.getElementsByTagName("e2movielist").item(0).getElementsByTagName("e2movie");
201 debug("MovieList parsing Error");
203 this.getArray = function(){
204 var listxy = new Array();
205 for(var i=0;i<this.xmlitems.length;i++){
206 //debug("parsing movie "+i+" of "+this.xmlitems.length);
207 var xv = new Movie(this.xmlitems.item(i));
213 //END class MovieList
217 // parsing values from xml-element
218 //debug('init Movie');
220 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
222 this.servicereference = "N/A";
225 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
227 this.servicename = "N/A";
230 this.title = xml.getElementsByTagName('e2title').item(0).firstChild.data;
235 this.descriptionextended = xml.getElementsByTagName('e2descriptionextended').item(0).firstChild.data;
237 this.descriptionextended = "N/A";
240 this.description = xml.getElementsByTagName('e2description').item(0).firstChild.data;
242 this.description = "N/A";
245 this.tags = xml.getElementsByTagName('e2tags').item(0).firstChild.data;
247 this.tags = "no tags"; // no whitespaces... tags will be splittet later
250 this.filename = xml.getElementsByTagName('e2filename').item(0).firstChild.data;
252 this.filename = "n/a";
255 this.filesize = xml.getElementsByTagName('e2filesize').item(0).firstChild.data;
260 this.startTime = xml.getElementsByTagName('e2time').item(0).firstChild.data;
262 this.startTime = "0";
265 this.length = xml.getElementsByTagName('e2length').item(0).firstChild.data;
273 this.getLength = function ()
277 this.getTimeStart = function ()
279 var date = new Date(parseInt(this.startTime)*1000);
282 this.getTimeStartString = function ()
284 var h = this.getTimeStart().getHours();
285 var m = this.getTimeStart().getMinutes();
291 this.getTimeDay = function ()
293 var Wochentag = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
294 var wday = Wochentag[this.getTimeStart().getDay()];
295 var day = this.getTimeStart().getDate();
296 var month = this.getTimeStart().getMonth()+1;
297 var year = this.getTimeStart().getFullYear();
299 return wday+". "+day+"."+month+"."+year;
302 this.getServiceReference = function(){
303 return encodeURIComponent(this.servicereference);
305 this.getServiceName = function(){
306 return this.servicename.replace('"', '"');
308 this.getTitle = function(){
311 this.getDescription = function(){
312 return this.description;
314 this.getDescriptionExtended = function(){
315 return this.descriptionextended;
317 this.getTags = function(){
318 return this.tags.split(" ");
320 this.getFilename = function(){
321 return encodeURIComponent(this.filename);
324 this.getFilesizeMB = function(){
325 return Math.round((parseInt(this.filesize)/1024)/1024)+"MB";
331 //START class TimerList
332 function TimerList(xml){
333 // parsing values from xml-element
335 this.xmlitems = xml.getElementsByTagName("e2timerlist").item(0).getElementsByTagName("e2timer");
337 debug("TimerList parsing Error");
339 this.getArray = function(){
340 var listxy = new Array();
341 for(var i=0;i<this.xmlitems.length;i++){
342 //debug("parsing timer "+i+" of "+this.xmlitems.length);
343 var xv = new Timer(this.xmlitems.item(i));
349 //END class TimerList
353 // parsing values from xml-element
354 //debug('init Timer');
356 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
358 this.servicereference = "N/A";
361 this.servicename = xml.getElementsByTagName('e2servicename').item(0).firstChild.data;
363 this.servicename = "N/A";
366 this.eventid = xml.getElementsByTagName('e2eit').item(0).firstChild.data;
368 this.eventid = "N/A";
371 this.name = xml.getElementsByTagName('e2name').item(0).firstChild.data;
376 this.description = xml.getElementsByTagName('e2description').item(0).firstChild.data;
378 this.description = "N/A";
381 this.descriptionextended = xml.getElementsByTagName('e2descriptionextended').item(0).firstChild.data;
383 this.descriptionextended = "N/A";
386 this.disabled = xml.getElementsByTagName('e2disabled').item(0).firstChild.data;
391 this.timebegin = xml.getElementsByTagName('e2timebegin').item(0).firstChild.data;
393 this.timebegin = "N/A";
396 this.timeend = xml.getElementsByTagName('e2timeend').item(0).firstChild.data;
398 this.timeend = "N/A";
401 this.duration = xml.getElementsByTagName('e2duration').item(0).firstChild.data;
406 this.startprepare = xml.getElementsByTagName('e2startprepare').item(0).firstChild.data;
408 this.startprepare = "N/A";
411 this.justplay = xml.getElementsByTagName('e2justplay').item(0).firstChild.data;
416 this.afterevent = xml.getElementsByTagName('e2afterevent').item(0).firstChild.data;
418 this.afterevent = "0";
421 this.logentries = xml.getElementsByTagName('e2logentries').item(0).firstChild.data;
423 this.logentries = "N/A";
426 this.tfilename = xml.getElementsByTagName('e2filename').item(0).firstChild.data;
428 this.tfilename = "N/A";
431 this.backoff = xml.getElementsByTagName('e2backoff').item(0).firstChild.data;
433 this.backoff = "N/A";
436 this.nextactivation = xml.getElementsByTagName('e2nextactivation').item(0).firstChild.data;
438 this.nextactivation = "N/A";
441 this.firsttryprepare = xml.getElementsByTagName('e2firsttryprepare').item(0).firstChild.data;
443 this.firsttryprepare = "N/A";
446 this.state = xml.getElementsByTagName('e2state').item(0).firstChild.data;
451 this.repeated = xml.getElementsByTagName('e2repeated').item(0).firstChild.data;
456 this.dontsave = xml.getElementsByTagName('e2dontsave').item(0).firstChild.data;
458 this.dontsave = "N/A";
461 this.cancled = xml.getElementsByTagName('e2cancled').item(0).firstChild.data;
463 this.cancled = "N/A";
466 this.color = xml.getElementsByTagName('e2color').item(0).firstChild.data;
471 this.toggledisabled = xml.getElementsByTagName('e2toggledisabled').item(0).firstChild.data;
473 this.toggledisabled = "N/A";
476 this.toggledisabledimg = xml.getElementsByTagName('e2toggledisabledimg').item(0).firstChild.data;
478 this.toggledisabledimg = "N/A";
481 this.getColor = function(){
484 this.getToggleDisabled = function(){
485 return this.toggledisabled;
487 this.getToggleDisabledIMG = function(){
488 return this.toggledisabledimg;
491 this.getServiceReference = function(){
492 return encodeURIComponent(this.servicereference);
494 this.getServiceName = function(){
495 return this.servicename.replace('"', '"');
497 this.getEventID = function(){
500 this.getName = function(){
503 this.getDescription = function(){
504 return this.description;
506 this.getDescriptionExtended = function(){
507 return this.descriptionextended;
509 this.getDisabled = function(){
510 return this.disabled;
512 this.getTimeBegin = function(){
513 return this.timebegin;
515 this.getTimeEnd = function(){
518 this.getDuration = function(){
519 return parseInt(this.duration);
521 this.getStartPrepare = function(){
522 return this.startprepare;
524 this.getJustplay = function(){
525 return this.justplay;
527 this.getAfterevent = function(){
528 return this.afterevent;
530 this.getLogentries = function(){
531 return this.logentries;
533 this.getFilename = function(){
534 return this.tfilename;
536 this.getBackoff = function(){
539 this.getNextActivation = function(){
540 return this.nextactivation;
542 this.getFirsttryprepare = function(){
543 return this.firsttryprepare;
545 this.getState = function(){
548 this.getRepeated = function(){
549 return this.repeated;
551 this.getDontSave = function(){
552 return this.dontsave;
554 this.isCancled = function(){
558 // START SimpleXMLResult ehemals TimerAddResult
559 function SimpleXMLResult(xml){
560 // parsing values from xml-element
561 debug('init SimpleXMLResult'+xml);
563 this.xmlitems = xml.getElementsByTagName("e2simplexmlresult").item(0);
564 debug(xml.getElementsByTagName("e2simplexmlresult").length);
566 debug("SimpleXMLResult parsing e2simplexmlresult"+e);
569 this.state = this.xmlitems.getElementsByTagName("e2state").item(0).firstChild.data;
571 debug("SimpleXMLResult parsing e2state"+e);
574 this.statetext = this.xmlitems.getElementsByTagName("e2statetext").item(0).firstChild.data;
576 debug("SimpleXMLResult parsing e2statetext"+e);
579 this.getState = function(){
580 if(this.state == 'True'){
586 this.getStateText = function(){
587 return this.statetext;
590 // END SimpleXMLResult
592 //START class Settings
593 function Settings(xml){
594 // parsing values from xml-element
595 //debug('init ServiceList'+xml);
597 this.xmlitems = xml.getElementsByTagName("e2settings").item(0).getElementsByTagName("e2setting");
598 debug(this.xmlitems);
600 //debug("Service parsing Error");
602 this.getArray = function(){
603 var listxy = new Array();
604 for (var i=0;i<this.xmlitems.length;i++){
605 var xv = new Setting(this.xmlitems.item(i));
613 //START class Setting
614 function Setting(xml){
615 // parsing values from xml-element
616 //debug('init ServiceReference'+xml);
618 this.settingvalue = xml.getElementsByTagName('e2settingvalue').item(0).firstChild.data;
619 this.settingname = xml.getElementsByTagName('e2settingname').item(0).firstChild.data;
622 //debug("Service parsing Error "+e);
625 this.getSettingValue = function(){
626 return this.settingvalue;
629 this.getSettingName = function(){
630 return this.settingname;
634 //START class FileList
635 function FileList(xml){
636 // parsing values from xml-element
637 debug('init FileList'+xml);
639 this.xmlitems = xml.getElementsByTagName("e2filelist").item(0).getElementsByTagName("e2file");
641 debug("FileList parsing Error");
643 this.getArray = function(){
644 var listxy = new Array();
645 for(var i=0;i<this.xmlitems.length;i++){
646 //debug("parsing File "+i+" of "+this.xmlitems.length);
647 var xv = new File(this.xmlitems.item(i));
657 // parsing values from xml-element
658 //debug('init Movie');
660 this.servicereference = xml.getElementsByTagName('e2servicereference').item(0).firstChild.data;
662 this.servicereference = "N/A";
664 this.getServiceReference = function(){
665 return this.servicereference;
667 this.getNameOnly = function(){
668 if(this.root == '/') {
669 return this.servicereference;
671 return this.servicereference.replace(new RegExp('.*'+this.root, "i"), '');
675 this.isdirectory = xml.getElementsByTagName('e2isdirectory').item(0).firstChild.data;
677 this.isdirectory = "N/A";
679 this.getIsDirectory = function(){
680 return this.isdirectory;
683 this.root = xml.getElementsByTagName('e2root').item(0).firstChild.data;
687 this.getRoot = function(){
695 //START class NoteList
696 function NoteList(xml){
697 // parsing values from xml-element
699 this.xmlitems = xml.getElementsByTagName("e2noteslist").item(0).getElementsByTagName("e2note");
701 debug("NoteList parsing Error");
703 this.getArray = function(){
704 var listxy = new Array();
705 for(var i=0;i<this.xmlitems.length;i++){
706 var xv = new Note(this.xmlitems.item(i));
717 this.filename = xml.getElementsByTagName('e2notename').item(0).firstChild.data;
719 this.filename = "N/A";
722 this.saved = xml.getElementsByTagName('e2notesaved').item(0).firstChild.data;
727 this.nameold = xml.getElementsByTagName('e2notenameold').item(0).firstChild.data;
729 this.nameold = "False";
732 this.content = xml.getElementsByTagName('e2notecontent').item(0).firstChild.data;
737 this.size = xml.getElementsByTagName('e2notesize').item(0).firstChild.data;
742 this.mtime = new Date(parseInt(xml.getElementsByTagName('e2notemtime').item(0).firstChild.data)*1000);
747 this.ctime = new Date(parseInt(xml.getElementsByTagName('e2notectime').item(0).firstChild.data)*1000);
752 this.getMTime = function()
754 var Wochentag = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
755 var wday = Wochentag[this.mtime.getDay()];
756 var day = this.mtime.getDate();
757 var month = this.mtime.getMonth()+1;
758 var year = this.mtime.getFullYear();
759 return wday+". "+day+"."+month+"."+year+" "+this.mtime.getHours()+":"+this.mtime.getMinutes();
761 this.getCTime = function()
763 var Wochentag = new Array("So", "Mo", "Di", "Mi", "Do", "Fr", "Sa");
764 var wday = Wochentag[this.ctime.getDay()];
765 var day = this.ctime.getDate();
766 var month = this.ctime.getMonth()+1;
767 var year = this.ctime.getFullYear();
768 return wday+". "+day+"."+month+"."+year+" "+this.ctime.getHours()+":"+this.ctime.getMinutes();