Example #1
0
def listDisks():
    disksData = smartmontools.getDisks();
    if len(disksData) > 0:
        addFolderItem(consts.fontBold + consts.colorBlue + addon.getLocalizedString(50018) +        # Choose disk for smartctl:
                      consts.colorEnd + consts.fontBoldEnd, -97);
        for data in disksData:
            l = data.split("|"); # params indexes: 0 - name; 1 - disk id from /dev/disk/by-id; 2 - device (/dev/sda, /dev/hda etc.)

            # getting and setting params to be passed to next call
            deviceType = smartmontools.getDiskType(l[1]);
            dic = smartctl.getStatusInfo(l[2], deviceType);
            dic[consts.paramDevice] = l[2];
            dic[consts.paramDiskId] = l[1];
            dic[consts.paramDiskType] = deviceType;
            params = sutilsxbmc.createParamStringFromDictionairy(dic, False);
            
            displayName = "";
            
            # add color to device name
            try:
                if dic[consts.paramDeviceIsSuported]:
                    if dic[consts.paramOverallHealth] == "PASSED":
                        displayName = consts.colorShadeOfGreen;
                    else:
                        displayName = consts.colorShadeOfRed;
                else:
                    displayName = consts.colorOrange;
            except:
                displayName = "";
            
            displayName += l[0] + " (" + l[2] + ")" + (consts.colorEnd if displayName else "");
                    
            addFolderItem(displayName , 20, params, True);
Example #2
0
def listDisks():
    disksData = smartmontools.getDisks()
    if len(disksData) > 0:
        addFolderItem(
            consts.fontBold + consts.colorBlue +
            addon.getLocalizedString(50018) +  # Choose disk for smartctl:
            consts.colorEnd + consts.fontBoldEnd,
            -97)
        for data in disksData:
            l = data.split("|")
            # params indexes: 0 - name; 1 - disk id from /dev/disk/by-id; 2 - device (/dev/sda, /dev/hda etc.)

            # getting and setting params to be passed to next call
            deviceType = smartmontools.getDiskType(l[1])
            dic = smartctl.getStatusInfo(l[2], deviceType)
            dic[consts.paramDevice] = l[2]
            dic[consts.paramDiskId] = l[1]
            dic[consts.paramDiskType] = deviceType
            params = sutilsxbmc.createParamStringFromDictionairy(dic, False)

            displayName = ""

            # add color to device name
            try:
                if dic[consts.paramDeviceIsSuported]:
                    if dic[consts.paramOverallHealth] == "PASSED":
                        displayName = consts.colorShadeOfGreen
                    else:
                        displayName = consts.colorShadeOfRed
                else:
                    displayName = consts.colorOrange
            except:
                displayName = ""

            displayName += l[0] + " (" + l[2] + ")" + (consts.colorEnd
                                                       if displayName else "")

            addFolderItem(displayName, 20, params, True)
Example #3
0
    diskId = params[consts.paramDiskId];
    listSmartctlTasks(params[consts.paramDevice], diskId, smartmontools.getDiskType(diskId) ); 
elif index == 21:
    setDeviceType(params[consts.paramDiskId]);
    
# indexes 30 - 39 are reserved for smartctl tests
elif index == 30:
    listSmartctlTests(params[consts.paramDevice], params[consts.paramDiskId], 
                      params[consts.paramDiskType]);
elif index > 30 and index <35:
    executeSmartctlTest(index, params[consts.paramDevice], params[consts.paramDiskId], 
                        params[consts.paramDiskType]);
elif index == 39:
    smartctl.cancelSelfTest(params[consts.paramDevice], params[consts.paramDiskType]);

# indexes 40 - 49 are reserved for smartctl reports + indexes higher than 50000
elif (index >= 40 and index <50) or index > 50000:
    executeIndexesReservedForSmartctlReports(index);
 
elif index == 90:
    print("smartmontools: " + str(params));
    print("smartmontools: " + str(smartctl.getStatusInfo(params[consts.paramDevice])));
elif index == 91:
    showXbmcLogEntries();
elif index == 99:
    warning();  
elif index == -99:
    pass;


Example #4
0
                      smartmontools.getDiskType(diskId))
elif index == 21:
    setDeviceType(params[consts.paramDiskId])

# indexes 30 - 39 are reserved for smartctl tests
elif index == 30:
    listSmartctlTests(params[consts.paramDevice], params[consts.paramDiskId],
                      params[consts.paramDiskType])
elif index > 30 and index < 35:
    executeSmartctlTest(index, params[consts.paramDevice],
                        params[consts.paramDiskId],
                        params[consts.paramDiskType])
elif index == 39:
    smartctl.cancelSelfTest(params[consts.paramDevice],
                            params[consts.paramDiskType])

# indexes 40 - 49 are reserved for smartctl reports + indexes higher than 50000
elif (index >= 40 and index < 50) or index > 50000:
    executeIndexesReservedForSmartctlReports(index)

elif index == 90:
    print("smartmontools: " + str(params))
    print("smartmontools: " +
          str(smartctl.getStatusInfo(params[consts.paramDevice])))
elif index == 91:
    showXbmcLogEntries()
elif index == 99:
    warning()
elif index == -99:
    pass