| 1 | from Screens.Screen import Screen
|
|---|
| 2 | from Components.ActionMap import ActionMap
|
|---|
| 3 | from Components.ConfigList import ConfigList
|
|---|
| 4 | from Components.config import config, ConfigSubsection, ConfigYesNo
|
|---|
| 5 | from Components.Console import Console
|
|---|
| 6 | from Screens.Console import Console as Screen_Console
|
|---|
| 7 | from Screens.MessageBox import MessageBox
|
|---|
| 8 | from Components.Sources.List import List
|
|---|
| 9 | from Plugins.Plugin import PluginDescriptor
|
|---|
| 10 | from os import path as os_path, system as os_system
|
|---|
| 11 | from enigma import eConsoleAppContainer, evfd, getDesktop
|
|---|
| 12 | from time import sleep as time_sleep
|
|---|
| 13 |
|
|---|
| 14 | from __init__ import _
|
|---|
| 15 |
|
|---|
| 16 | from GlobalFunctions import MC_MessageBox, MC_ChoiceBox
|
|---|
| 17 | from Plugins.Extensions.Aafpanel.plugin import command
|
|---|
| 18 |
|
|---|
| 19 | # Plugins
|
|---|
| 20 | from MC_AudioPlayer import MC_AudioPlayer
|
|---|
| 21 | from MC_VideoPlayer import MC_VideoPlayer
|
|---|
| 22 | from MC_RadioPlayer import MC_RadioPlayer
|
|---|
| 23 | from MC_PictureViewer import MC_PictureViewer
|
|---|
| 24 | from MC_WeatherInfo import WeatherPlugin
|
|---|
| 25 | from MC_Settings import MC_Settings
|
|---|
| 26 | from MC_WebRadioFS import WebradioScreenBrowser
|
|---|
| 27 | from MC_FileBrowser import MC_FileBrowser
|
|---|
| 28 | from MC_AppleTrailer import MC_AppleTrailer
|
|---|
| 29 | from MC_MyVideo import MC_MyVideo
|
|---|
| 30 |
|
|---|
| 31 | emu = "none"
|
|---|
| 32 | cemu = "none"
|
|---|
| 33 |
|
|---|
| 34 | config.plugins.MediaCenter = ConfigSubsection()
|
|---|
| 35 | config.plugins.MediaCenter.Enabled = ConfigYesNo(default=False)
|
|---|
| 36 | config.plugins.mc_playing = ConfigSubsection()
|
|---|
| 37 | config.plugins.mc_playing.Enabled = ConfigYesNo(default=False)
|
|---|
| 38 |
|
|---|
| 39 | boxversion = command('cat /etc/model')
|
|---|
| 40 |
|
|---|
| 41 | class DMC_MainMenu(Screen):
|
|---|
| 42 | def __init__(self, session):
|
|---|
| 43 | global emu, cemu
|
|---|
| 44 | Screen.__init__(self, session)
|
|---|
| 45 | self.oldService = self.session.nav.getCurrentlyPlayingServiceReference()
|
|---|
| 46 | self.session.nav.stopService()
|
|---|
| 47 | evfd.getInstance().vfd_write_string("MEDIACENTER")
|
|---|
| 48 | Console().ePopen(("/bin/umount -fl `mount | grep fuse | grep rarfs | grep -v '/dev/' | cut -d ' ' -f3`; killall -9 rarfs"))
|
|---|
| 49 | Console().ePopen(("/bin/umount -fl `mount | grep fuse | grep -v '/dev/' | cut -d ' ' -f3`; /bin/umount -fl `mount | grep iso9660 | cut -d ' ' -f3`; killall -9 rarfs fusesmb curlftpfs"))
|
|---|
| 50 |
|
|---|
| 51 | self.container = eConsoleAppContainer()
|
|---|
| 52 | self.container.execute('echo 3 > /proc/sys/vm/drop_caches')
|
|---|
| 53 |
|
|---|
| 54 | cemu = ''
|
|---|
| 55 | cem = open('/var/etc/autostart/start-config')
|
|---|
| 56 | ce = cem.readlines()
|
|---|
| 57 | cem.close()
|
|---|
| 58 | for line in ce:
|
|---|
| 59 | if line.find("emucontrol=") > -1:
|
|---|
| 60 | cemu = line.split('=')
|
|---|
| 61 | cemu = cemu[1].strip()
|
|---|
| 62 | cemu = cemu.replace("\n", "")
|
|---|
| 63 | cemu = cemu.replace('"', "")
|
|---|
| 64 | cemuck = cemu.split(' ')
|
|---|
| 65 | cemuck = cemuck[0]
|
|---|
| 66 |
|
|---|
| 67 | if cemuck.find('y') > -1:
|
|---|
| 68 | print "[MC_plugin] cemuck", cemuck
|
|---|
| 69 |
|
|---|
| 70 | checkactive = command("emu.sh active")
|
|---|
| 71 | if checkactive != '':
|
|---|
| 72 | infoname = command("emu.sh infoname")
|
|---|
| 73 | self.container = eConsoleAppContainer()
|
|---|
| 74 | self.container.execute('emu.sh halt')
|
|---|
| 75 | evfd.getInstance().vfd_write_string( infoname + " Stop" )
|
|---|
| 76 | # time_sleep(2)
|
|---|
| 77 |
|
|---|
| 78 | evfd.getInstance().vfd_write_string("MEDIACENTER")
|
|---|
| 79 | config.plugins.MediaCenter.Enabled = ConfigYesNo(default=True)
|
|---|
| 80 | self.whichPlugin = "None"
|
|---|
| 81 |
|
|---|
| 82 | list = []
|
|---|
| 83 | if config.plugins.mc_globalsettings.showaudioplayer.value is True:
|
|---|
| 84 | list.append((_("My Music"), "MC_AudioPlayer", "menu_music", "50"))
|
|---|
| 85 | if config.plugins.mc_globalsettings.showvideoplayer.value is True:
|
|---|
| 86 | list.append((_("My Videos"), "MC_VideoPlayer", "menu_video", "50"))
|
|---|
| 87 | if config.plugins.mc_globalsettings.showpictureviewer.value is True:
|
|---|
| 88 | list.append((_("My Pictures"), "MC_PictureViewer", "menu_pictures", "50"))
|
|---|
| 89 | #if config.plugins.mc_globalsettings.showmultimediathek.value is True:
|
|---|
| 90 | #list.append((_("Multi Mediathek"), "MultiMediathek", "menu_multimediathek", "50"))
|
|---|
| 91 | if config.plugins.mc_globalsettings.showappletrailer.value is True:
|
|---|
| 92 | list.append((_("Apple Trailer"), "MC_AppleTrailer", "menu_appletrailer", "50"))
|
|---|
| 93 | if config.plugins.mc_globalsettings.showmyvideo.value is True:
|
|---|
| 94 | list.append((_("MyVideo"), "MC_MyVideo", "menu_myvideo", "50"))
|
|---|
| 95 | if config.plugins.mc_globalsettings.showvlcplayer.value is True:
|
|---|
| 96 | list.append((_("Vlc Player"), "VlcPlayer", "menu_vlcplayer", "50"))
|
|---|
| 97 | if config.plugins.mc_globalsettings.showfilebrowser.value is True:
|
|---|
| 98 | list.append((_("Filebrowser"), "MC_FileBrowser", "menu_browser", "50"))
|
|---|
| 99 | if boxversion.upper() == 'UFS912' or boxversion.upper() == 'AT7500':
|
|---|
| 100 | if config.plugins.mc_globalsettings.showinternetbrowser.value is True:
|
|---|
| 101 | list.append((_("Internet Browser"), "MC_Qtbrowser", "menu_qtbrowser", "50"))
|
|---|
| 102 | if config.plugins.mc_globalsettings.showradioplayer.value is True:
|
|---|
| 103 | list.append((_("Radio Player"), "MC_RadioPlayer", "menu_radio", "50"))
|
|---|
| 104 | if config.plugins.mc_globalsettings.showwebradio.value is True:
|
|---|
| 105 | list.append((_("WebRadioFS"), "MC_WebRadioFS", "menu_webradiofs", "50"))
|
|---|
| 106 | if config.plugins.mc_globalsettings.showweatherinfo.value is True:
|
|---|
| 107 | list.append((_("Weather Info"), "MC_WeatherInfo", "menu_weather", "50"))
|
|---|
| 108 | list.append((_("Settings"), "MC_Settings", "menu_settings", "50"))
|
|---|
| 109 | self["menu"] = List(list)
|
|---|
| 110 |
|
|---|
| 111 | self["actions"] = ActionMap(["OkCancelActions"],
|
|---|
| 112 | {
|
|---|
| 113 | "cancel": self.Exit,
|
|---|
| 114 | "ok": self.okbuttonClick
|
|---|
| 115 | }, -1)
|
|---|
| 116 |
|
|---|
| 117 | # start checking mayhemIII skinversion for updates
|
|---|
| 118 | self.onFirstExecBegin.append(self.checkmayhemIIIskin)
|
|---|
| 119 |
|
|---|
| 120 | def okbuttonClick(self):
|
|---|
| 121 | print "[MC_plugin] okbuttonClick"
|
|---|
| 122 | selection = self["menu"].getCurrent()
|
|---|
| 123 | if selection is not None:
|
|---|
| 124 | if selection[1] == "MC_VideoPlayer":
|
|---|
| 125 | self.session.open(MC_VideoPlayer)
|
|---|
| 126 |
|
|---|
| 127 | elif selection[1] == "MC_FileBrowser":
|
|---|
| 128 | self.session.open(MC_FileBrowser)
|
|---|
| 129 |
|
|---|
| 130 | elif selection[1] == "MC_PictureViewer":
|
|---|
| 131 | self.session.open(MC_PictureViewer)
|
|---|
| 132 |
|
|---|
| 133 | elif selection[1] == "MC_AudioPlayer":
|
|---|
| 134 | self.session.open(MC_AudioPlayer)
|
|---|
| 135 |
|
|---|
| 136 | elif selection[1] == "MC_RadioPlayer":
|
|---|
| 137 | ret = os_system("checknet")
|
|---|
| 138 | if ret == 0:
|
|---|
| 139 | self.session.open(MC_RadioPlayer)
|
|---|
| 140 | else:
|
|---|
| 141 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 142 |
|
|---|
| 143 | elif selection[1] == "MC_Qtbrowser":
|
|---|
| 144 | ret = os_system("checknet")
|
|---|
| 145 | if ret == 0:
|
|---|
| 146 | if os_path.isfile("/var/bin/browser/browser") == True:
|
|---|
| 147 | self.session.openWithCallback(self.startQT, MC_MessageBox,_("Do you really want to start the Internetbrowser? Enigma2 will be killed and the Browser will be started!"), MC_MessageBox.TYPE_YESNO)
|
|---|
| 148 | else:
|
|---|
| 149 | self.whichPlugin = "qtbrowser" # set Plugin for self.downloadplugin
|
|---|
| 150 | self.session.openWithCallback(self.downloadPlugin, MC_ChoiceBox, title=_("QT Browser is not installed! Download it?"), list=[(_("Yes! Try to install to flash!"), "flash"), (_("No! Do not install!"), "no")])
|
|---|
| 151 | else:
|
|---|
| 152 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 153 |
|
|---|
| 154 | elif selection[1] == "MC_AppleTrailer":
|
|---|
| 155 | ret = os_system("checknet")
|
|---|
| 156 | if ret == 0:
|
|---|
| 157 | self.session.open(MC_AppleTrailer)
|
|---|
| 158 | else:
|
|---|
| 159 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 160 |
|
|---|
| 161 | elif selection[1] == "MC_MyVideo":
|
|---|
| 162 | ret = os_system("checknet")
|
|---|
| 163 | if ret == 0:
|
|---|
| 164 | self.session.open(MC_MyVideo)
|
|---|
| 165 | else:
|
|---|
| 166 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 167 |
|
|---|
| 168 | elif selection[1] == "MultiMediathek":
|
|---|
| 169 | ret = os_system("checknet")
|
|---|
| 170 | if ret == 0:
|
|---|
| 171 | if os_path.exists("/usr/lib/enigma2/python/Plugins/Extensions/MultiMediathek/") == True:
|
|---|
| 172 | from Plugins.Extensions.MultiMediathek.plugin import *
|
|---|
| 173 | self.session.open(MultiMediathek)
|
|---|
| 174 | else:
|
|---|
| 175 | if os_path.exists("/var/swap/extensions/MultiMediathek/") == True:
|
|---|
| 176 | self.session.open(MC_MessageBox, _("The MultiMediathek plugin is installed in swap extensions but not mounted! Please restart your box so that the plugin will work correctly!"), MC_MessageBox.TYPE_INFO)
|
|---|
| 177 | else:
|
|---|
| 178 | self.whichPlugin = "multimediathek" # set Plugin for self.downloadplugin
|
|---|
| 179 | if os_path.exists("/var/swap/extensions/"):
|
|---|
| 180 | self.session.openWithCallback(self.downloadPlugin, MC_ChoiceBox, title=_("MultiMediathek is not installed! Download it?"), list=[(_("Yes! Try to install to flash!"), "flash"), (_("Yes! Try to install to swap extensions!"), "swap"), (_("No! Do not install!"), "no")])
|
|---|
| 181 | else:
|
|---|
| 182 | self.session.openWithCallback(self.downloadPlugin, MC_ChoiceBox, title=_("MultiMediathek is not installed! Download it?"), list=[(_("Yes! Try to install to flash!"), "flash"), (_("No! Do not install!"), "no")])
|
|---|
| 183 | else:
|
|---|
| 184 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 185 |
|
|---|
| 186 |
|
|---|
| 187 | elif selection[1] == "VlcPlayer":
|
|---|
| 188 | ret = os_system("checknet")
|
|---|
| 189 | if ret == 0:
|
|---|
| 190 | if os_path.exists("/usr/lib/enigma2/python/Plugins/Extensions/VlcPlayer/") == True:
|
|---|
| 191 | from Plugins.Extensions.VlcPlayer.plugin import main as vlcplugin
|
|---|
| 192 | vlcplugin(self.session)
|
|---|
| 193 | else:
|
|---|
| 194 | if os_path.exists("/var/swap/extensions/VlcPlayer/") == True:
|
|---|
| 195 | self.session.open(MC_MessageBox, _("The VLC Player plugin is installed in swap extensions but not mounted! Please restart your box so that the plugin will work correctly!"), MC_MessageBox.TYPE_INFO)
|
|---|
| 196 | else:
|
|---|
| 197 | self.whichPlugin = "vlcplayer" # set Plugin for self.downloadplugin
|
|---|
| 198 | if os_path.exists("/var/swap/extensions/"):
|
|---|
| 199 | self.session.openWithCallback(self.downloadPlugin, MC_ChoiceBox, title=_("VLC Player is not installed! Download it?"), list=[(_("Yes! Try to install to flash!"), "flash"), (_("Yes! Try to install to swap extensions!"), "swap"), (_("No! Do not install!"), "no")])
|
|---|
| 200 | else:
|
|---|
| 201 | self.session.openWithCallback(self.downloadPlugin, MC_ChoiceBox, title=_("VLC Player is not installed! Download it?"), list=[(_("Yes! Try to install to flash!"), "flash"), (_("No! Do not install!"), "no")])
|
|---|
| 202 |
|
|---|
| 203 | else:
|
|---|
| 204 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 205 |
|
|---|
| 206 | elif selection[1] == "MC_WebRadioFS":
|
|---|
| 207 | ret = os_system("checknet")
|
|---|
| 208 | if ret == 0:
|
|---|
| 209 | self.session.open(WebradioScreenBrowser)
|
|---|
| 210 | else:
|
|---|
| 211 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 212 |
|
|---|
| 213 | elif selection[1] == "MC_WeatherInfo":
|
|---|
| 214 | ret = os_system("checknet")
|
|---|
| 215 | if ret == 0:
|
|---|
| 216 | self.session.open(WeatherPlugin)
|
|---|
| 217 | else:
|
|---|
| 218 | self.session.open(MC_MessageBox, _("Start of application without internet not allowed."), type = MC_MessageBox.TYPE_INFO, timeout = 10)
|
|---|
| 219 |
|
|---|
| 220 | elif selection[1] == "MC_Settings":
|
|---|
| 221 | self.session.open(MC_Settings)
|
|---|
| 222 |
|
|---|
| 223 | else:
|
|---|
| 224 | self.session.open(MC_MessageBox,(_("Error: Could not find plugin %s\ncoming soon ... :)")) % (selection[1]), MC_MessageBox.TYPE_INFO)
|
|---|
| 225 |
|
|---|
| 226 | def downloadPlugin(self, answer):
|
|---|
| 227 | if answer is not None and answer[1] != "no":
|
|---|
| 228 | ipkurl = command('cat /var/etc/ipkg/official-feed.conf | cut -d " " -f3')
|
|---|
| 229 | os_system('ipkg update')
|
|---|
| 230 | if answer[1] == "flash":
|
|---|
| 231 | if self.whichPlugin == "qtbrowser": # other package name for QTBrowser
|
|---|
| 232 | ipktype = "enigma2-plugin-browsers-"
|
|---|
| 233 | else:
|
|---|
| 234 | ipktype = "enigma2-plugin-mediacenter-"
|
|---|
| 235 | print "[MC_plugin] install %s to flash" % self.whichPlugin
|
|---|
| 236 | if answer[1] == "swap":
|
|---|
| 237 | ipktype = "enigma2-plugin-swapmediacenter-"
|
|---|
| 238 | print "[MC_plugin] install %s to swap extensions" % self.whichPlugin
|
|---|
| 239 | ipkpackage = command('cat /usr/lib/ipkg/cross | grep "Filename: ' + ipktype + '" | grep -m1 ' + self.whichPlugin + ' | sed "s/Filename: //"')
|
|---|
| 240 | print "[MC_plugin] download this package:", ipkpackage
|
|---|
| 241 | self.session.open(Screen_Console, title = _("installing plugin..."), cmdlist = ["ipkg install " + ipkurl +"/" + ipkpackage], closeOnSuccess = False)
|
|---|
| 242 |
|
|---|
| 243 | def checkmayhemIIIskin(self):
|
|---|
| 244 | actualversion = "4.0" # always add needed mayhemIII version here
|
|---|
| 245 | self.usemayhemIII = command('cat /etc/enigma2/settings | grep config.plugins.mc_globalsettings.currentskin.path | grep mayhemIII | tr "=" "\n" | tail -n 1')
|
|---|
| 246 | if self.usemayhemIII != "" and os_path.isfile(self.usemayhemIII): # check for actual mayhemIII and check for existing skin.xml
|
|---|
| 247 | print "[MC_plugin] current skin: mayhemIII detected!"
|
|---|
| 248 | self.mayhemIIIversion = command('cat ' + self.usemayhemIII + ' | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 4 | tail -n 1 | sed "s/v//"')
|
|---|
| 249 | print "[MC_plugin] mayhemIII version is:", self.mayhemIIIversion
|
|---|
| 250 | print "[MC_plugin] actual mayhemIII version is:", actualversion
|
|---|
| 251 | # Check that self.mayhemIIIversion has the correct format otherwise set an old version to download a new skin...
|
|---|
| 252 | if self.mayhemIIIversion is None or self.mayhemIIIversion == "":
|
|---|
| 253 | self.mayhemIIIversion = "1.0"
|
|---|
| 254 | if self.mayhemIIIversion[-2] != ".":
|
|---|
| 255 | self.mayhemIIIversion = "1.0"
|
|---|
| 256 | if float(self.mayhemIIIversion) < float(actualversion):
|
|---|
| 257 | print "[MC_plugin] WARNING: Please update your mayhemIII skin!"
|
|---|
| 258 | self.session.openWithCallback(self.updatemayhemIII, MC_ChoiceBox, title=_("MayhemIII not up to date! Update now?"), list=[(_("Yes! Try to update the skin!"), "yes"), (_("No! Do not update the skin!"), "no")])
|
|---|
| 259 | self.session.open(MC_MessageBox, _("The mayhemIII skin you are using is not up to date! Maybe it will cause errors! Please update your mayhemIII skin!"), type = MC_MessageBox.TYPE_INFO, timeout = 30)
|
|---|
| 260 | else: # check the correct mayhemIII size
|
|---|
| 261 | print "[MC_plugin] check correct mayhemIII resolution..."
|
|---|
| 262 | if getDesktop(0).size().width() == 720:
|
|---|
| 263 | print "[MC_plugin] detected e2-SD skin! No mayhemIII will work!"
|
|---|
| 264 | self.session.open(MC_MessageBox, _("In e2 you activated a SD skin but the MediaCenter skin is a mayhemIII skin! This skin has got another resolution and will not fit correctly on your TV screen!\nPlease choose a KingSize- or an HD-enigma2 skin or activate the Default Skin in the MediaCenter settings!"), type = MC_MessageBox.TYPE_INFO, timeout = 30)
|
|---|
| 265 | else:
|
|---|
| 266 | isHDorKS = command('cat ' + self.usemayhemIII + ' | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 2 | tail -n 1')
|
|---|
| 267 | e2skin = ""
|
|---|
| 268 | if getDesktop(0).size().width() == 1024 and isHDorKS == "MayhemIII-HD" :
|
|---|
| 269 | e2skin = "KingSize"
|
|---|
| 270 | elif getDesktop(0).size().width() == 1280 and isHDorKS == "MayhemIII-KS" :
|
|---|
| 271 | e2skin = "HD"
|
|---|
| 272 | if e2skin != "":
|
|---|
| 273 | print "[MC_plugin] wrong mayhemIII size detected!"
|
|---|
| 274 | #do NOT show MC Messagebox but normal Messagebox so that the whole Message will be shown with every e2 Skin
|
|---|
| 275 | self.session.open(MessageBox, _("The e2 skin you activated is %s size but the MediaCenter skin is the %s skin! This skin will not fit on your TV screen!\nPlease choose the same sized mayhemIII skin or the default skin in the MediaCenter settings!") % (e2skin,isHDorKS), type = MessageBox.TYPE_INFO)
|
|---|
| 276 |
|
|---|
| 277 | def updatemayhemIII(self, answer):
|
|---|
| 278 | if answer is not None and answer[1] != "no":
|
|---|
| 279 | ipkurl = command('cat /var/etc/ipkg/official-feed.conf | cut -d " " -f3')
|
|---|
| 280 | os_system('ipkg update')
|
|---|
| 281 | # hd or kingsize
|
|---|
| 282 | #cat /var/swap/mcskins/mayhemIIIHD/skin.xml | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 2 | tail -n 1
|
|---|
| 283 | # MayhemIII-HD
|
|---|
| 284 | # MayhemIII-KS
|
|---|
| 285 | # flash or swap
|
|---|
| 286 | #cat /var/swap/mcskins/mayhemIIIHD/skin.xml | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 3 | tail -n 1
|
|---|
| 287 | #SWAP
|
|---|
| 288 | #FLASH
|
|---|
| 289 | isFLASHorSWAP = command('cat ' + self.usemayhemIII + ' | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 3 | tail -n 1')
|
|---|
| 290 | isHDorKS = command('cat ' + self.usemayhemIII + ' | grep "XBMC Mod by Civer" | tr " " "\n" | head -n 2 | tail -n 1')
|
|---|
| 291 |
|
|---|
| 292 | if isFLASHorSWAP == "FLASH":
|
|---|
| 293 | ipktype = "enigma2-plugin-mediacenter-mayhem3"
|
|---|
| 294 | elif isFLASHorSWAP == "SWAP":
|
|---|
| 295 | ipktype = "enigma2-plugin-swapmediacenter-mayhem3"
|
|---|
| 296 | else:
|
|---|
| 297 | ipktype = ""
|
|---|
| 298 | if isHDorKS == "MayhemIII-HD":
|
|---|
| 299 | ipktype2 = "hd"
|
|---|
| 300 | elif isHDorKS == "MayhemIII-KS":
|
|---|
| 301 | ipktype2 = "ks"
|
|---|
| 302 | else:
|
|---|
| 303 | ipktype2 = ""
|
|---|
| 304 | if ipktype == "" or ipktype2 == "":
|
|---|
| 305 | print "[MC_plugin] ERROR Can not check skin-type!!! Aborting Update..."
|
|---|
| 306 | self.session.open(MC_MessageBox, _("Can not update the skin automatically! Please update the skin manually!"), type = MC_MessageBox.TYPE_INFO, timeout = 30)
|
|---|
| 307 | else:
|
|---|
| 308 | print "[MC_plugin] checking ipk for: " + ipktype + ipktype2
|
|---|
| 309 | ipkpackage = command('cat /usr/lib/ipkg/cross | grep -m1 "Filename: ' + ipktype + ipktype2 + '" | sed "s/Filename: //"')
|
|---|
| 310 | packageversion = command('cat /usr/lib/ipkg/cross | grep -m1 "Filename: ' + ipktype + ipktype2 + '" | sed "s/Filename: //" | tr "_" "\n" | head -n 2 | tail -n1')
|
|---|
| 311 | print "[MC_plugin] package is:", ipkpackage
|
|---|
| 312 | print "[MC_plugin] package version is:", packageversion
|
|---|
| 313 | if float(self.mayhemIIIversion) >= float(packageversion):
|
|---|
| 314 | print "[MC_plugin] cancel update! Version on the server is older....!"
|
|---|
| 315 | self.session.open(MC_MessageBox, _("The mayhemIII skin on the server is older than your version! Canceling the update!"), type = MC_MessageBox.TYPE_INFO, timeout = 30)
|
|---|
| 316 | else:
|
|---|
| 317 | print "[MC_plugin] updating mayhemIII skin!"
|
|---|
| 318 | self.session.open(MC_MessageBox, _("Please restart your box so that the update will take effect!"), type = MC_MessageBox.TYPE_INFO)
|
|---|
| 319 | self.session.open(Screen_Console, title = _("updating skin..."), cmdlist = ["ipkg install -force-overwrite " + ipkurl +"/" + ipkpackage], closeOnSuccess = False)
|
|---|
| 320 |
|
|---|
| 321 | def startQT(self, answer):
|
|---|
| 322 | if answer == True:
|
|---|
| 323 | from Screens.Standby import TryQuitMainloop
|
|---|
| 324 | self.session.open(TryQuitMainloop, 20)
|
|---|
| 325 |
|
|---|
| 326 | def Exit(self):
|
|---|
| 327 | global emu, cemu
|
|---|
| 328 |
|
|---|
| 329 | self.session.nav.stopService()
|
|---|
| 330 | self.session.nav.playService(self.oldService)
|
|---|
| 331 |
|
|---|
| 332 | self.container = eConsoleAppContainer()
|
|---|
| 333 | self.container.execute('echo 3 > /proc/sys/vm/drop_caches')
|
|---|
| 334 |
|
|---|
| 335 | cemu = ''
|
|---|
| 336 | cem = open('/var/etc/autostart/start-config')
|
|---|
| 337 | ce = cem.readlines()
|
|---|
| 338 | cem.close()
|
|---|
| 339 | for line in ce:
|
|---|
| 340 | if line.find("emucontrol=") > -1:
|
|---|
| 341 | cemu = line.split('=')
|
|---|
| 342 | cemu = cemu[1].strip()
|
|---|
| 343 | cemu = cemu.replace("\n", "")
|
|---|
| 344 | cemu = cemu.replace('"', "")
|
|---|
| 345 | cemuck = cemu.split(' ')
|
|---|
| 346 | cemuck = cemuck[0]
|
|---|
| 347 |
|
|---|
| 348 | if cemuck.find('y') > -1:
|
|---|
| 349 | print "[MC_plugin] cemuck", cemuck
|
|---|
| 350 |
|
|---|
| 351 | checkactive = command("emu.sh active")
|
|---|
| 352 | if checkactive != '':
|
|---|
| 353 | infoname = command("emu.sh infoname")
|
|---|
| 354 | self.container = eConsoleAppContainer()
|
|---|
| 355 | self.container.execute('emu.sh unhalt')
|
|---|
| 356 | evfd.getInstance().vfd_write_string( infoname + " Start" )
|
|---|
| 357 |
|
|---|
| 358 | config.plugins.MediaCenter.Enabled = ConfigYesNo(default=False)
|
|---|
| 359 | config.plugins.MediaCenter.save()
|
|---|
| 360 | self.close()
|
|---|
| 361 |
|
|---|
| 362 | def main(session, **kwargs):
|
|---|
| 363 | session.open(DMC_MainMenu)
|
|---|
| 364 |
|
|---|
| 365 | def menu(menuid, **kwargs):
|
|---|
| 366 | if menuid == "mainmenu":
|
|---|
| 367 | return [(_("Media Center"), main, "dmc_mainmenu", 44)]
|
|---|
| 368 | return []
|
|---|
| 369 |
|
|---|
| 370 | def Plugins(**kwargs):
|
|---|
| 371 | if config.plugins.mc_globalsettings.showinmainmenu.value == True and config.plugins.mc_globalsettings.showinextmenu.value == True:
|
|---|
| 372 | return [
|
|---|
| 373 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main),
|
|---|
| 374 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, where = PluginDescriptor.WHERE_MENU, fnc = menu),
|
|---|
| 375 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)]
|
|---|
| 376 | elif config.plugins.mc_globalsettings.showinmainmenu.value == True and config.plugins.mc_globalsettings.showinextmenu.value == False:
|
|---|
| 377 | return [
|
|---|
| 378 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main),
|
|---|
| 379 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, where = PluginDescriptor.WHERE_MENU, fnc = menu)]
|
|---|
| 380 | elif config.plugins.mc_globalsettings.showinmainmenu.value == False and config.plugins.mc_globalsettings.showinextmenu.value == True:
|
|---|
| 381 | return [
|
|---|
| 382 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main),
|
|---|
| 383 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main)]
|
|---|
| 384 | else:
|
|---|
| 385 | return [
|
|---|
| 386 | PluginDescriptor(name = "Media Center", description = "Media Center Plugin for your " + boxversion, icon="plugin.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc = main)]
|
|---|