Merge branch 'experimental' into vuplus_experimental
authorikseong <ikseong@vuplus>
Fri, 16 Jul 2010 02:02:15 +0000 (11:02 +0900)
committerikseong <ikseong@vuplus>
Fri, 16 Jul 2010 02:02:15 +0000 (11:02 +0900)
Conflicts:

lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py

lib/base/console.cpp
lib/dvb/frontend.cpp
lib/gdi/lcd.cpp
lib/python/Plugins/SystemPlugins/SoftwareManager/SoftwareTools.py
lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py
lib/python/Screens/Ipkg.py
lib/python/Tools/NumericalTextInput.py
lib/service/servicemp3.cpp
lib/service/servicemp3.h

index add8706..43f9f61 100644 (file)
@@ -516,18 +516,15 @@ eConsolePy_write(eConsolePy* self, PyObject *args)
 {
        int len;
        char *data;
-       if (PyArg_ParseTuple(args, "si", &data, &len))
-               ;
-       else
+       int ret = -1;
+       Py_ssize_t argc = PyTuple_Size(args);
+       if (argc > 1)
+               ret = PyArg_ParseTuple(args, "si", &data, &len);
+       else if (argc == 1)
        {
                PyObject *ob;
-               if (!PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob))
-               {
-                       PyErr_SetString(PyExc_TypeError,
-                               "1st arg must be a string, optionaly 2nd arg can be the string length");
-                       return NULL;
-               }
-               else
+               ret = !PyArg_ParseTuple(args, "O", &ob) || !PyString_Check(ob);
+               if (!ret)
                {
                        Py_ssize_t length;
                        if (!PyString_AsStringAndSize(ob, &data, &length))
@@ -536,6 +533,12 @@ eConsolePy_write(eConsolePy* self, PyObject *args)
                                len = 0;
                }
        }
+       if (ret)
+       {
+               PyErr_SetString(PyExc_TypeError,
+                       "1st arg must be a string, optionaly 2nd arg can be the string length");
+               return NULL;
+       }
        self->cont->write(data, len);
        Py_RETURN_NONE;
 }
index cf36eb0..843a518 100755 (executable)
@@ -924,6 +924,19 @@ int eDVBFrontend::readFrontendData(int type)
                        }
                        else if (strstr(m_description, "BCM4506") || strstr(m_description, "BCM4505"))
                                ret = (snr * 100) >> 8;
+                       else if (!strcmp(m_description, "CXD1981"))
+                       {
+                               int mse = (~snr) & 0xFF;
+                               switch (parm_u_qam_modulation) {
+                                       case QAM_16:
+                                       case QAM_64:
+                                       case QAM_256: ret = (int)(-950 * log(((double)mse) / 760)); break;
+                                       case QAM_32:
+                                       case QAM_128: ret = (int)(-875 * log(((double)mse) / 650)); break;
+
+                                       default: break;
+                               }
+                       }
 
                        if (type == signalQuality)
                        {
index 9cb657c..9f43e35 100755 (executable)
@@ -199,14 +199,8 @@ void eDBoxLCD::update()
                        }
                        write(lcdfd, raw, 132*8);
                }
-               else if (is_oled == 3) {
-                       FILE *f = fopen("/tmp/bla", "w+");
-                       if (f) {
-                               fwrite(_buffer, _stride * res.height(), 1, f);
-                               fclose(f);
-                       }
+               else if (is_oled == 3)
                        write(lcdfd, _buffer, _stride * res.height());
-               }
                else
                {
                        unsigned char raw[64*64];
index d4653cc..a29a5e9 100755 (executable)
@@ -1,4 +1,5 @@
-from enigma import eConsoleAppContainer
+# -*- coding: iso-8859-1 -*-
+from enigma import eConsoleAppContainer,eTPM
 from Components.Console import Console
 from Components.About import about
 from Components.DreamInfoHandler import DreamInfoHandler
@@ -8,9 +9,49 @@ from Components.Ipkg import IpkgComponent
 from Components.Network import iNetwork
 from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_METADIR
 from Tools.HardwareInfo import HardwareInfo
+import sha
 
 from time import time
 
+def bin2long(s):
+       return reduce( lambda x,y:(x<<8L)+y, map(ord, s))
+
+def long2bin(l):
+       res = ""
+       for byte in range(128):
+               res += chr((l >> (1024 - (byte + 1) * 8)) & 0xff)
+       return res
+
+def rsa_pub1024(src, mod):
+       return long2bin(pow(bin2long(src), 65537, bin2long(mod)))
+       
+def decrypt_block(src, mod):
+       if len(src) != 128 and len(src) != 202:
+               return None
+       dest = rsa_pub1024(src[:128], mod)
+       hash = sha.new(dest[1:107])
+       if len(src) == 202:
+               hash.update(src[131:192])       
+       result = hash.digest()
+       if result == dest[107:127]:
+               return dest
+       return None
+
+def validate_cert(cert, key):
+       buf = decrypt_block(cert[8:], key) 
+       if buf is None:
+               return None
+       return buf[36:107] + cert[139:196]
+
+def read_random():
+       try:
+               fd = open("/dev/urandom", "r")
+               buf = fd.read(8)
+               fd.close()
+               return buf
+       except:
+               return None
+
 class SoftwareTools(DreamInfoHandler):
        lastDownloadDate = None
        NetworkConnectionAvailable = None
@@ -58,24 +99,71 @@ class SoftwareTools(DreamInfoHandler):
                                self.getUpdates()
 
        def getUpdates(self, callback = None):
-               if SoftwareTools.NetworkConnectionAvailable == True:
-                       SoftwareTools.lastDownloadDate = time()
-                       if SoftwareTools.list_updating is False and callback is None:
-                               SoftwareTools.list_updating = True
-                               self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
-                       elif SoftwareTools.list_updating is False and callback is not None:
-                               SoftwareTools.list_updating = True
-                               self.NotifierCallback = callback
-                               self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
-                       elif SoftwareTools.list_updating is True and callback is not None:
-                               #update info collecting already in progress
-                               self.NotifierCallback = callback
+               if SoftwareTools.lastDownloadDate is None:
+                       if  self.hardware_info.device_name != "dm7025":
+                               rootkey = ['\x9f', '|', '\xe4', 'G', '\xc9', '\xb4', '\xf4', '#', '&', '\xce', '\xb3', '\xfe', '\xda', '\xc9', 'U', '`', '\xd8', '\x8c', 's', 'o', '\x90', '\x9b', '\\', 'b', '\xc0', '\x89', '\xd1', '\x8c', '\x9e', 'J', 'T', '\xc5', 'X', '\xa1', '\xb8', '\x13', '5', 'E', '\x02', '\xc9', '\xb2', '\xe6', 't', '\x89', '\xde', '\xcd', '\x9d', '\x11', '\xdd', '\xc7', '\xf4', '\xe4', '\xe4', '\xbc', '\xdb', '\x9c', '\xea', '}', '\xad', '\xda', 't', 'r', '\x9b', '\xdc', '\xbc', '\x18', '3', '\xe7', '\xaf', '|', '\xae', '\x0c', '\xe3', '\xb5', '\x84', '\x8d', '\r', '\x8d', '\x9d', '2', '\xd0', '\xce', '\xd5', 'q', '\t', '\x84', 'c', '\xa8', ')', '\x99', '\xdc', '<', '"', 'x', '\xe8', '\x87', '\x8f', '\x02', ';', 'S', 'm', '\xd5', '\xf0', '\xa3', '_', '\xb7', 'T', '\t', '\xde', '\xa7', '\xf1', '\xc9', '\xae', '\x8a', '\xd7', '\xd2', '\xcf', '\xb2', '.', '\x13', '\xfb', '\xac', 'j', '\xdf', '\xb1', '\x1d', ':', '?']
+                               etpm = eTPM()
+                               l2cert = etpm.getCert(eTPM.TPMD_DT_LEVEL2_CERT)
+                               if l2cert is None:
+                                       return
+                               l2key = validate_cert(l2cert, rootkey)
+                               if l2key is None:
+                                       return
+                               l3cert = etpm.getCert(eTPM.TPMD_DT_LEVEL3_CERT)
+                               if l3cert is None:
+                                       print "please run the genuine dreambox plugin"
+                                       return
+                               l3key = validate_cert(l3cert, l2key)
+                               if l3key is None:
+                                       return
+                               rnd = read_random()
+                               if rnd is None:
+                                       return
+                               val = etpm.challenge(rnd)
+                               result = decrypt_block(val, l3key)
+                       if self.hardware_info.device_name == "dm7025" or result[80:88] == rnd:
+                               if SoftwareTools.NetworkConnectionAvailable == True:
+                                       SoftwareTools.lastDownloadDate = time()
+                                       if SoftwareTools.list_updating is False and callback is None:
+                                               SoftwareTools.list_updating = True
+                                               self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+                                       elif SoftwareTools.list_updating is False and callback is not None:
+                                               SoftwareTools.list_updating = True
+                                               self.NotifierCallback = callback
+                                               self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+                                       elif SoftwareTools.list_updating is True and callback is not None:
+                                               self.NotifierCallback = callback
+                               else:
+                                       SoftwareTools.list_updating = False
+                                       if callback is not None:
+                                               callback(False)
+                                       elif self.NotifierCallback is not None:
+                                               self.NotifierCallback(False)
+                       else:
+                               SoftwareTools.NetworkConnectionAvailable = False
+                               SoftwareTools.list_updating = False
+                               if callback is not None:
+                                       callback(False)
+                               elif self.NotifierCallback is not None:
+                                       self.NotifierCallback(False)            
                else:
-                       SoftwareTools.list_updating = False
-                       if callback is not None:
-                               callback(False)
-                       elif self.NotifierCallback is not None:
-                               self.NotifierCallback(False)
+                       if SoftwareTools.NetworkConnectionAvailable == True:
+                               SoftwareTools.lastDownloadDate = time()
+                               if SoftwareTools.list_updating is False and callback is None:
+                                       SoftwareTools.list_updating = True
+                                       self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+                               elif SoftwareTools.list_updating is False and callback is not None:
+                                       SoftwareTools.list_updating = True
+                                       self.NotifierCallback = callback
+                                       self.ipkg.startCmd(IpkgComponent.CMD_UPDATE)
+                               elif SoftwareTools.list_updating is True and callback is not None:
+                                       self.NotifierCallback = callback
+                       else:
+                               SoftwareTools.list_updating = False
+                               if callback is not None:
+                                       callback(False)
+                               elif self.NotifierCallback is not None:
+                                       self.NotifierCallback(False)
 
        def ipkgCallback(self, event, param):
                if event == IpkgComponent.EVENT_ERROR:
index 04147bf..9c3b35c 100755 (executable)
@@ -14,7 +14,8 @@ from Components.MenuList import MenuList
 from Components.Sources.List import List
 from Components.Slider import Slider
 from Components.Harddisk import harddiskmanager
-from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations
+from Components.config import config,getConfigListEntry, ConfigSubsection, ConfigText, ConfigLocations, ConfigYesNo, ConfigSelection
+from Components.ConfigList import ConfigListScreen
 from Components.Console import Console
 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest
 from Components.SelectionList import SelectionList
@@ -26,7 +27,8 @@ from Components.AVSwitch import AVSwitch
 from Components.Network import iNetwork
 from Tools.Directories import pathExists, fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_CURRENT_PLUGIN, SCOPE_CURRENT_SKIN, SCOPE_METADIR
 from Tools.LoadPixmap import LoadPixmap
-from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad
+from Tools.NumericalTextInput import NumericalTextInput
+from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop, ePicLoad, eRCInput, getPrevAsciiCode
 from cPickle import dump, load
 from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK
 from time import time, gmtime, strftime, localtime
@@ -43,6 +45,14 @@ config.plugins.configurationbackup = ConfigSubsection()
 config.plugins.configurationbackup.backuplocation = ConfigText(default = '/media/hdd/', visible_width = 50, fixed_size = False)
 config.plugins.configurationbackup.backupdirs = ConfigLocations(default=['/etc/enigma2/', '/etc/network/interfaces', '/etc/wpa_supplicant.conf', '/etc/resolv.conf', '/etc/default_gw', '/etc/hostname'])
 
+config.plugins.SoftwareManager = ConfigSubsection()
+config.plugins.SoftwareManager.overwriteConfigFiles = ConfigSelection(
+                               [
+                                ("Y", _("Yes, always")),
+                                ("N", _("No, never")),                          
+                                ("ask", _("Always ask"))
+                               ], "Y")
+
 def write_cache(cache_file, cache_data):
        #Does a cPickle dump
        if not os_path.isdir( os_path.dirname(cache_file) ):
@@ -109,13 +119,16 @@ class UpdatePluginMenu(Screen):
                self.menu = args
                self.list = []
                self.oktext = _("\nPress OK on your remote control to continue.")
+               self.menutext = _("Press MENU on your remote control for additional options.")
+               self.infotext = _("Press INFO on your remote control for additional information.")
                self.text = ""
                self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value )
                if self.menu == 0:
+                       print "building menu entries"
                        self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your STB" ) + self.oktext, None))
                        self.list.append(("software-update", _("Software update"), _("\nOnline update of your STB software." ) + self.oktext, None))
                        self.list.append(("software-restore", _("Software restore"), _("\nRestore your STB with a new firmware." ) + self.oktext, None))
-                       self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your STB settings." ) + self.oktext, None))
+                       self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your STB settings." ) + self.oktext + "\n\n" + self.infotext, None))
                        self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your STB settings." ) + self.oktext, None))
                        self.list.append(("ipkg-install", _("Install local extension"),  _("\nScan for local extensions and install them." ) + self.oktext, None))
                        for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER):
@@ -136,7 +149,7 @@ class UpdatePluginMenu(Screen):
                elif self.menu == 1:
                        self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None))
                        self.list.append(("backuplocation", _("Choose backup location"),  _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None))
-                       self.list.append(("backupfiles", _("Choose backup files"),  _("Select files for backup. Currently selected:\n" ) + self.backupdirs + self.oktext, None))
+                       self.list.append(("backupfiles", _("Choose backup files"),  _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, None))
                        if config.usage.setup_level.index >= 2: # expert+
                                self.list.append(("ipkg-manager", _("Packet management"),  _("\nView, install and remove available or installed packages." ) + self.oktext, None))
                        self.list.append(("ipkg-source",_("Choose upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None))
@@ -156,25 +169,25 @@ class UpdatePluginMenu(Screen):
 
                self["menu"] = List(self.list)
                self["key_red"] = StaticText(_("Close"))
-               self["status"] = StaticText("")
+               self["status"] = StaticText(self.menutext)
 
-               self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions"],
+               self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions"],
                {
                        "ok": self.go,
                        "back": self.close,
                        "red": self.close,
+                       "menu": self.handleMenu,
+                       "showEventInfo": self.handleInfo,
                }, -1)
                self.onLayoutFinish.append(self.layoutFinished)
                self.backuppath = getBackupPath()
                self.backupfile = getBackupFilename()
                self.fullbackupfilename = self.backuppath + "/" + self.backupfile
                self.onShown.append(self.setWindowTitle)
-               #self.onClose.append(self.cleanup)
 
        def layoutFinished(self):
                idx = 0
                self["menu"].index = idx
-               #self.getUpdateInfos()
 
        def setWindowTitle(self):
                self.setTitle(_("Software management"))
@@ -201,9 +214,17 @@ class UpdatePluginMenu(Screen):
                        self.text = _("No network connection available.")
                self["status"].setText(self.text)
 
+       def handleMenu(self):
+               self.session.open(SoftwareManagerSetup)
+               
+       def handleInfo(self):
+               current = self["menu"].getCurrent()
+               if current:
+                       currentEntry = current[0]
+                       if currentEntry in ("system-backup","backupfiles"):
+                               self.session.open(SoftwareManagerInfo, mode = "backupinfo")
 
        def go(self):
-               #iNetwork.stopPingConsole()
                current = self["menu"].getCurrent()
                if current:
                        currentEntry = current[0]
@@ -290,6 +311,185 @@ class UpdatePluginMenu(Screen):
                        self.exe = True
                        self.session.open(RestoreScreen, runRestore = True)
 
+class SoftwareManagerSetup(Screen, ConfigListScreen):
+
+       skin = """
+               <screen name="SoftwareManagerSetup" position="center,center" size="560,440" title="SoftwareManager setup">
+                       <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+                       <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+                       <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+                       <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+                       <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+                       <widget name="config" position="5,50" size="550,350" scrollbarMode="showOnDemand" />
+                       <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+                       <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+               </screen>"""
+
+       def __init__(self, session, skin_path = None):
+               Screen.__init__(self, session)
+               self.session = session
+               self.skin_path = skin_path
+               if self.skin_path == None:
+                       self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager")
+
+               self.onChangedEntry = [ ]
+               self.setup_title = _("Software manager setup")
+               self.overwriteConfigfilesEntry = None
+
+               self.list = [ ]
+               ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry)
+
+               self["actions"] = ActionMap(["SetupActions"],
+                       {
+                               "cancel": self.keyCancel,
+                               "save": self.apply,
+                       }, -2)
+
+               self["key_red"] = StaticText(_("Cancel"))
+               self["key_green"] = StaticText(_("OK"))
+               self["key_yellow"] = StaticText()
+               self["key_blue"] = StaticText()
+               self["introduction"] = StaticText()
+
+               self.createSetup()
+               self.onLayoutFinish.append(self.layoutFinished)
+
+       def layoutFinished(self):
+               self.setTitle(self.setup_title)
+
+       def createSetup(self):
+               self.list = [ ]
+               self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.SoftwareManager.overwriteConfigFiles)
+               self.list.append(self.overwriteConfigfilesEntry)        
+               self["config"].list = self.list
+               self["config"].l.setSeperation(400)
+               self["config"].l.setList(self.list)
+               if not self.selectionChanged in self["config"].onSelectionChanged:
+                       self["config"].onSelectionChanged.append(self.selectionChanged)
+               self.selectionChanged()
+
+       def selectionChanged(self):
+               if self["config"].getCurrent() == self.overwriteConfigfilesEntry:
+                       self["introduction"].setText(_("Overwrite configuration files during software upgrade?"))
+               else:
+                       self["introduction"].setText("")
+
+       def newConfig(self):
+               pass
+
+       def keyLeft(self):
+               ConfigListScreen.keyLeft(self)
+
+       def keyRight(self):
+               ConfigListScreen.keyRight(self)
+
+       def confirm(self, confirmed):
+               if not confirmed:
+                       print "not confirmed"
+                       return
+               else:
+                       self.keySave()
+
+       def apply(self):
+               self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
+
+       def cancelConfirm(self, result):
+               if not result:
+                       return
+               for x in self["config"].list:
+                       x[1].cancel()
+               self.close()
+
+       def keyCancel(self):
+               if self["config"].isChanged():
+                       self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
+               else:
+                       self.close()
+
+       # for summary:
+       def changedEntry(self):
+               for x in self.onChangedEntry:
+                       x()
+               self.selectionChanged()
+
+       def getCurrentEntry(self):
+               return self["config"].getCurrent()[0]
+
+       def getCurrentValue(self):
+               return str(self["config"].getCurrent()[1].value)
+
+       def createSummary(self):
+               from Screens.Setup import SetupSummary
+               return SetupSummary
+
+
+class SoftwareManagerInfo(Screen):
+       skin = """
+               <screen name="SoftwareManagerInfo" position="center,center" size="560,440" title="SoftwareManager information">
+                       <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+                       <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
+                       <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+                       <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+                       <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+                       <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+                       <widget source="list" render="Listbox" position="5,50" size="550,340" scrollbarMode="showOnDemand" selectionDisabled="0">
+                               <convert type="TemplatedMultiContent">
+                                       {"template": [
+                                                       MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name
+                                               ],
+                                       "fonts": [gFont("Regular", 24),gFont("Regular", 22)],
+                                       "itemHeight": 26
+                                       }
+                               </convert>
+                       </widget>
+                       <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+                       <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+               </screen>"""
+
+       def __init__(self, session, skin_path = None, mode = None):
+               Screen.__init__(self, session)
+               self.session = session
+               self.mode = mode
+               self.skin_path = skin_path
+               if self.skin_path == None:
+                       self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager")
+
+               self["actions"] = ActionMap(["ShortcutActions", "WizardActions"],
+                       {
+                               "back": self.close,
+                               "red": self.close,
+                       }, -2)
+
+               self.list = []
+               self["list"] = List(self.list)
+               
+               self["key_red"] = StaticText(_("Close"))
+               self["key_green"] = StaticText()
+               self["key_yellow"] = StaticText()
+               self["key_blue"] = StaticText()
+               self["introduction"] = StaticText()
+
+               self.onLayoutFinish.append(self.layoutFinished)
+
+       def layoutFinished(self):
+               self.setTitle(_("Softwaremanager information"))
+               if self.mode is not None:
+                       self.showInfos()
+
+       def showInfos(self):
+               if self.mode == "backupinfo":
+                       self.list = []
+                       backupfiles = config.plugins.configurationbackup.backupdirs.value
+                       for entry in backupfiles:
+                               print entry
+                               self.list.append((entry,))
+                       self['list'].setList(self.list)
+                       
 
 class PluginManager(Screen, DreamInfoHandler):
 
@@ -1095,7 +1295,7 @@ class PluginDetails(Screen, DreamInfoHandler):
 
 class UpdatePlugin(Screen):
        skin = """
-               <screen name="UpdatePlugin" position="center,center" size="550,200" title="Software update" >
+               <screen name="UpdatePlugin" position="center,center" size="550,300" title="Software update" >
                        <widget name="activityslider" position="0,0" size="550,5"  />
                        <widget name="slider" position="0,150" size="550,30"  />
                        <widget source="package" render="Label" position="10,30" size="540,20" font="Regular;18" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
@@ -1115,9 +1315,11 @@ class UpdatePlugin(Screen):
                self["status"] = self.status
                self.package = StaticText()
                self["package"] = self.package
+               self.oktext = _("Press OK on your remote control to continue.")
 
                self.packages = 0
                self.error = 0
+               self.processed_packages = []
 
                self.activity = 0
                self.activityTimer = eTimer()
@@ -1151,20 +1353,34 @@ class UpdatePlugin(Screen):
                                self.slider.setValue(self.sliderPackages[param])
                        self.package.setText(param)
                        self.status.setText(_("Upgrading"))
-                       self.packages += 1
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
                elif event == IpkgComponent.EVENT_INSTALL:
                        self.package.setText(param)
                        self.status.setText(_("Installing"))
-                       self.packages += 1
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
+               elif event == IpkgComponent.EVENT_REMOVE:
+                       self.package.setText(param)
+                       self.status.setText(_("Removing"))
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
                elif event == IpkgComponent.EVENT_CONFIGURING:
                        self.package.setText(param)
                        self.status.setText(_("Configuring"))
+                       
                elif event == IpkgComponent.EVENT_MODIFIED:
-                       self.session.openWithCallback(
-                               self.modificationCallback,
-                               MessageBox,
-                               _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
-                       )
+                       if config.plugins.SoftwareManager.overwriteConfigFiles.value in ("N", "Y"):
+                               self.ipkg.write(True and config.plugins.SoftwareManager.overwriteConfigFiles.value)
+                       else:
+                               self.session.openWithCallback(
+                                       self.modificationCallback,
+                                       MessageBox,
+                                       _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
+                               )
                elif event == IpkgComponent.EVENT_ERROR:
                        self.error += 1
                elif event == IpkgComponent.EVENT_DONE:
@@ -1178,7 +1394,7 @@ class UpdatePlugin(Screen):
                                self.activityslider.setValue(0)
                                
                                self.package.setText("")
-                               self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages)
+                               self.status.setText(_("Done - Installed or upgraded %d packages") % self.packages + "\n\n" + self.oktext)
                        else:
                                self.activityTimer.stop()
                                self.activityslider.setValue(0)
@@ -1381,7 +1597,7 @@ class IPKGSource(Screen):
                self["text"].number(number)
 
 
-class PacketManager(Screen):
+class PacketManager(Screen, NumericalTextInput):
        skin = """
                <screen name="PacketManager" position="center,center" size="530,420" title="Packet manager" >
                        <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
@@ -1405,15 +1621,29 @@ class PacketManager(Screen):
                
        def __init__(self, session, plugin_path, args = None):
                Screen.__init__(self, session)
+               NumericalTextInput.__init__(self)
                self.session = session
                self.skin_path = plugin_path
 
-               self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], 
+               self.setUseableChars(u'1234567890abcdefghijklmnopqrstuvwxyz')
+
+               self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "NumberActions", "InputActions", "InputAsciiActions", "KeyboardInputActions" ],
                {
                        "ok": self.go,
                        "back": self.exit,
                        "red": self.exit,
                        "green": self.reload,
+                       "gotAsciiCode": self.keyGotAscii,
+                       "1": self.keyNumberGlobal,
+                       "2": self.keyNumberGlobal,
+                       "3": self.keyNumberGlobal,
+                       "4": self.keyNumberGlobal,
+                       "5": self.keyNumberGlobal,
+                       "6": self.keyNumberGlobal,
+                       "7": self.keyNumberGlobal,
+                       "8": self.keyNumberGlobal,
+                       "9": self.keyNumberGlobal,
+                       "0": self.keyNumberGlobal
                }, -1)
                
                self.list = []
@@ -1438,12 +1668,44 @@ class PacketManager(Screen):
                self.onShown.append(self.setWindowTitle)
                self.onLayoutFinish.append(self.rebuildList)
 
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmAscii)                
+
+       def keyNumberGlobal(self, val):
+               key = self.getKey(val)
+               if key is not None:
+                       keyvalue = key.encode("utf-8")
+                       if len(keyvalue) == 1:
+                               self.setNextIdx(keyvalue[0])
+               
+       def keyGotAscii(self):
+               keyvalue = unichr(getPrevAsciiCode()).encode("utf-8")
+               if len(keyvalue) == 1:
+                       self.setNextIdx(keyvalue[0])
+               
+       def setNextIdx(self,char):
+               if char in ("0", "1", "a"):
+                       self["list"].setIndex(0)
+               else:
+                       idx = self.getNextIdx(char)
+                       if idx and idx <= self["list"].count:
+                               self["list"].setIndex(idx)
+
+       def getNextIdx(self,char):
+               idx = 0
+               for i in self["list"].list:
+                       if i[0][0] == char:
+                               return idx
+                       idx += 1
+
        def exit(self):
                self.ipkg.stop()
                if self.Console is not None:
                        if len(self.Console.appContainers):
                                for name in self.Console.appContainers.keys():
                                        self.Console.kill(name)
+               rcinput = eRCInput.getInstance()
+               rcinput.setKeyboardMode(rcinput.kmNone)
                self.close()
 
        def reload(self):
index 9687633..7f98f3d 100755 (executable)
@@ -25,6 +25,7 @@ class Ipkg(Screen):
                
                self.packages = 0
                self.error = 0
+               self.processed_packages = []
                
                self.activity = 0
                self.activityTimer = eTimer()
@@ -85,15 +86,21 @@ class Ipkg(Screen):
                                self.slider.setValue(self.sliderPackages[param])
                        self.package.setText(param)
                        self.status.setText(_("Upgrading"))
-                       self.packages += 1
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
                elif event == IpkgComponent.EVENT_INSTALL:
                        self.package.setText(param)
                        self.status.setText(_("Installing"))
-                       self.packages += 1
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
                elif event == IpkgComponent.EVENT_REMOVE:
                        self.package.setText(param)
                        self.status.setText(_("Removing"))
-                       self.packages += 1
+                       if not param in self.processed_packages:
+                               self.processed_packages.append(param)
+                               self.packages += 1
                elif event == IpkgComponent.EVENT_CONFIGURING:
                        self.package.setText(param)
                        self.status.setText(_("Configuring"))
@@ -103,10 +110,10 @@ class Ipkg(Screen):
                        self.runNextCmd()
                elif event == IpkgComponent.EVENT_MODIFIED:
                        self.session.openWithCallback(
-                                self.modificationCallback,
-                                MessageBox,
-                                _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
-                        )
+                               self.modificationCallback,
+                               MessageBox,
+                               _("A configuration file (%s) was modified since Installation.\nDo you want to keep your version?") % (param)
+                       )
 
        def modificationCallback(self, res):
                self.ipkg.write(res and "N" or "Y")
index df6a5ea..da090b1 100644 (file)
@@ -31,7 +31,7 @@ class NumericalTextInput:
                        return
 
                if self.lang == 'de_DE':
-                       self.mapping.append (u".,?'+\"0-()@/:_$!") # 0
+                       self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0
                        self.mapping.append (u" 1") # 1
                        self.mapping.append (u"aäbc2AÄBC") # 2
                        self.mapping.append (u"def3DEF") # 3
@@ -42,7 +42,7 @@ class NumericalTextInput:
                        self.mapping.append (u"tuüv8TUÜV") # 8
                        self.mapping.append (u"wxyz9WXYZ") # 9
                elif self.lang == 'es_ES':
-                       self.mapping.append (u".,?'+\"0-()@/:_$!") # 0
+                       self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0
                        self.mapping.append (u" 1") # 1
                        self.mapping.append (u"abcáà2ABCÁÀ") # 2
                        self.mapping.append (u"deéèf3DEFÉÈ") # 3
@@ -53,7 +53,7 @@ class NumericalTextInput:
                        self.mapping.append (u"tuvúù8TUVÚÙ") # 8
                        self.mapping.append (u"wxyz9WXYZ") # 9
                if self.lang in ('sv_SE', 'fi_FI'):
-                       self.mapping.append (u".,?'+\"0-()@/:_$!") # 0
+                       self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0
                        self.mapping.append (u" 1") # 1
                        self.mapping.append (u"abcåä2ABCÅÄ") # 2
                        self.mapping.append (u"defé3DEFÉ") # 3
@@ -64,7 +64,7 @@ class NumericalTextInput:
                        self.mapping.append (u"tuv8TUV") # 8
                        self.mapping.append (u"wxyz9WXYZ") # 9
                else:
-                       self.mapping.append (u".,?'+\"0-()@/:_$!") # 0
+                       self.mapping.append (u".,?'+\"0-()@/:_$!=") # 0
                        self.mapping.append (u" 1") # 1
                        self.mapping.append (u"abc2ABC") # 2
                        self.mapping.append (u"def3DEF") # 3
index 4ecbd76..b34b62f 100644 (file)
@@ -20,6 +20,8 @@
 #include <gst/pbutils/missing-plugins.h>
 #include <sys/stat.h>
 
+#define HTTP_TIMEOUT 10
+
 // eServiceFactoryMP3
 
 eServiceFactoryMP3::eServiceFactoryMP3()
@@ -218,6 +220,7 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
 {
        m_seekTimeout = eTimer::create(eApp);
        m_subtitle_sync_timer = eTimer::create(eApp);
+       m_streamingsrc_timeout = 0;
        m_stream_tags = 0;
        m_currentAudioStream = -1;
        m_currentSubtitleStream = 0;
@@ -238,63 +241,64 @@ eServiceMP3::eServiceMP3(eServiceReference ref)
        if (!ext)
                ext = filename;
 
-       sourceStream sourceinfo;
-       sourceinfo.is_video = FALSE;
-       sourceinfo.audiotype = atUnknown;
+       m_sourceinfo.is_video = FALSE;
+       m_sourceinfo.audiotype = atUnknown;
        if ( (strcasecmp(ext, ".mpeg") && strcasecmp(ext, ".mpg") && strcasecmp(ext, ".vob") && strcasecmp(ext, ".bin") && strcasecmp(ext, ".dat") ) == 0 )
        {
-               sourceinfo.containertype = ctMPEGPS;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctMPEGPS;
+               m_sourceinfo.is_video = TRUE;
        }
        else if ( strcasecmp(ext, ".ts") == 0 )
        {
-               sourceinfo.containertype = ctMPEGTS;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctMPEGTS;
+               m_sourceinfo.is_video = TRUE;
        }
        else if ( strcasecmp(ext, ".mkv") == 0 )
        {
-               sourceinfo.containertype = ctMKV;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctMKV;
+               m_sourceinfo.is_video = TRUE;
        }
        else if ( strcasecmp(ext, ".avi") == 0 || strcasecmp(ext, ".divx") == 0)
        {
-               sourceinfo.containertype = ctAVI;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctAVI;
+               m_sourceinfo.is_video = TRUE;
        }
        else if ( strcasecmp(ext, ".mp4") == 0 || strcasecmp(ext, ".mov") == 0 || strcasecmp(ext, ".m4v") == 0)
        {
-               sourceinfo.containertype = ctMP4;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctMP4;
+               m_sourceinfo.is_video = TRUE;
        }
        else if ( strcasecmp(ext, ".m4a") == 0 )
        {
-               sourceinfo.containertype = ctMP4;
-               sourceinfo.audiotype = atAAC;
+               m_sourceinfo.containertype = ctMP4;
+               m_sourceinfo.audiotype = atAAC;
        }
        else if ( strcasecmp(ext, ".mp3") == 0 )
-               sourceinfo.audiotype = atMP3;
+               m_sourceinfo.audiotype = atMP3;
        else if ( (strncmp(filename, "/autofs/", 8) || strncmp(filename+strlen(filename)-13, "/track-", 7) || strcasecmp(ext, ".wav")) == 0 )
-               sourceinfo.containertype = ctCDA;
+               m_sourceinfo.containertype = ctCDA;
        if ( strcasecmp(ext, ".dat") == 0 )
        {
-               sourceinfo.containertype = ctVCD;
-               sourceinfo.is_video = TRUE;
+               m_sourceinfo.containertype = ctVCD;
+               m_sourceinfo.is_video = TRUE;
        }
-       if ( (strncmp(filename, "http://", 7)) == 0 || (strncmp(filename, "udp://", 6)) == 0 || (strncmp(filename, "rtp://", 6)) == 0  || (strncmp(filename, "https://", 8)) == 0 || (strncmp(filename, "mms://", 6)) == 0 || (strncmp(filename, "rtsp://", 7)) == 0 )
-               sourceinfo.is_streaming = TRUE;
+       if ( (strncmp(filename, "http://", 7)) == 0 || (strncmp(filename, "udp://", 6)) == 0 || (strncmp(filename, "rtp://", 6)) == 0  || (strncmp(filename, "https://", 8)) == 0 || (strncmp(filename, "mms://", 6)) == 0 || (strncmp(filename, "rtsp://", 7)) == 0 || (strncmp(filename, "rtspt://", 7)) == 0 )
+               m_sourceinfo.is_streaming = TRUE;
 
        gchar *uri;
 
-       if ( sourceinfo.is_streaming )
+       if ( m_sourceinfo.is_streaming )
        {
                uri = g_strdup_printf ("%s", filename);
+               m_streamingsrc_timeout = eTimer::create(eApp);;
+               CONNECT(m_streamingsrc_timeout->timeout, eServiceMP3::sourceTimeout);
        }
-       else if ( sourceinfo.containertype == ctCDA )
+       else if ( m_sourceinfo.containertype == ctCDA )
        {
                int i_track = atoi(filename+18);
                uri = g_strdup_printf ("cdda://%i", i_track);
        }
-       else if ( sourceinfo.containertype == ctVCD )
+       else if ( m_sourceinfo.containertype == ctVCD )
        {
                int fd = open(filename,O_RDONLY);
                char tmp[128*1024];
@@ -416,6 +420,12 @@ RESULT eServiceMP3::start()
        return 0;
 }
 
+void eServiceMP3::sourceTimeout()
+{
+       eDebug("eServiceMP3::http source timeout! issuing eof...");
+       m_event((iPlayableService*)this, evEOF);
+}
+
 RESULT eServiceMP3::stop()
 {
        ASSERT(m_state != stIdle);
@@ -1152,6 +1162,8 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                                }       break;
                                case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
                                {
+                                       if ( m_sourceinfo.is_streaming && m_streamingsrc_timeout )
+                                               m_streamingsrc_timeout->stop();
                                }       break;
                                case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
                                {
@@ -1303,6 +1315,7 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
 //                             g_free (g_type);
                        }
                        m_event((iPlayableService*)this, evUpdatedEventInfo);
+                       break;
                }
                case GST_MESSAGE_ELEMENT:
                {
@@ -1351,6 +1364,37 @@ void eServiceMP3::gstBusCall(GstBus *bus, GstMessage *msg)
                        gst_message_parse_buffering(msg, &(m_bufferInfo.bufferPercent));
                        gst_message_parse_buffering_stats(msg, &mode, &(m_bufferInfo.avgInRate), &(m_bufferInfo.avgOutRate), &(m_bufferInfo.bufferingLeft));
                        m_event((iPlayableService*)this, evBuffering);
+                       break;
+               }
+               case GST_MESSAGE_STREAM_STATUS:
+               {
+                       GstStreamStatusType type;
+                       GstElement *owner;
+                       gst_message_parse_stream_status (msg, &type, &owner);
+                       if ( type == GST_STREAM_STATUS_TYPE_CREATE && m_sourceinfo.is_streaming )
+                       {
+                               if ( GST_IS_PAD(source) )
+                                       owner = gst_pad_get_parent_element(GST_PAD(source));
+                               else if ( GST_IS_ELEMENT(source) )
+                                       owner = GST_ELEMENT(source);
+                               else
+                                       owner = 0;
+                               if ( owner )
+                               {
+                                       GstElementFactory *factory = gst_element_get_factory(GST_ELEMENT(owner));
+                                       const gchar *name = gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(factory));
+                                       if (!strcmp(name, "souphttpsrc"))
+                                       {
+                                               m_streamingsrc_timeout->start(HTTP_TIMEOUT*1000, true);
+                                               g_object_set (G_OBJECT (owner), "timeout", HTTP_TIMEOUT, NULL);
+                                               eDebug("eServiceMP3::GST_STREAM_STATUS_TYPE_CREATE -> setting timeout on %s to %is", name, HTTP_TIMEOUT);
+                                       }
+                                       
+                               }
+                               if ( GST_IS_PAD(source) )
+                                       gst_object_unref(owner);
+                       }
+                       break;
                }
                default:
                        break;
index 56a068b..af68bd9 100644 (file)
@@ -211,9 +211,13 @@ private:
 
        std::list<ePangoSubtitlePage> m_subtitle_pages;
        ePtr<eTimer> m_subtitle_sync_timer;
+       
+       ePtr<eTimer> m_streamingsrc_timeout;
        void pushSubtitles();
        void pullSubtitle();
+       void sourceTimeout();
        int m_subs_to_pull;
+       sourceStream m_sourceinfo;
        eSingleLock m_subs_to_pull_lock;
        gulong m_subs_to_pull_handler_id;