diff options
author | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-15 17:23:42 +0000 |
---|---|---|
committer | Antonio Gallo <tonicucoz@gmail.com> | 2011-05-15 17:23:42 +0000 |
commit | be74e4d659f9af9990b12943e3b2ae1dbbef7ddd (patch) | |
tree | 74d24dc15be8c2077c5c1d1e089a4f0e534f23bc | |
parent | 79c6af13fd6dc83d8d5dd5627d7b0745b23cc4a9 (diff) |
h-client:added other_names entry - part 1
-rw-r--r-- | h-client/hlibrary.py | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py index 2ae684d..f91748d 100644 --- a/h-client/hlibrary.py +++ b/h-client/hlibrary.py @@ -82,6 +82,7 @@ class Device(object): self._type = '' self._vendor = '' self._model = '' + self._otherNames = '' self._kernel = '' self._distributions = [self.userDistribution()] self._interface = 'not-specified' @@ -95,14 +96,15 @@ class Device(object): self._icon = 'unknown.png' def setPost(self): - self._post['model'] = self._model; - self._post['kernel'] = self._kernel; - self._post['distribution'] = self.createDistroEntry(); - self._post['comm_year'] = self._year; - self._post['pci_id'] = self._vendorId + ':' + self._productId; - self._post['interface'] = self._interface; - self._post['description'] = self._description.replace("\n","\r\n"); - self._post['driver'] = self._driver; + self._post['model'] = self._model + self._post['other_names'] = self._otherNames + self._post['kernel'] = self._kernel + self._post['distribution'] = self.createDistroEntry() + self._post['comm_year'] = self._year + self._post['pci_id'] = self._vendorId + ':' + self._productId + self._post['interface'] = self._interface + self._post['description'] = self._description.replace("\n","\r\n") + self._post['driver'] = self._driver #replace the HTML entitites with utf-8 characters def htmlentitiesDecode(self,string): @@ -184,6 +186,9 @@ class Device(object): def getModel(self): return self._model + def getOtherNames(self): + return self._otherNames + def getKernel(self): return self._kernel @@ -223,6 +228,9 @@ class Device(object): def setModel(self,model): self._model = model + def setOtherNames(self,otherNames): + self._otherNames = otherNames + def setKernel(self,kernel): self._kernel = kernel @@ -400,7 +408,7 @@ class Unknown(Device): super(Unknown, self).__init__() self._type = 'unknown' self._howItWorks = 'no' - self._interfaces = ['not-specified'] + self._interfaces = ['not-specified','USB'] self._icon = 'unknown.png' def setPost(self): @@ -585,7 +593,7 @@ class Client: return Videocard() elif Class == '070100' or Class == '070101' or Class == '070102' or Class == '070103' or Class == '0701ff': return Printer() - elif Class == '0e0100': + elif Class == '0e0100' or Class == 'ff0100': return Webcam() elif Class == 'e00101': return Bluetooth() @@ -883,6 +891,12 @@ class Client: year = device.getElementsByTagName("year")[0].childNodes[0].data.encode('utf-8') + if device.getElementsByTagName("other_names")[0].hasChildNodes(): + other_names = device.getElementsByTagName("other_names")[0].childNodes[0].data.encode('utf-8') + dev[0].setOtherNames(other_names) + else: + dev[0].setOtherNames('') + if device.getElementsByTagName("description")[0].hasChildNodes(): description = device.getElementsByTagName("description")[0].childNodes[0].data.encode('utf-8') dev[0].setDescription(dev[0].htmlentitiesDecode(description)) |