| 1 | from enigma import *
|
|---|
| 2 | from crossepglib import *
|
|---|
| 3 | from crossepg_auto import crossepg_auto
|
|---|
| 4 | from crossepg_info import CrossEPG_Info
|
|---|
| 5 | from crossepg_about import CrossEPG_About
|
|---|
| 6 | from crossepg_providers import CrossEPG_Providers
|
|---|
| 7 | from crossepg_setup import CrossEPG_Setup
|
|---|
| 8 | from crossepg_downloader import CrossEPG_Downloader
|
|---|
| 9 | from crossepg_importer import CrossEPG_Importer
|
|---|
| 10 | from crossepg_converter import CrossEPG_Converter
|
|---|
| 11 | from crossepg_loader import CrossEPG_Loader
|
|---|
| 12 | from crossepg_ordering import CrossEPG_Ordering
|
|---|
| 13 | from crossepg_rytec_update import CrossEPG_Rytec_Update
|
|---|
| 14 | from crossepg_xepgdb_update import CrossEPG_Xepgdb_Update
|
|---|
| 15 | from crossepg_locale import _
|
|---|
| 16 |
|
|---|
| 17 | from Screens.Screen import Screen
|
|---|
| 18 | from Screens.MessageBox import MessageBox
|
|---|
| 19 |
|
|---|
| 20 | from Components.Label import Label
|
|---|
| 21 | from Components.Button import Button
|
|---|
| 22 | from Components.MenuList import MenuList
|
|---|
| 23 | from Components.Sources.List import List
|
|---|
| 24 | from Components.MultiContent import MultiContentEntryText
|
|---|
| 25 | from Components.Harddisk import harddiskmanager
|
|---|
| 26 | from Components.PluginComponent import plugins
|
|---|
| 27 | from Components.ActionMap import ActionMap
|
|---|
| 28 | from Tools.LoadPixmap import LoadPixmap
|
|---|
| 29 | from Tools.Directories import resolveFilename, SCOPE_PLUGINS
|
|---|
| 30 | from Plugins.Plugin import PluginDescriptor
|
|---|
| 31 |
|
|---|
| 32 | from time import *
|
|---|
| 33 |
|
|---|
| 34 | try:
|
|---|
| 35 | from version import version
|
|---|
| 36 | except Exception, e:
|
|---|
| 37 | pass
|
|---|
| 38 |
|
|---|
| 39 | import _enigma
|
|---|
| 40 |
|
|---|
| 41 | class CrossEPG_Menu(Screen):
|
|---|
| 42 | def __init__(self, session):
|
|---|
| 43 | if (getDesktop(0).size().width() < 800):
|
|---|
| 44 | skin = "%s/skins/menu_sd.xml" % os.path.dirname(sys.modules[__name__].__file__)
|
|---|
| 45 | else:
|
|---|
| 46 | skin = "%s/skins/menu_hd.xml" % os.path.dirname(sys.modules[__name__].__file__)
|
|---|
| 47 | f = open(skin, "r")
|
|---|
| 48 | self.skin = f.read()
|
|---|
| 49 | f.close()
|
|---|
| 50 | Screen.__init__(self, session)
|
|---|
| 51 |
|
|---|
| 52 | self.config = CrossEPG_Config()
|
|---|
| 53 | self.config.load()
|
|---|
| 54 | self.patchtype = getEPGPatchType()
|
|---|
| 55 |
|
|---|
| 56 | l = []
|
|---|
| 57 | l.append(self.buildListEntry(_("Configure"), "configure.png"))
|
|---|
| 58 | l.append(self.buildListEntry(_("XMLTV providers"), "xmltv.png"))
|
|---|
| 59 | l.append(self.buildListEntry(_("OpenTV providers"), "opentv.png"))
|
|---|
| 60 | l.append(self.buildListEntry(_("XEPGDB providers"), "xepgdb.png"))
|
|---|
| 61 | l.append(self.buildListEntry(_("Scripts providers"), "scripts.png"))
|
|---|
| 62 | l.append(self.buildListEntry(_("MHW2 providers"), "opentv.png"))
|
|---|
| 63 | l.append(self.buildListEntry(_("Providers start order"), "reorder.png"))
|
|---|
| 64 | l.append(self.buildListEntry(_("Update rytec providers"), "rytec_small.png"))
|
|---|
| 65 | l.append(self.buildListEntry(_("Update xepgdb providers"), "xepgdb.png"))
|
|---|
| 66 | l.append(self.buildListEntry(_("Download now"), "download.png"))
|
|---|
| 67 | l.append(self.buildListEntry(_("Force csv import now"), "csv.png"))
|
|---|
| 68 | l.append(self.buildListEntry(_("Force epg.dat conversion now"), "conversion.png"))
|
|---|
| 69 | l.append(self.buildListEntry(_("Force epg reload"), "reload.png"))
|
|---|
| 70 | l.append(self.buildListEntry(_("Info about database"), "dbinfo.png"))
|
|---|
| 71 | l.append(self.buildListEntry(_("About"), "about.png"))
|
|---|
| 72 |
|
|---|
| 73 | self["list"] = List(l)
|
|---|
| 74 | self["setupActions"] = ActionMap(["SetupActions"],
|
|---|
| 75 | {
|
|---|
| 76 | "cancel": self.quit,
|
|---|
| 77 | "ok": self.openSelected,
|
|---|
| 78 | }, -2)
|
|---|
| 79 |
|
|---|
| 80 | self.onFirstExecBegin.append(self.setTitleWithVerion)
|
|---|
| 81 |
|
|---|
| 82 | if self.config.configured == 0:
|
|---|
| 83 | self.onFirstExecBegin.append(self.openSetup)
|
|---|
| 84 |
|
|---|
| 85 | def buildListEntry(self, description, image):
|
|---|
| 86 | pixmap = LoadPixmap(cached=True, path="%s/images/%s" % (os.path.dirname(sys.modules[__name__].__file__), image));
|
|---|
| 87 | return((pixmap, description))
|
|---|
| 88 |
|
|---|
| 89 | def openSetup(self):
|
|---|
| 90 | self.session.open(CrossEPG_Setup)
|
|---|
| 91 |
|
|---|
| 92 | def setTitleWithVerion(self):
|
|---|
| 93 | try:
|
|---|
| 94 | global version
|
|---|
| 95 | self.setTitle("CrossEPG - %s" % version)
|
|---|
| 96 | except Exception, e:
|
|---|
| 97 | self.setTitle("CrossEPG - unknow version")
|
|---|
| 98 |
|
|---|
| 99 | def openSelected(self):
|
|---|
| 100 | index = self["list"].getIndex()
|
|---|
| 101 | if index == 0:
|
|---|
| 102 | self.session.open(CrossEPG_Setup)
|
|---|
| 103 | elif index == 1:
|
|---|
| 104 | self.session.open(CrossEPG_Providers, "xmltv")
|
|---|
| 105 | elif index == 2:
|
|---|
| 106 | self.session.open(CrossEPG_Providers, "opentv")
|
|---|
| 107 | elif index == 3:
|
|---|
| 108 | self.session.open(CrossEPG_Providers, "xepgdb")
|
|---|
| 109 | elif index == 4:
|
|---|
| 110 | self.session.open(CrossEPG_Providers, "script")
|
|---|
| 111 | elif index == 5:
|
|---|
| 112 | self.session.open(CrossEPG_Providers, "mhw2")
|
|---|
| 113 | elif index == 6:
|
|---|
| 114 | self.session.open(CrossEPG_Ordering)
|
|---|
| 115 | elif index == 7:
|
|---|
| 116 | self.session.open(CrossEPG_Rytec_Update)
|
|---|
| 117 | elif index == 8:
|
|---|
| 118 | self.session.open(CrossEPG_Xepgdb_Update)
|
|---|
| 119 | elif index == 9:
|
|---|
| 120 | self.config.load()
|
|---|
| 121 | self.config.deleteLog()
|
|---|
| 122 | self.downloader()
|
|---|
| 123 | elif index == 10:
|
|---|
| 124 | self.importer()
|
|---|
| 125 | elif index == 11:
|
|---|
| 126 | self.converter()
|
|---|
| 127 | elif index == 12:
|
|---|
| 128 | self.loader()
|
|---|
| 129 | elif index == 13:
|
|---|
| 130 | self.session.open(CrossEPG_Info)
|
|---|
| 131 | elif index == 14:
|
|---|
| 132 | self.session.open(CrossEPG_About)
|
|---|
| 133 |
|
|---|
| 134 | def quit(self):
|
|---|
| 135 | self.close()
|
|---|
| 136 |
|
|---|
| 137 | def downloader(self):
|
|---|
| 138 | self.config.load()
|
|---|
| 139 | self.session.openWithCallback(self.downloadCallback, CrossEPG_Downloader, self.config.providers)
|
|---|
| 140 |
|
|---|
| 141 | def downloadCallback(self, ret):
|
|---|
| 142 | if ret:
|
|---|
| 143 | if self.config.csv_import_enabled == 1:
|
|---|
| 144 | self.importer()
|
|---|
| 145 | else:
|
|---|
| 146 | if self.patchtype != 3:
|
|---|
| 147 | self.converter()
|
|---|
| 148 | else:
|
|---|
| 149 | self.loader()
|
|---|
| 150 |
|
|---|
| 151 | def importer(self):
|
|---|
| 152 | self.session.openWithCallback(self.importerCallback, CrossEPG_Importer)
|
|---|
| 153 |
|
|---|
| 154 | def importerCallback(self, ret):
|
|---|
| 155 | if ret:
|
|---|
| 156 | if self.patchtype != 3:
|
|---|
| 157 | self.converter()
|
|---|
| 158 | else:
|
|---|
| 159 | self.loader()
|
|---|
| 160 |
|
|---|
| 161 | def converter(self):
|
|---|
| 162 | self.session.openWithCallback(self.converterCallback, CrossEPG_Converter)
|
|---|
| 163 |
|
|---|
| 164 | def converterCallback(self, ret):
|
|---|
| 165 | if ret:
|
|---|
| 166 | if self.patchtype != -1:
|
|---|
| 167 | self.loader()
|
|---|
| 168 | else:
|
|---|
| 169 | if self.config.download_manual_reboot:
|
|---|
| 170 | from Screens.Standby import TryQuitMainloop
|
|---|
| 171 | self.session.open(TryQuitMainloop, 3)
|
|---|
| 172 |
|
|---|
| 173 | def loader(self):
|
|---|
| 174 | self.session.open(CrossEPG_Loader)
|
|---|
| 175 |
|
|---|