1 # -*- coding: utf-8 -*-
3 # AutomaticVolumeAdjustment E2
7 # Coded by Dr.Best (c) 2010
8 # Support: www.dreambox-tools.info
10 # This plugin is licensed under the Creative Commons
11 # Attribution-NonCommercial-ShareAlike 3.0 Unported
12 # License. To view a copy of this license, visit
13 # http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative
14 # Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
16 # Alternatively, this plugin may be distributed and executed on hardware which
17 # is licensed by Dream Property GmbH.
19 # This plugin is NOT free software. It is open source, you are allowed to
20 # modify it (if you keep the license), but it may not be commercially
21 # distributed other than under the conditions noted above.
23 from Plugins.Plugin import PluginDescriptor
24 from AutomaticVolumeAdjustmentSetup import AutomaticVolumeAdjustmentConfigScreen
25 from AutomaticVolumeAdjustment import AutomaticVolumeAdjustment
26 from AutomaticVolumeAdjustmentConfig import saveVolumeDict
28 def autostart(reason, **kwargs):
29 if "session" in kwargs:
30 session = kwargs["session"]
31 AutomaticVolumeAdjustment(session)
33 def autoend(reason, **kwargs):
34 # save config values for last used volume modus
36 if AutomaticVolumeAdjustment.instance:
37 if AutomaticVolumeAdjustment.instance.enabled and AutomaticVolumeAdjustment.instance.modus != "0":
38 saveVolumeDict(AutomaticVolumeAdjustment.instance.serviceList)
40 def setup(session, **kwargs):
41 session.open(AutomaticVolumeAdjustmentConfigScreen) # start setup
43 def startSetup(menuid):
44 if menuid != "osd_video_audio": # show setup only in system level menu
46 return [(_("Automatic Volume Adjustment"), setup, "AutomaticVolumeAdjustment", 46)]
48 def Plugins(**kwargs):
49 return [PluginDescriptor(where = [PluginDescriptor.WHERE_SESSIONSTART], fnc = autostart), PluginDescriptor(where = [PluginDescriptor.WHERE_AUTOSTART], fnc = autoend), PluginDescriptor(name="Automatic Volume Adjustment", description=_("Automatic Volume Adjustment"), where = PluginDescriptor.WHERE_MENU, fnc=startSetup) ]