1 # -*- coding: utf-8 -*-
3 # EventPosition - Converter
5 # Coded by Dr.Best (c) 2013
6 # Support: www.dreambox-tools.info
7 # E-Mail: dr.best@dreambox-tools.info
9 # This plugin is open source but it is NOT free software.
11 # This plugin may only be distributed to and executed on hardware which
12 # is licensed by Dream Multimedia GmbH.
14 # It's NOT allowed to distribute any parts of this plugin or its source code in ANY way
15 # to hardware which is NOT licensed by Dream Multimedia GmbH.
16 # It's NOT allowed to execute this plugin and its source code or even parts of it in ANY way
17 # on hardware which is NOT licensed by Dream Multimedia GmbH.
19 # If you want to use or modify the code or parts of it,
20 # you have to keep MY license and inform me about the modifications by mail.
23 from Converter import Converter
25 from Components.Element import cached
28 class EventPosition(Poll, Converter, object):
29 def __init__(self, type):
31 Converter.__init__(self, type)
32 self.poll_interval = 30*1000
33 self.poll_enabled = True
36 def getPosition(self):
37 event = self.source.event
41 start_time = event.getBeginTime()
42 duration = event.getDuration()
43 if start_time <= now <= (start_time + duration) and duration > 0:
44 return now - start_time
50 event = self.source.event
53 return event.getDuration()
60 position = property(getPosition)
61 length = property(getLength)
62 cutlist = property(getCutlist)
65 def changed(self, what):
66 if what[0] != self.CHANGED_CLEAR:
67 self.downstream_elements.changed(what)
68 if len(self.downstream_elements):
69 if not self.source.event and self.downstream_elements[0].visible:
70 self.downstream_elements[0].visible = False
71 elif self.source.event and not self.downstream_elements[0].visible:
72 self.downstream_elements[0].visible = True