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