def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(["OkCancelActions"], {
            "cancel": self.Exit,
            "ok": self.Ok
        }, -1)

        #Blocklaufwerke
        self.device_uuid = None
        list = []
        for x in listdir("/sys/block"):
            if x[0:2] == 'sd' or x[0:2] == 'hd':
                print "[FlashExpander] device", x
                devices = Harddisk(x, False)
                for y in range(devices.numPartitions()):
                    fstype = self.__getPartitionType(
                        devices.partitionPath(str(y + 1)))
                    if fstype == False:
                        fstype = self.__getPartitionType(
                            devices.partitionPath(str(y + 1)))
                    try:
                        bustype = devices.bus_type()
                    except:
                        bustype = _("unknown")
                    if fstype in ("ext2", "ext3", "ext4", "xfs"):
                        list.append(("%s (%s) - Partition %d (%s)" %
                                     (devices.model(), bustype, y + 1, fstype),
                                     (devices, y + 1, fstype)))

        #Netzlaufwerke
        try:
            for x in getMountP():
                entry = x.split(' ')
                if len(entry) > 3 and entry[2] == "nfs":
                    server = entry[0].split(':')
                    if len(server) == 2:
                        print "[FlashExpander] server", server
                        list.append(("Server (%s) - Path (%s)" %
                                     (server[0], server[1]), server))
        except:
            print "[FlashExpander] <getMountPoints>"

        if len(list) == 0:
            list.append((_(
                "No HDD-, SSD- or USB-Device found. Please first initialized."
            ), None))

        self["list"] = MenuList(list=list)
        self.Console = Console()
    def __init__(self, session):
        Screen.__init__(self, session)

        self["actions"] = ActionMap(["OkCancelActions"], {"cancel": self.Exit, "ok": self.Ok}, -1)

        # Blocklaufwerke
        list = []
        for x in listdir("/sys/block"):
            if x[0:2] == "sd" or x[0:2] == "hd":
                print "[FlashExpander] device", x
                devices = Harddisk(x)
                for y in range(devices.numPartitions()):
                    fstype = self.__getPartitionType(devices.partitionPath(str(y + 1)))
                    if fstype == False:
                        fstype = self.__getPartitionType(devices.partitionPath(str(y + 1)))
                    try:
                        bustype = devices.bus_type()
                    except:
                        bustype = _("unknown")
                    if fstype in ("ext2", "ext3", "ext4", "xfs"):
                        list.append(
                            (
                                "%s (%s) - Partition %d (%s)" % (devices.model(), bustype, y + 1, fstype),
                                (devices, y + 1, fstype),
                            )
                        )

                        # Netzlaufwerke
        try:
            for x in getMountP():
                entry = x.split(" ")
                if len(entry) > 3 and entry[2] == "nfs":
                    server = entry[0].split(":")
                    if len(server) == 2:
                        print "[FlashExpander] server", server
                        list.append(("Server (%s) - Path (%s)" % (server[0], server[1]), server))
        except:
            print "[FlashExpander] <getMountPoints>"

        if len(list) == 0:
            list.append((_("No HDD-, SSD- or USB-Device found. Please first initialized."), None))

        self["list"] = MenuList(list=list)
        self.Console = Console()
Exemple #3
0
    def updateHotplugDevices(self):
        self.hotplugServices = []
        print("[update hutplug]")
        try:
            from Components.Harddisk import Harddisk
            try:
                import commands
            except:
                import subprocess as commands
            movieConfig = MovieConfig()
            lines = commands.getoutput('mount | grep /dev/sd').split('\n')
            print(lines)
            for mount in lines:
                if len(mount) < 2:
                    continue
                m = mount.split(' type')[0].split(' on ')
                m_dev, m_path = m[0], m[1]
                label = os.path.split(m_path)[-1]
                blkid = commands.getoutput('blkid ' + m_dev).split("\"")
                if len(blkid) > 2 and blkid[1]:
                    label = blkid[1]
                if os.path.normpath(m_path) == "/media/hdd" or label in ("DUMBO", "TIMOTHY"):
                    continue
                if not movieConfig.isHiddenHotplug(label):
                    if m_path[-1] != "/":
                        m_path += "/"
                    service = eServiceReferenceHotplug(m_path)
                    hdd = Harddisk(m_dev.replace("/dev/", "")[:-1])
                    if label:
                        label += " - "
                    service.setName(label + hdd.model() + " - " + hdd.capacity())
                    self.hotplugServices.append(service)

            for callback in self.notifier:
                try:
                    callback()
                except:
                    printStackTrace()
        except:
            printStackTrace()
Exemple #4
0
 def updateHotplugDevices(self):
     self.hotplugServices = []
     print "[update hutplug]"
     try:
         from Components.Harddisk import Harddisk
         import commands
         movieConfig = MovieConfig()
         lines = commands.getoutput('mount | grep /dev/sd').split('\n')
         print lines
         for mount in lines:
             if len(mount) < 2:
                 continue
             m = mount.split(' type')[0].split(' on ')
             m_dev, m_path = m[0], m[1]
             label = os.path.split(m_path)[-1]
             blkid = commands.getoutput('blkid ' + m_dev).split("\"")
             if len(blkid) > 2 and blkid[1]:
                 label = blkid[1]
             if os.path.normpath(m_path) == "/media/hdd" or label in ("DUMBO", "TIMOTHY"):
                 continue
             if not movieConfig.isHiddenHotplug(label):
                 if m_path[-1] != "/":
                     m_path += "/"
                 service = eServiceReferenceHotplug(m_path)
                 hdd = Harddisk(m_dev.replace("/dev/", "")[:-1])
                 if label:
                     label += " - "
                 service.setName(label + hdd.model() + " - " + hdd.capacity())
                 self.hotplugServices.append(service)
         
         for callback in self.notifier:
             try:
                 callback()
             except:
                 printStackTrace()
     except:
         printStackTrace()