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