From be74e4d659f9af9990b12943e3b2ae1dbbef7ddd Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 15 May 2011 17:23:42 +0000 Subject: h-client:added other_names entry - part 1 --- h-client/hlibrary.py | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'h-client/hlibrary.py') 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)) -- cgit v1.2.3