[EasyMedia] add timerlist to choices
[enigma2-plugins.git] / easymedia / src / plugin.py
1 #######################################################################
2 #
3 #    EasyMedia for Dreambox-Enigma2
4 #    Coded by Vali (c)2010-2011
5 #    Support: www.dreambox-tools.info
6 #
7 #
8 #  This plugin is licensed under the Creative Commons 
9 #  Attribution-NonCommercial-ShareAlike 3.0 Unported License.
10 #  To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/
11 #  or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
12 #
13 #  Alternatively, this plugin may be distributed and executed on hardware which
14 #  is licensed by Dream Multimedia GmbH.
15 #
16 #
17 #  This plugin is NOT free software. It is open source, you are allowed to
18 #  modify it (if you keep the license), but it may not be commercially 
19 #  distributed other than under the conditions noted above.
20 #
21 #
22 #######################################################################
23
24
25
26 from __init__ import _
27 from Screens.Screen import Screen
28 from Screens.MessageBox import MessageBox
29 from Screens.InfoBarGenerics import InfoBarPlugins
30 from Screens.InfoBar import InfoBar
31 from Screens.ChoiceBox import ChoiceBox
32 from Plugins.Plugin import PluginDescriptor
33 from Components.ActionMap import ActionMap
34 from Components.MenuList import MenuList
35 from Components.Label import Label
36 from Components.ConfigList import ConfigListScreen
37 from Components.PluginComponent import plugins
38 from Components.PluginList import *
39 from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection
40 from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS
41 from Tools.LoadPixmap import LoadPixmap
42 from Tools.HardwareInfo import HardwareInfo
43 from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, gFont, getDesktop
44 import pickle
45 from os import system as os_system
46 from os import listdir as os_listdir
47
48
49
50 EMbaseInfoBarPlugins__init__ = None
51 EMStartOnlyOneTime = False
52 EMsession = None
53 InfoBar_instance = None
54
55
56
57 config.plugins.easyMedia  = ConfigSubsection()
58 config.plugins.easyMedia.music = ConfigSelection(default="mediaplayer", choices = [("no", _("Disabled")), ("mediaplayer", _("MediaPlayer")), ("merlinmp", _("MerlinMusicPlayer"))])
59 config.plugins.easyMedia.files = ConfigSelection(default="dreamexplorer", choices = [("no", _("Disabled")), ("filebrowser", _("Filebrowser")), ("dreamexplorer", _("DreamExplorer")), ("tuxcom", _("TuxCom"))])
60 config.plugins.easyMedia.videodb = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
61 config.plugins.easyMedia.bookmarks = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
62 config.plugins.easyMedia.pictures = ConfigSelection(default="yes", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
63 config.plugins.easyMedia.mytube = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
64 config.plugins.easyMedia.vlc = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
65 config.plugins.easyMedia.dvd = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
66 config.plugins.easyMedia.weather = ConfigSelection(default="yes", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
67 config.plugins.easyMedia.iradio = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
68 config.plugins.easyMedia.idream = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
69 config.plugins.easyMedia.zdfmedia = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
70 config.plugins.easyMedia.radio = ConfigSelection(default="yes", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
71 config.plugins.easyMedia.myvideo = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
72 config.plugins.easyMedia.timers = ConfigSelection(default="no", choices = [("no", _("Disabled")), ("yes", _("Enabled"))])
73
74
75
76 def Plugins(**kwargs):
77         return [PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = EasyMediaAutostart),
78                         PluginDescriptor(name="EasyMedia", description=_("Not easy way to start EasyMedia"), where = PluginDescriptor.WHERE_PLUGINMENU, fnc=notEasy),]
79
80
81
82 def EasyMediaAutostart(reason, **kwargs):
83         global EMbaseInfoBarPlugins__init__
84         if "session" in kwargs:
85                 global EMsession
86                 EMsession = kwargs["session"]
87                 if EMbaseInfoBarPlugins__init__ is None:
88                         EMbaseInfoBarPlugins__init__ = InfoBarPlugins.__init__
89                 InfoBarPlugins.__init__ = InfoBarPlugins__init__
90                 InfoBarPlugins.pvr = pvr
91
92
93
94 def InfoBarPlugins__init__(self):
95         global EMStartOnlyOneTime
96         if not EMStartOnlyOneTime: 
97                 EMStartOnlyOneTime = True
98                 global InfoBar_instance
99                 InfoBar_instance = self
100                 self["EasyMediaActions"] = ActionMap(["EasyMediaActions"],
101                         {"video_but": self.pvr}, -1)
102         else:
103                 InfoBarPlugins.__init__ = InfoBarPlugins.__init__
104                 InfoBarPlugins.pvr = None
105         EMbaseInfoBarPlugins__init__(self)
106
107
108
109 def pvr(self):
110         self.session.openWithCallback(MPcallbackFunc, EasyMedia)
111
112
113
114 def notEasy(session, **kwargs):
115         session.openWithCallback(MPcallbackFunc, EasyMedia)
116
117
118
119 def MPanelEntryComponent(key, text):
120         res = [ text ]
121         res.append((eListboxPythonMultiContent.TYPE_TEXT, 150, 17, 300, 60, 0, RT_HALIGN_LEFT, text[0]))
122         png = LoadPixmap('/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/' + key + ".png")
123         if png is not None:
124                 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 25, 5, 100, 50, png))
125         else:
126                 png = LoadPixmap('/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/default.png')
127                 if png is not None:
128                         res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 25, 5, 100, 50, png))
129         return res
130
131
132
133 class MPanelList(MenuList):
134         def __init__(self, list, selection = 0, enableWrapAround=True):
135                 MenuList.__init__(self, list, enableWrapAround, eListboxPythonMultiContent)
136                 self.l.setFont(0, gFont("Regular", 20))
137                 self.l.setItemHeight(60)
138                 self.selection = selection
139         def postWidgetCreate(self, instance):
140                 MenuList.postWidgetCreate(self, instance)
141                 self.moveToIndex(self.selection)
142
143
144
145 def BookmarksCallback(choice):
146         choice = choice and choice[1]
147         if choice:
148                 config.movielist.last_videodir.value = choice
149                 config.movielist.last_videodir.save()
150                 if InfoBar_instance:
151                         InfoBar_instance.showMovies()
152
153
154
155 def TvRadioCallback(choice):
156         choice = choice and choice[1]
157         if choice == "TM":
158                 if InfoBar_instance:
159                         InfoBar_instance.showTv()
160         elif choice == "RM":
161                 if InfoBar_instance:
162                         InfoBar_instance.showRadio()
163
164
165
166 class ConfigEasyMedia(ConfigListScreen, Screen):
167         skin = """
168                 <screen name="ConfigEasyMedia" position="center,center" size="600,410" title="EasyMedia settings...">
169                         <widget name="config" position="5,5" scrollbarMode="showOnDemand" size="590,380"/>
170                         <eLabel font="Regular;20" foregroundColor="#00ff4A3C" halign="center" position="20,388" size="140,26" text="Cancel"/>
171                         <eLabel font="Regular;20" foregroundColor="#0056C856" halign="center" position="165,388" size="140,26" text="Save"/>
172                         <eLabel font="Regular;20" foregroundColor="#00f3ca09" halign="center" position="310,388" size="140,26" text="Plugins"/>
173                 </screen>"""
174         def __init__(self, session):
175                 Screen.__init__(self, session)
176                 self.setTitle(_("EasyMedia settings..."))
177                 self.session = session
178                 list = []
179                 list.append(getConfigListEntry(_("Video database:"), config.plugins.easyMedia.videodb))
180                 list.append(getConfigListEntry(_("Music player:"), config.plugins.easyMedia.music))
181                 list.append(getConfigListEntry(_("Files browser:"), config.plugins.easyMedia.files))
182                 list.append(getConfigListEntry(_("Show bookmarks:"), config.plugins.easyMedia.bookmarks))
183                 list.append(getConfigListEntry(_("Timer:"), config.plugins.easyMedia.timers))
184                 list.append(getConfigListEntry(_("PicturePlayer:"), config.plugins.easyMedia.pictures))
185                 list.append(getConfigListEntry(_("Show tv/radio switch:"), config.plugins.easyMedia.radio))
186                 list.append(getConfigListEntry(_("YouTube player:"), config.plugins.easyMedia.mytube))
187                 list.append(getConfigListEntry(_("VLC player:"), config.plugins.easyMedia.vlc))
188                 list.append(getConfigListEntry(_("DVD player:"), config.plugins.easyMedia.dvd))
189                 list.append(getConfigListEntry(_("Weather plugin:"), config.plugins.easyMedia.weather))
190                 list.append(getConfigListEntry(_("NetRadio player:"), config.plugins.easyMedia.iradio))
191                 list.append(getConfigListEntry(_("Show Merlin-iDream:"), config.plugins.easyMedia.idream))
192                 list.append(getConfigListEntry(_("ZDFmediathek player:"), config.plugins.easyMedia.zdfmedia))
193                 list.append(getConfigListEntry(_("MyVideo player:"), config.plugins.easyMedia.myvideo))
194                 ConfigListScreen.__init__(self, list)
195                 self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], {"green": self.save, "red": self.exit, "cancel": self.exit, "yellow": self.plug}, -1)
196
197         def save(self):
198                 for x in self["config"].list:
199                         x[1].save()
200                 self.close()
201
202         def exit(self):
203                 for x in self["config"].list:
204                         x[1].cancel()
205                 self.close()
206
207         def plug(self):
208                 self.session.open(AddPlug)
209
210
211
212 class AddPlug(Screen):
213         skin = """
214                 <screen name="AddPlug" position="center,center" size="440,375" title="EasyMedia...">
215                         <widget name="list" position="0,10" size="440,355" scrollbarMode="showOnDemand" />
216                 </screen>"""
217         def __init__(self, session):
218                 Screen.__init__(self, session)
219                 self.setTitle(_("Add/remove plugin"))
220                 plugins.readPluginList(resolveFilename(SCOPE_PLUGINS))
221                 self.session = session
222                 self.list = []
223                 self["list"] = PluginList(self.list)
224                 self.updateList()
225                 self["actions"] = ActionMap(["WizardActions"],
226                 {
227                         "ok": self.save,
228                         "back": self.close
229                 }, -1)
230                 self.onExecBegin.append(self.checkWarnings)
231
232         def checkWarnings(self):
233                 if len(plugins.warnings):
234                         text = _("Some plugins are not available:\n")
235                         for (pluginname, error) in plugins.warnings:
236                                 text += _("%s (%s)\n") % (pluginname, error)
237                         plugins.resetWarnings()
238                         self.session.open(MessageBox, text = text, type = MessageBox.TYPE_WARNING)
239
240         def updateList(self):
241                 self.list = [ ]
242                 self.pluginlist = plugins.getPlugins(PluginDescriptor.WHERE_PLUGINMENU)
243                 for plugin in self.pluginlist:
244                         self.list.append(PluginEntryComponent(plugin))
245                 self["list"].l.setList(self.list)
246
247         def save(self):
248                 plugin = self["list"].l.getCurrentSelection()[0]
249                 plugin.icon = None
250                 if not fileExists("/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/" + plugin.name + ".plug"):
251                         try:
252                                 outf = open(("/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/" + plugin.name + ".plug"), 'wb')
253                                 pickle.dump(plugin, outf)
254                                 outf.close()
255                                 self.session.open(MessageBox, text = (plugin.name + _(" added to EasyMedia")), type = MessageBox.TYPE_INFO)
256                         except: self.session.open(MessageBox, text = "Write Error!", type = MessageBox.TYPE_WARNING)
257                 else:
258                         order = 'rm -f \"' + '/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/' + plugin.name + '.plug' + '\"'
259                         try:
260                                 os_system(order)
261                                 self.session.open(MessageBox, text = (plugin.name + _(" removed from EasyMedia")), type = MessageBox.TYPE_INFO)
262                         except: self.session.open(MessageBox, text = "Write Error!", type = MessageBox.TYPE_WARNING)
263
264
265
266 class EasyMediaSummary(Screen):
267         if "800se" in HardwareInfo().get_device_name():
268                 skin = """
269                         <screen position="0,0" size="96,64" id="2">
270                                 <eLabel text="EasyMedia:" foregroundColor="#fcc000" position="0,0" size="96,24" font="Regular;16"/>
271                                 <widget name="text1" position="0,24" size="96,40" font="Regular;18"/>
272                         </screen>"""
273         else:
274                 skin = """
275                         <screen position="0,0" size="132,64">
276                                 <eLabel text="EasyMedia:" position="0,0" size="132,24" font="Regular;14"/>
277                                 <widget name="text1" position="0,24" size="132,40" font="Regular;16"/>
278                         </screen>"""
279         def __init__(self, session, parent):
280                 Screen.__init__(self, session)
281                 self["text1"] = Label()
282                 self.onLayoutFinish.append(self.layoutEnd)
283
284         def layoutEnd(self):
285                 self["text1"].setText(_("Movies"))
286
287         def setText(self, text, line):
288                 self["text1"].setText(text)
289
290
291
292 class EasyMedia(Screen):
293         sz_w = getDesktop(0).size().width()
294         if sz_w > 1100:
295                 skin = """
296                 <screen flags="wfNoBorder" position="0,0" size="450,720" title="Easy Media">
297                         <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/bg.png" position="0,0" size="450,576"/>
298                         <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/bg.png" position="0,576" size="450,145"/>
299                         <widget name="list" position="60,30" size="350,660" scrollbarMode="showNever" transparent="1" zPosition="2"/>
300                 </screen>"""
301         elif sz_w > 1000:
302                 skin = """
303                 <screen flags="wfNoBorder" position="-20,0" size="450,576" title="Easy Media">
304                         <ePixmap pixmap="/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/bg.png" position="0,0" size="450,576"/>
305                         <widget name="list" position="70,48" size="320,480" scrollbarMode="showNever" transparent="1" zPosition="2"/>
306                 </screen>"""
307         else:
308                 skin = """
309                 <screen position="center,center" size="320,440" title="Easy Media">
310                         <widget name="list" position="10,10" size="300,420" scrollbarMode="showOnDemand" />
311                 </screen>"""
312         def __init__(self, session):
313                 Screen.__init__(self, session)
314                 self.session = session
315                 self.list = []
316                 self.__keys = []
317                 MPaskList = []
318                 if True:
319                         self.__keys.append("movies")
320                         MPaskList.append((_("Movies"), "PLAYMOVIES"))
321                 if config.plugins.easyMedia.bookmarks.value != "no":
322                         self.__keys.append("bookmarks")
323                         MPaskList.append((_("Bookmarks"), "BOOKMARKS"))
324                 if config.plugins.easyMedia.timers.value != "no":
325                         self.__keys.append("timers")
326                         MPaskList.append((_("Timer"), "TIMERS"))
327                 if config.plugins.easyMedia.videodb.value != "no":
328                         self.__keys.append("videodb")
329                         MPaskList.append((_("VideoDB"), "VIDEODB"))
330                 if config.plugins.easyMedia.pictures.value != "no":
331                         self.__keys.append("pictures")
332                         MPaskList.append((_("Pictures"), "PICTURES"))
333                 if config.plugins.easyMedia.music.value != "no":
334                         self.__keys.append("music")
335                         MPaskList.append((_("Music"), "MUSIC"))
336                 if config.plugins.easyMedia.radio.value != "no":
337                         self.__keys.append("radio")
338                         if config.usage.e1like_radio_mode.value:
339                                 MPaskList.append((_("Tv/Radio"), "RADIO"))
340                         else:
341                                 MPaskList.append((_("Radio"), "RADIO"))
342                 if config.plugins.easyMedia.dvd.value != "no":
343                         self.__keys.append("dvd")
344                         MPaskList.append((_("DVD Player"), "DVD"))
345                 if config.plugins.easyMedia.weather.value != "no":
346                         self.__keys.append("weather")
347                         MPaskList.append((_("Weather"), "WEATHER"))
348                 if config.plugins.easyMedia.files.value != "no":
349                         self.__keys.append("files")
350                         MPaskList.append((_("Files"), "FILES"))
351                 if config.plugins.easyMedia.iradio.value != "no":
352                         self.__keys.append("shoutcast")
353                         MPaskList.append((_("SHOUTcast"), "SHOUTCAST"))
354                 if config.plugins.easyMedia.idream.value != "no":
355                         self.__keys.append("idream")
356                         MPaskList.append((_("iDream"), "IDREAM"))
357                 if config.plugins.easyMedia.mytube.value != "no":
358                         self.__keys.append("mytube")
359                         MPaskList.append((_("MyTube Player"), "MYTUBE"))
360                 if config.plugins.easyMedia.vlc.value != "no":
361                         self.__keys.append("vlc")
362                         MPaskList.append((_("VLC Player"), "VLC"))
363                 if config.plugins.easyMedia.zdfmedia.value != "no":
364                         self.__keys.append("zdf")
365                         MPaskList.append((_("ZDFmediathek"), "ZDF"))
366                 if config.plugins.easyMedia.myvideo.value != "no":
367                         self.__keys.append("myvideo")
368                         MPaskList.append((_("MyVideo"), "MYVIDEO"))
369                 plist = os_listdir("/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia")
370                 plist = [x[:-5] for x in plist if x.endswith('.plug')]
371                 plist.sort()
372                 for onePlug in plist:
373                         try:
374                                 inpf = open(("/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/" + onePlug + ".plug"), 'rb')
375                                 binPlug = pickle.load(inpf)
376                                 inpf.close()    
377                                 self.__keys.append(binPlug.name)
378                                 MPaskList.append((binPlug.name, ("++++" + binPlug.name)))
379                         except: pass
380                 self.keymap = {}
381                 pos = 0
382                 for x in MPaskList:
383                         strpos = str(self.__keys[pos])
384                         self.list.append(MPanelEntryComponent(key = strpos, text = x))
385                         if self.__keys[pos] != "":
386                                 self.keymap[self.__keys[pos]] = MPaskList[pos]
387                         pos += 1
388                 self["list"] = MPanelList(list = self.list, selection = 0)
389                 self["list"].onSelectionChanged.append(self.updateOLED)
390                 self["actions"] = ActionMap(["WizardActions", "MenuActions"],
391                 {
392                         "ok": self.go,
393                         "back": self.cancel,
394                         "menu": self.emContextMenu
395                 }, -1)
396
397         def cancel(self):
398                 self.close(None)
399
400         def go(self):
401                 cursel = self["list"].l.getCurrentSelection()
402                 if cursel:
403                         self.goEntry(cursel[0])
404                 else:
405                         self.cancel()
406
407         def goEntry(self, entry):
408                 if len(entry) > 2 and isinstance(entry[1], str) and entry[1] == "CALLFUNC":
409                         arg = self["list"].l.getCurrentSelection()[0]
410                         entry[2](arg)
411                 else:
412                         self.close(entry)
413
414         def emContextMenu(self):
415                 self.session.open(ConfigEasyMedia)
416
417         def emContextMenu(self):
418                 self.session.open(ConfigEasyMedia)
419
420         def createSummary(self):
421                 return EasyMediaSummary
422
423         def updateOLED(self):
424                 text = str(self["list"].l.getCurrentSelection()[0][0])
425                 self.summaries.setText(text, 1)
426
427
428
429 def MPcallbackFunc(answer):
430         if EMsession is None:
431                 return
432         answer = answer and answer[1]
433         if answer == "PLAYMOVIES":
434                 if InfoBar_instance:
435                         InfoBar_instance.showMovies()
436         elif answer == "RADIO":
437                 if config.usage.e1like_radio_mode.value:
438                         askBM = []
439                         askBM.append((_("TV-mode"), "TM"))
440                         askBM.append((_("Radio-mode"), "RM"))
441                         askBM.append((_("Nothing"), "NO"))
442                         EMsession.openWithCallback(TvRadioCallback, ChoiceBox, title="EasyMedia...", list = askBM)
443                 else:
444                         if InfoBar_instance:
445                                 InfoBar_instance.showRadio()
446         elif answer == "BOOKMARKS":
447                 tmpBookmarks = config.movielist.videodirs
448                 myBookmarks = tmpBookmarks and tmpBookmarks.value[:] or []
449                 if len(myBookmarks)>0:
450                         askBM = []
451                         for s in myBookmarks:
452                                 askBM.append((s, s))
453                         EMsession.openWithCallback(BookmarksCallback, ChoiceBox, title=_("Select bookmark..."), list = askBM)
454         elif answer == "PICTURES":
455                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/PicturePlayer/plugin.pyo"):
456                         from Plugins.Extensions.PicturePlayer.plugin import picshow
457                         EMsession.open(picshow)
458                 else:
459                         EMsession.open(MessageBox, text = _('Picture-player is not installed!'), type = MessageBox.TYPE_ERROR)
460         elif answer == "MUSIC":
461                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinMusicPlayer/plugin.pyo") and (config.plugins.easyMedia.music.value == "merlinmp"):
462                         from Plugins.Extensions.MerlinMusicPlayer.plugin import MerlinMusicPlayerFileList
463                         servicelist = None
464                         EMsession.open(MerlinMusicPlayerFileList, servicelist)
465                 elif fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MediaPlayer/plugin.pyo") and (config.plugins.easyMedia.music.value == "mediaplayer"):
466                         from Plugins.Extensions.MediaPlayer.plugin import MediaPlayer
467                         EMsession.open(MediaPlayer)
468                 else:
469                         EMsession.open(MessageBox, text = _('No Music-Player installed!'), type = MessageBox.TYPE_ERROR)
470         elif answer == "FILES":
471                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/Tuxcom/plugin.pyo") and (config.plugins.easyMedia.files.value == "tuxcom"):
472                         from Plugins.Extensions.Tuxcom.plugin import TuxComStarter
473                         EMsession.open(TuxComStarter)
474                 elif fileExists("/usr/lib/enigma2/python/Plugins/Extensions/DreamExplorer/plugin.pyo") and (config.plugins.easyMedia.files.value == "dreamexplorer"):
475                         from Plugins.Extensions.DreamExplorer.plugin import DreamExplorerII
476                         EMsession.open(DreamExplorerII)
477                 elif fileExists("/usr/lib/enigma2/python/Plugins/Extensions/Filebrowser/plugin.pyo") and (config.plugins.easyMedia.files.value == "filebrowser"):
478                         from Plugins.Extensions.Filebrowser.plugin import FilebrowserScreen
479                         EMsession.open(FilebrowserScreen)
480                 else:
481                         EMsession.open(MessageBox, text = _('No File-Manager installed!'), type = MessageBox.TYPE_ERROR)
482         elif answer == "WEATHER":
483                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/WeatherPlugin/plugin.pyo"):
484                         from Plugins.Extensions.WeatherPlugin.plugin import WeatherPlugin
485                         EMsession.open(WeatherPlugin)
486                 else:
487                         EMsession.open(MessageBox, text = _('Weather Plugin is not installed!'), type = MessageBox.TYPE_ERROR)
488         elif answer == "DVD":
489                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/DVDPlayer/plugin.pyo"):
490                         from Plugins.Extensions.DVDPlayer.plugin import DVDPlayer
491                         EMsession.open(DVDPlayer)
492                 else:
493                         EMsession.open(MessageBox, text = _('DVDPlayer Plugin is not installed!'), type = MessageBox.TYPE_ERROR)
494         elif answer == "MYTUBE":
495                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MyTube/plugin.pyo"):
496                         from Plugins.Extensions.MyTube.plugin import *
497                         MyTubeMain(EMsession)
498                 else:
499                         EMsession.open(MessageBox, text = _('MyTube Plugin is not installed!'), type = MessageBox.TYPE_ERROR)
500         elif answer == "SHOUTCAST":
501                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/SHOUTcast/plugin.pyo"):
502                         from Plugins.Extensions.SHOUTcast.plugin import SHOUTcastWidget
503                         EMsession.open(SHOUTcastWidget)
504                 else:
505                         EMsession.open(MessageBox, text = _('SHOUTcast Plugin is not installed!'), type = MessageBox.TYPE_ERROR)
506         elif answer == "ZDF":
507                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/ZDFMediathek/plugin.pyo"):
508                         from Plugins.Extensions.ZDFMediathek.plugin import ZDFMediathek
509                         EMsession.open(ZDFMediathek)
510                 else:
511                         EMsession.open(MessageBox, text = _('ZDFmediathek Plugin is not installed!'), type = MessageBox.TYPE_ERROR)
512         elif answer == "VLC":
513                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/VlcPlayer/plugin.pyo"):
514                         from Plugins.Extensions.VlcPlayer.plugin import *
515                         main(EMsession)
516                 else:
517                         EMsession.open(MessageBox, text = _('VLC Player is not installed!'), type = MessageBox.TYPE_ERROR)
518         elif answer == "IDREAM":
519                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MerlinMusicPlayer/plugin.pyo"):
520                         from Plugins.Extensions.MerlinMusicPlayer.plugin import iDreamMerlin
521                         servicelist = None
522                         EMsession.open(iDreamMerlin, servicelist)
523                 else:
524                         EMsession.open(MessageBox, text = _('Merlin iDream is not installed!'), type = MessageBox.TYPE_ERROR)
525         elif answer == "MYVIDEO":
526                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/MyVideoPlayer/plugin.pyo"):
527                         from Plugins.Extensions.MyVideoPlayer.plugin import Vidtype
528                         EMsession.open(Vidtype)
529                 else:
530                         EMsession.open(MessageBox, text = _('MyVideo Player is not installed!'), type = MessageBox.TYPE_ERROR)
531         elif answer == "VIDEODB":
532                 if fileExists("/usr/lib/enigma2/python/Plugins/Extensions/VideoDB/plugin.pyo"):
533                         from Plugins.Extensions.VideoDB.plugin import main as vdbmain
534                         vdbmain(EMsession)
535                 else:
536                         EMsession.open(MessageBox, text = _('VideoDB is not installed!'), type = MessageBox.TYPE_ERROR)
537         elif answer == "TIMERS":
538                 from Screens.TimerEdit import TimerEditList
539                 EMsession.open(TimerEditList)
540         elif answer is not None and "++++" in answer:
541                 plugToRun = answer[4:]
542                 try:
543                         inpf = open(("/usr/lib/enigma2/python/Plugins/Extensions/EasyMedia/" + plugToRun + ".plug"), 'rb')
544                         runPlug = pickle.load(inpf)
545                         inpf.close()    
546                         runPlug(session = EMsession)
547                 except: EMsession.open(MessageBox, text = (plugToRun + " not found!"), type = MessageBox.TYPE_WARNING)
548
549
550