| 1 | from enigma import getDesktop
|
|---|
| 2 |
|
|---|
| 3 | from Screens.Screen import Screen
|
|---|
| 4 |
|
|---|
| 5 | from Components.Label import Label
|
|---|
| 6 | from Components.Button import Button
|
|---|
| 7 | from Components.ActionMap import ActionMap
|
|---|
| 8 |
|
|---|
| 9 | from crossepglib import *
|
|---|
| 10 | from crossepg_locale import _
|
|---|
| 11 |
|
|---|
| 12 | import os
|
|---|
| 13 | import sys
|
|---|
| 14 |
|
|---|
| 15 | class CrossEPG_Info(Screen):
|
|---|
| 16 | def __init__(self, session):
|
|---|
| 17 | self.session = session
|
|---|
| 18 | if (getDesktop(0).size().width() < 800):
|
|---|
| 19 | skin = "%s/skins/info_sd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
|
|---|
| 20 | else:
|
|---|
| 21 | skin = "%s/skins/info_hd.xml" % (os.path.dirname(sys.modules[__name__].__file__))
|
|---|
| 22 | f = open(skin, "r")
|
|---|
| 23 | self.skin = f.read()
|
|---|
| 24 | f.close()
|
|---|
| 25 |
|
|---|
| 26 | Screen.__init__(self, session)
|
|---|
| 27 |
|
|---|
| 28 | self.config = CrossEPG_Config()
|
|---|
| 29 | self.config.load()
|
|---|
| 30 |
|
|---|
| 31 | self["version"] = Label("")
|
|---|
| 32 | self["create"] = Label("")
|
|---|
| 33 | self["last_update"] = Label("")
|
|---|
| 34 | self["headersdb_size"] = Label("")
|
|---|
| 35 | self["descriptorsdb_size"] = Label("")
|
|---|
| 36 | self["indexesdb_size"] = Label("")
|
|---|
| 37 | self["aliasesdb_size"] = Label("")
|
|---|
| 38 | self["total_size"] = Label("")
|
|---|
| 39 | self["channels_count"] = Label("")
|
|---|
| 40 | self["events_count"] = Label("")
|
|---|
| 41 | self["hashes_count"] = Label("")
|
|---|
| 42 | self["actions"] = ActionMap(["SetupActions", "ColorActions"],
|
|---|
| 43 | {
|
|---|
| 44 | "red": self.quit,
|
|---|
| 45 | "cancel": self.quit
|
|---|
| 46 | }, -2)
|
|---|
| 47 |
|
|---|
| 48 | self["key_red"] = Button(_("Back"))
|
|---|
| 49 | self["key_green"] = Button("")
|
|---|
| 50 | self["key_yellow"] = Button("")
|
|---|
| 51 | self["key_blue"] = Button("")
|
|---|
| 52 |
|
|---|
| 53 | self.wrapper = CrossEPG_Wrapper()
|
|---|
| 54 | self.wrapper.addCallback(self.__wrapperCallback)
|
|---|
| 55 | self.wrapper.init(CrossEPG_Wrapper.CMD_INFO, self.config.db_root)
|
|---|
| 56 |
|
|---|
| 57 | def quit(self):
|
|---|
| 58 | if not self.wrapper.running():
|
|---|
| 59 | self.close()
|
|---|
| 60 |
|
|---|
| 61 | def __wrapperCallback(self, event, param):
|
|---|
| 62 | if event == CrossEPG_Wrapper.INFO_HEADERSDB_SIZE:
|
|---|
| 63 | self["headersdb_size"].text = _("Headers db size: %s") % (param)
|
|---|
| 64 | elif event == CrossEPG_Wrapper.INFO_DESCRIPTORSDB_SIZE:
|
|---|
| 65 | self["descriptorsdb_size"].text = _("Descriptors db size: %s") % (param)
|
|---|
| 66 | elif event == CrossEPG_Wrapper.INFO_INDEXESDB_SIZE:
|
|---|
| 67 | self["indexesdb_size"].text = _("Indexes db size: %s") % (param)
|
|---|
| 68 | elif event == CrossEPG_Wrapper.INFO_ALIASESDB_SIZE:
|
|---|
| 69 | self["aliasesdb_size"].text = _("Aliases db size: %s") % (param)
|
|---|
| 70 | elif event == CrossEPG_Wrapper.INFO_TOTAL_SIZE:
|
|---|
| 71 | self["total_size"].text = _("Total size: %s") % (param)
|
|---|
| 72 | elif event == CrossEPG_Wrapper.INFO_CHANNELS_COUNT:
|
|---|
| 73 | self["channels_count"].text = _("Channels count: %s") % (param)
|
|---|
| 74 | elif event == CrossEPG_Wrapper.INFO_EVENTS_COUNT:
|
|---|
| 75 | self["events_count"].text = _("Events count: %s") % (param)
|
|---|
| 76 | elif event == CrossEPG_Wrapper.INFO_HASHES_COUNT:
|
|---|
| 77 | self["hashes_count"].text = _("Hashes count: %s") % (param)
|
|---|
| 78 | elif event == CrossEPG_Wrapper.INFO_CREATION_TIME:
|
|---|
| 79 | self["create"].text = _("Creation time: %s") % (param)
|
|---|
| 80 | elif event == CrossEPG_Wrapper.INFO_UPDATE_TIME:
|
|---|
| 81 | self["last_update"].text = _("Last update time: %s") % (param)
|
|---|
| 82 | elif event == CrossEPG_Wrapper.INFO_VERSION:
|
|---|
| 83 | self["version"].text = _("Version: %s") % (param)
|
|---|
| 84 |
|
|---|