aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-04-09 13:51:09 +0000
committerAndreas Frisch <andreas.frisch@multimedia-labs.de>2008-04-09 13:51:09 +0000
commit6c8ddb8573c023e50222cbda8e72287106bac528 (patch)
tree308bdad9423c5df18c7173114a4ecf985e97ad74 /lib
parentfce66e72c0ad6e000b22fdda7b57f3544763e1ca (diff)
downloadenigma2-6c8ddb8573c023e50222cbda8e72287106bac528.tar.gz
enigma2-6c8ddb8573c023e50222cbda8e72287106bac528.zip
Add ServicePosition arguments Detailed, Negate, ShowHours & respective patch for CutListEditor
Diffstat (limited to 'lib')
-rw-r--r--lib/python/Components/Converter/ServicePosition.py36
-rw-r--r--lib/python/Plugins/Extensions/CutListEditor/plugin.py2
2 files changed, 26 insertions, 12 deletions
diff --git a/lib/python/Components/Converter/ServicePosition.py b/lib/python/Components/Converter/ServicePosition.py
index e3110179..b488258b 100644
--- a/lib/python/Components/Converter/ServicePosition.py
+++ b/lib/python/Components/Converter/ServicePosition.py
@@ -8,27 +8,33 @@ class ServicePosition(Converter, Poll, object):
TYPE_POSITION = 1
TYPE_REMAINING = 2
TYPE_GAUGE = 3
- TYPE_POSITION_DETAILED = 4
def __init__(self, type):
Poll.__init__(self)
Converter.__init__(self, type)
- self.poll_interval = 500
+ args = type.split(',')
+ type = args.pop(0)
+
+ self.negate = 'Negate' in args
+ self.detailed = 'Detailed' in args
+ self.showHours = 'ShowHours' in args
+
+ if self.detailed:
+ self.poll_interval = 100
+ else:
+ self.poll_interval = 500
if type == "Length":
self.type = self.TYPE_LENGTH
elif type == "Position":
self.type = self.TYPE_POSITION
- elif type == "PositionDetailed":
- self.type = self.TYPE_POSITION_DETAILED
- self.poll_interval = 100
elif type == "Remaining":
self.type = self.TYPE_REMAINING
elif type == "Gauge":
self.type = self.TYPE_GAUGE
else:
- raise "type must be {Length|Position|PositionDetaileed|Remaining|Gauge}"
+ raise "type must be {Length|Position|Remaining|Gauge} with optional arguments {Negate|Detailed|ShowHours}"
self.poll_enabled = self.type != self.TYPE_LENGTH
@@ -70,24 +76,32 @@ class ServicePosition(Converter, Poll, object):
else:
if self.type == self.TYPE_LENGTH:
l = self.length
- elif self.type in [self.TYPE_POSITION, self.TYPE_POSITION_DETAILED]:
+ elif self.type == self.TYPE_POSITION:
l = self.position
elif self.type == self.TYPE_REMAINING:
l = self.length - self.position
- if self.type != self.TYPE_POSITION_DETAILED:
+ if not self.detailed:
l /= 90000
+ if self.negate: l = -l
+
if l > 0:
sign = ""
else:
l = -l
sign = "-"
- if self.type != self.TYPE_POSITION_DETAILED:
- return sign + "%d:%02d" % (l/60, l%60)
+ if not self.detailed:
+ if self.showHours:
+ return sign + "%d:%02d:%02d" % (l/3600, l%3600/60, l%60)
+ else:
+ return sign + "%d:%02d" % (l/60, l%60)
else:
- return sign + "%d:%02d:%03d" % ((l/60/90000), (l/90000)%60, (l%90000)/90)
+ if self.showHours:
+ return sign + "%d:%02d:%02d:%03d" % ((l/3600/90000), (l/90000)%3600/60, (l/90000)%60, (l%90000)/90)
+ else:
+ return sign + "%d:%02d:%03d" % ((l/60/90000), (l/90000)%60, (l%90000)/90)
# range/value are for the Progress renderer
range = 10000
diff --git a/lib/python/Plugins/Extensions/CutListEditor/plugin.py b/lib/python/Plugins/Extensions/CutListEditor/plugin.py
index 78b2bacb..e2bf7235 100644
--- a/lib/python/Plugins/Extensions/CutListEditor/plugin.py
+++ b/lib/python/Plugins/Extensions/CutListEditor/plugin.py
@@ -158,7 +158,7 @@ class CutListEditor(Screen, InfoBarSeek, InfoBarCueSheetSupport, InfoBarServiceN
<widget source="CurrentService" render="Label" position="370,278" size="340,25"
backgroundColor="#000000" foregroundColor="#ffffff" font="Regular;19" zPosition="1" >
- <convert type="ServicePosition">PositionDetailed</convert>
+ <convert type="ServicePosition">Position,Detailed</convert>
</widget>
<widget name="Timeline" position="50,500" size="620,40" backgroundColor="#000000"