~xibo-maintainers/xibo/encke

« back to all changes in this revision

Viewing changes to client/python/plugins/media/TextMedia.py

  • Committer: Alex Harrington
  • Date: 2009-12-31 11:18:05 UTC
  • mfrom: (23.7.179 xibo-python)
  • Revision ID: alex@longhill.org.uk-20091231111805-qgth66i4w87rxyuc
[pyclient] Merged in development version 1.1.0a19

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
#
 
5
# Xibo - Digitial Signage - http://www.xibo.org.uk
 
6
# Copyright (C) 2010 Alex Harrington
 
7
#
 
8
# This file is part of Xibo.
 
9
#
 
10
# Xibo is free software: you can redistribute it and/or modify
 
11
# it under the terms of the GNU Affero General Public License as published by
 
12
# the Free Software Foundation, either version 3 of the License, or
 
13
# any later version. 
 
14
#
 
15
# Xibo is distributed in the hope that it will be useful,
 
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
# GNU Affero General Public License for more details.
 
19
#
 
20
# You should have received a copy of the GNU Affero General Public License
 
21
# along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
 
22
#
 
23
 
 
24
import os
 
25
import time
 
26
import sys
 
27
 
 
28
from BrowserMediaAnimatedBase import BrowserMediaAnimatedBase
 
29
from threading import Thread
 
30
 
 
31
class TextMedia(BrowserMediaAnimatedBase):
 
32
    def getContent(self):
 
33
        
 
34
        # Parse out the text element from the raw tag.
 
35
        try:
 
36
            for t in self.rawNode.getElementsByTagName('text'):
 
37
                self.textNode = t
 
38
        
 
39
            for node in self.textNode.childNodes:
 
40
                if node.nodeType == node.CDATA_SECTION_NODE:
 
41
                    self.text = node.data.encode('UTF-8')
 
42
                    self.log.log(5,'audit','Text is: ' + self.text)
 
43
        except:
 
44
            self.log.log(2,'error','%s Error parsing out the text from the xlf' % self.mediaNodeName)
 
45
            return []
 
46
        
 
47
        return [self.text]