1 #######################################################################
3 # InfoBar Tuner State for Enigma-2
4 # Coded by betonme (c) 2011 <glaserfrank(at)gmail.com>
5 # Support: http://www.i-have-a-dreambox.com/wbb2/thread.php?threadid=162629
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License
9 # as published by the Free Software Foundation; either version 2
10 # of the License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 #######################################################################
19 # for localized messages
23 from Components.config import *
26 from Plugins.Plugin import PluginDescriptor
29 from Screens.MessageBox import MessageBox
32 from IBTSConfiguration import InfoBarTunerStateConfiguration
33 from InfoBarTunerState import InfoBarTunerState, TunerStateInfo
37 NAME = _("InfoBar Tuner State")
38 DESCRIPTION = _("Show InfoBar Tuner State")
44 gInfoBarTunerState = None
49 ("TypeIcon", _("Type (Icon)")),
50 ("TypeText", _("Type (Text)")),
51 ("Tuner", _("Tuner")),
52 ("TunerType", _("Tuner Type")),
53 ("Number", _("Channel Number")),
54 ("Channel", _("Channel Name")),
56 ("TimeLeftDuration", _("Time Left / Duration")),
57 ("TimeLeft", _("Time Left")),
58 ("TimeElapsed", _("Time Elapsed")),
59 ("Begin", _("Begin")),
61 ("Duration", _("Duration")),
62 ("TimerProgressGraphical", _("Timer Progress (Graphical)")), #TODO howto do for file streams
63 ("TimerProgressText", _("Timer Progress (Text)")), #TODO howto do for file streams
64 ("TimerDestination", _("Destination")), #TODO howto do for file streams
65 ("StreamClient", _("Stream Client")),
66 ("StreamClientPort", _("Stream Client with Port")),
67 ("DestinationStreamClient", _("Destination / Client")),
70 ("FileSize", _("File Size")),
71 ("FreeSpace", _("Free Space")),
76 ("%H:%M", _("HH:MM")),
77 ("%d.%m %H:%M", _("DD.MM HH:MM")),
78 ("%m/%d %H:%M", _("MM/DD HH:MM")),
79 ("%d.%m.%Y %H:%M", _("DD.MM.YYYY HH:MM")),
80 ("%Y/%m/%d %H:%M", _("YYYY/MM/DD HH:MM")),
81 ("%H:%M %d.%m", _("HH:MM DD.MM")),
82 ("%H:%M %m/%d", _("HH:MM MM/DD")),
83 ("%H:%M %d.%m.%Y", _("HH:MM DD.MM.YYYY")),
84 ("%H:%M %Y/%m/%d", _("HH:MM YYYY/MM/DD")),
88 config.infobartunerstate = ConfigSubsection()
90 config.infobartunerstate.about = ConfigNothing()
91 config.infobartunerstate.enabled = ConfigEnableDisable(default = True)
92 config.infobartunerstate.extensions_menu = ConfigYesNo(default = True)
93 #config.infobartunerstate.popup_time = ConfigSelectionNumber(0, 10, 1, default = 5)
98 config.infobartunerstate.show_infobar = ConfigYesNo(default = True)
99 config.infobartunerstate.show_events = ConfigYesNo(default = True) #TODO Show on start, end, start/end
100 config.infobartunerstate.show_overwrite = ConfigYesNo(default = False) # Show with MoviePlayer only is actually not possible
102 config.infobartunerstate.time_format = ConfigSelection(default = "%H:%M", choices = date_choices)
103 config.infobartunerstate.number_finished_records = ConfigSelectionNumber(0, 10, 1, default = 5)
104 config.infobartunerstate.timeout_finished_records = ConfigSelectionNumber(0, 600, 10, default = 60)
106 config.infobartunerstate.fields = ConfigSubsection()
107 config.infobartunerstate.fields.a = ConfigSelection(default = "TypeIcon", choices = field_choices)
108 config.infobartunerstate.fields.b = ConfigSelection(default = "Tuner", choices = field_choices)
109 config.infobartunerstate.fields.c = ConfigSelection(default = "Number", choices = field_choices)
110 config.infobartunerstate.fields.d = ConfigSelection(default = "Channel", choices = field_choices)
111 config.infobartunerstate.fields.e = ConfigSelection(default = "Name", choices = field_choices)
112 config.infobartunerstate.fields.f = ConfigSelection(default = "TimerProgressGraphical", choices = field_choices)
113 config.infobartunerstate.fields.g = ConfigSelection(default = "TimeLeftDuration", choices = field_choices)
114 config.infobartunerstate.fields.h = ConfigSelection(default = "StreamClient", choices = field_choices)
115 config.infobartunerstate.fields.i = ConfigSelection(default = "None", choices = field_choices)
116 config.infobartunerstate.fields.j = ConfigSelection(default = "None", choices = field_choices)
118 config.infobartunerstate.offset_horizontal = ConfigSelectionNumber(-1000, 1000, 1, default = 0)
119 config.infobartunerstate.offset_vertical = ConfigSelectionNumber(-1000, 1000, 1, default = 0)
120 config.infobartunerstate.offset_padding = ConfigSelectionNumber(-1000, 1000, 1, default = 0)
121 config.infobartunerstate.offset_spacing = ConfigSelectionNumber(-1000, 1000, 1, default = 0)
123 config.infobartunerstate.background_transparency = ConfigYesNo(default = False)
126 #######################################################
127 # Plugin main function
128 def Plugins(**kwargs):
133 if config.infobartunerstate.enabled.value:
134 # AutoStart and SessionStart
135 descriptors.append( PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = start, needsRestart = False) )
136 descriptors.append( PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = start, needsRestart = False) )
137 if config.infobartunerstate.extensions_menu.value:
138 descriptors.append( PluginDescriptor(name = NAME, description = DESCRIPTION, where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = extension, needsRestart = False) )
141 descriptors.append( PluginDescriptor(name = NAME, description = NAME + " " +_("configuration"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc = setup, needsRestart = False) ) #icon = "/icon.png"
146 #######################################################
147 # Plugin # Plugin configuration
148 def setup(session, **kwargs):
150 # Overwrite Skin Position
151 # Show Live TV Tuners PiP LiveStream FileStream
152 # alltime permanent display, needs an dynamic update service
153 # Always display at least Nothing running
154 # show free tuner with dvb-type
156 # Event popup timeout
157 # Feldbreitenbegrenzung fuer Namen ...
158 # Streaming amount of data
159 # Display next x timers also if deactivated
161 session.open(InfoBarTunerStateConfiguration)
163 print "InfoBarTunerStateMenu exception " + str(e)
166 #######################################################
167 # Autostart and Sessionstart
168 def start(reason, **kwargs):
169 #print "InfoBarTunerState autostart "
172 if reason == 0: # start
173 if kwargs.has_key("session"):
174 if config.infobartunerstate.enabled.value:
175 global gInfoBarTunerState
176 session = kwargs["session"]
177 gInfoBarTunerState = InfoBarTunerState(session)
180 #######################################################
182 def extension(session, **kwargs):
183 global gInfoBarTunerState
184 if gInfoBarTunerState:
185 if gInfoBarTunerState.entries:
186 # There are active entries
187 gInfoBarTunerState.show(True)
189 # No entries available
190 gInfoBarTunerState.info = gInfoBarTunerState.session.instantiateDialog( TunerStateInfo, _("Nothing running") )
191 gInfoBarTunerState.info.show()
193 # No InfoBarTunerState Instance running
194 session.open(MessageBox, _("InfoBarTunerState is disabled"), MessageBox.TYPE_INFO, 3)