~xibo-maintainers/xibo/head-14-fix

« back to all changes in this revision

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

  • Committer: Alex Harrington
  • Date: 2012-10-28 21:42:14 UTC
  • mfrom: (258.1.8 1.4.0-bugfix)
  • Revision ID: alex@longhill.org.uk-20121028214214-3rtja03j6gp9ctbc
[pyclient] Merged 1.4.0-bugfix branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
        
30
30
    def add(self):
31
31
        self.itemCount = 0
 
32
        self.retryCount = 0
32
33
        self.tmpPath = os.path.join(self.libraryDir,self.mediaNodeName + "-tmp.html")
33
34
        tmpXML = '<browser id="' + self.mediaNodeName + '" opacity="0" width="' + str(self.width) + '" height="' + str(self.height) + '"/>'
34
35
        self.p.enqueue('add',(tmpXML,self.regionNodeName))
116
117
        optionsTuple = (self.mediaNodeName,bo[0],bo[1])
117
118
        self.p.enqueue('browserOptions',optionsTuple)
118
119
        # TODO: This next line should really callback self.parent.next. See timerElapsed function
119
 
        self.p.enqueue('timer',(int(self.duration) * 1000,self.timerElapsed))
120
 
        self.p.enqueue('setOpacity',(self.mediaNodeName,1))
 
120
        currentNode = self.p.getElementByID(self.mediaNodeName)
 
121
        if currentNode.painted():
 
122
            # Make the browser visible
 
123
            self.p.enqueue('setOpacity',(self.mediaNodeName,1))
 
124
            self.p.enqueue('timer',(int(self.duration) * 1000,self.timerElapsed))
 
125
        else:
 
126
            if self.retryCount > 3:
 
127
                print "Error rendering %s. Skipping" % self.mediaNodeName
 
128
                self.timerElapsed()
 
129
            else:
 
130
                if self.retryCount > 1:
 
131
                    print "Error rendering %s. Re-rendering" % self.mediaNodeName
 
132
                    
 
133
                self.retryCount = self.retryCount + 1
 
134
                self.p.enqueue('browserNavigate',(self.mediaNodeName,"file://" + os.path.abspath(self.tmpPath),self.finishedRendering))